@hscmap/inertial-wheel
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -18,2 +18,3 @@ import { Physics } from "./physics"; | ||
wheel: (e: WheelEvent) => void; | ||
normalize: number; | ||
private tick(); | ||
@@ -20,0 +21,0 @@ } |
@@ -21,2 +21,3 @@ "use strict"; | ||
}; | ||
this.normalize = 60 / 1000; | ||
if (cb.setNextTick == undefined) | ||
@@ -34,5 +35,5 @@ cb.setNextTick = defaultSetNextTick(); | ||
var _this = this; | ||
var _a = this.physics.tick(performance.now()), v = _a.v, wheelstart = _a.wheelstart, wheelend = _a.wheelend; | ||
var _a = this.physics.tick(performance.now()), v = _a.v, dt = _a.dt, wheelstart = _a.wheelstart, wheelend = _a.wheelend; | ||
wheelstart && this.cb.wheelstart && this.cb.wheelstart(new InertialWheelStartEvent()); | ||
this.cb.wheel && this.cb.wheel(new InertialWheelEvent(v, this.lastNativeEvent)); | ||
this.cb.wheel && this.cb.wheel(new InertialWheelEvent(this.normalize * dt * v, this.lastNativeEvent)); | ||
wheelend && this.cb.wheelend && this.cb.wheelend(new InertialWheelEndEvent()); | ||
@@ -39,0 +40,0 @@ wheelend || this.cb.setNextTick(function () { return _this.tick(); }); |
@@ -20,2 +20,3 @@ export declare class Physics { | ||
v: number; | ||
dt: number; | ||
wheelstart: boolean; | ||
@@ -22,0 +23,0 @@ wheelend: boolean; |
@@ -32,3 +32,4 @@ "use strict"; | ||
this.a = 0; | ||
var DT = t - this.t; | ||
var dt0 = t - this.t; | ||
var DT = dt0; | ||
while (DT > 0) { | ||
@@ -46,2 +47,3 @@ var dt = Math.min(DT, this.maxDT); | ||
v: this.v, | ||
dt: Math.min(1000, dt0), | ||
wheelstart: !moving0, | ||
@@ -48,0 +50,0 @@ wheelend: !this.moving |
{ | ||
"name": "@hscmap/inertial-wheel", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"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
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
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
10207
10
195
1