@hscmap/inertial-mouse
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -20,2 +20,3 @@ export declare class Coord { | ||
slick: boolean; | ||
minV: number; | ||
private anchor; | ||
@@ -22,0 +23,0 @@ private r; |
@@ -21,2 +21,3 @@ "use strict"; | ||
this.slick = true; | ||
this.minV = 0.5; | ||
this.lastT = 0; | ||
@@ -99,5 +100,5 @@ this.mousePressed = false; | ||
InertialMouse.prototype.moving = function () { | ||
var minPixel = 1; | ||
var minV = this.minV = 1; | ||
if (this.mousePressed || !this.slick) { | ||
return Math.abs(this.anchor.x - this.r.x) > minPixel || Math.abs(this.anchor.y - this.r.y) > minPixel; | ||
return Math.abs(this.anchor.x - this.r.x) > minV || Math.abs(this.anchor.y - this.r.y) > minV; | ||
} | ||
@@ -107,3 +108,3 @@ else { | ||
var f = this.friction; | ||
return Math.abs(v.x / f) >= minPixel || Math.abs(v.y / f) >= minPixel; | ||
return Math.abs(v.x / f) >= minV || Math.abs(v.y / f) >= minV; | ||
} | ||
@@ -110,0 +111,0 @@ }; |
{ | ||
"name": "@hscmap/inertial-mouse", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
@@ -20,2 +20,3 @@ export class Coord { | ||
slick = true | ||
minV = 0.5 | ||
@@ -122,5 +123,5 @@ private anchor: Coord | ||
private moving() { | ||
const minPixel = 1 | ||
const minV = this.minV = 1 | ||
if (this.mousePressed || !this.slick) { | ||
return Math.abs(this.anchor.x - this.r.x) > minPixel || Math.abs(this.anchor.y - this.r.y) > minPixel | ||
return Math.abs(this.anchor.x - this.r.x) > minV || Math.abs(this.anchor.y - this.r.y) > minV | ||
} | ||
@@ -130,3 +131,3 @@ else { | ||
const f = this.friction | ||
return Math.abs(v.x / f) >= minPixel || Math.abs(v.y / f) >= minPixel | ||
return Math.abs(v.x / f) >= minV || Math.abs(v.y / f) >= minV | ||
} | ||
@@ -133,0 +134,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18542
410