@hscmap/inertial-mouse
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -9,2 +9,3 @@ import { V2 } from "./v2"; | ||
moveend?(e: MoveEndEvent): void; | ||
setNextTick?(tick: () => void): void; | ||
} | ||
@@ -21,5 +22,3 @@ export declare class InertialMouse { | ||
private mouseup; | ||
private rafId?; | ||
private setNextTick(); | ||
private tick(); | ||
protected tick(): void; | ||
private coord(e); | ||
@@ -26,0 +25,0 @@ } |
@@ -21,3 +21,3 @@ "use strict"; | ||
_this.physics.hook(_this.coord(e)); | ||
_this.setNextTick(); | ||
_this.cb.setNextTick(function () { return _this.tick(); }); | ||
}; | ||
@@ -30,2 +30,4 @@ this.mouseup = function (e) { | ||
}; | ||
if (cb.setNextTick == undefined) | ||
cb.setNextTick = defaultSetNextTick(); | ||
target.addEventListener('mousedown', this.mousedown); | ||
@@ -40,12 +42,4 @@ } | ||
}; | ||
InertialMouse.prototype.setNextTick = function () { | ||
InertialMouse.prototype.tick = function () { | ||
var _this = this; | ||
if (this.rafId == undefined) { | ||
this.rafId = requestAnimationFrame(function () { | ||
_this.rafId = undefined; | ||
_this.tick(); | ||
}); | ||
} | ||
}; | ||
InertialMouse.prototype.tick = function () { | ||
var _a = this.physics.tick(performance.now()), r = _a.r, dr = _a.dr, movestart = _a.movestart, moveend = _a.moveend; | ||
@@ -55,3 +49,3 @@ movestart && this.cb.movestart && this.cb.movestart(new MoveStartEvent()); | ||
moveend && this.cb.moveend && this.cb.moveend(new MoveEndEvent()); | ||
moveend || this.setNextTick(); | ||
moveend || this.cb.setNextTick(function () { return _this.tick(); }); | ||
}; | ||
@@ -65,2 +59,13 @@ InertialMouse.prototype.coord = function (e) { | ||
exports.InertialMouse = InertialMouse; | ||
function defaultSetNextTick() { | ||
var rafId; | ||
return function (tick) { | ||
if (rafId == undefined) { | ||
rafId = requestAnimationFrame(function () { | ||
rafId = undefined; | ||
tick(); | ||
}); | ||
} | ||
}; | ||
} | ||
var DownEvent = (function () { | ||
@@ -67,0 +72,0 @@ function DownEvent(r, originalEvent) { |
{ | ||
"name": "@hscmap/inertial-mouse", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11858
12
265
0