Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hscmap/inertial-wheel

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hscmap/inertial-wheel - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

1

lib/inertial_wheel.d.ts

@@ -11,3 +11,2 @@ import { Physics } from "./physics";

private cb;
baseInterval: number;
readonly physics: Physics;

@@ -14,0 +13,0 @@ private lastNativeEvent;

5

lib/inertial_wheel.js

@@ -10,3 +10,2 @@ "use strict";

this.cb = cb;
this.baseInterval = 1000 / 60;
this.physics = new physics_1.Physics();

@@ -35,5 +34,5 @@ this.magicTrackpadDetector = new magic_trackpad_detector_1.MagicTrackpadDetector();

var _this = this;
var _a = this.physics.tick(performance.now()), v = _a.v, dt = _a.dt, wheelstart = _a.wheelstart, wheelend = _a.wheelend;
var _a = this.physics.tick(performance.now()), v = _a.v, wheelstart = _a.wheelstart, wheelend = _a.wheelend;
wheelstart && this.cb.wheelstart && this.cb.wheelstart(new InertialWheelStartEvent());
this.cb.wheel && this.cb.wheel(new InertialWheelEvent(dt * v / this.baseInterval, this.lastNativeEvent));
this.cb.wheel && this.cb.wheel(new InertialWheelEvent(v, this.lastNativeEvent));
wheelend && this.cb.wheelend && this.cb.wheelend(new InertialWheelEndEvent());

@@ -40,0 +39,0 @@ wheelend || this.cb.setNextTick(function () { return _this.tick(); });

@@ -15,2 +15,3 @@ export declare class Physics {

t2: number;
maxDT: number;
stop(): void;

@@ -20,3 +21,2 @@ kick(a: number, t: number): void;

v: number;
dt: number;
wheelstart: boolean;

@@ -23,0 +23,0 @@ wheelend: boolean;

@@ -15,2 +15,3 @@ "use strict";

this.t2 = defaults.t2;
this.maxDT = 3 * 1000 / 60;
}

@@ -32,7 +33,11 @@ Physics.prototype.stop = function () {

this.a = 0;
var dt = t - this.t;
this.v += dt * (this.a == 0 ?
-1. / this.t2 * this.v :
this.a / this.t1);
this.v = clamp(this.v, -1, 1);
var DT = t - this.t;
while (DT > 0) {
var dt = Math.min(DT, this.maxDT);
DT -= this.maxDT;
this.v += dt * (this.a == 0 ?
-1. / this.t2 * this.v :
this.a / this.t1);
this.v = clamp(this.v, -1, 1);
}
this.t = t;

@@ -42,3 +47,2 @@ this.moving = this.willMove();

v: this.v,
dt: dt,
wheelstart: !moving0,

@@ -45,0 +49,0 @@ wheelend: !this.moving

{
"name": "@hscmap/inertial-wheel",
"version": "0.6.1",
"version": "0.6.2",
"main": "./lib/index.js",

@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc