@hscmap/inertial-mouse
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,4 +5,6 @@ import { InertialMouse } from "../src" | ||
window.addEventListener('load', e => { | ||
const sandbox = document.querySelector('.sandbox') as HTMLElement | ||
const cursor = document.querySelector('.cursor') as HTMLElement | ||
const sandbox = document.querySelector('.sandbox') as HTMLElement | ||
const dxText = document.querySelector('[name="dx"]') as HTMLInputElement | ||
const dyText = document.querySelector('[name="dy"]') as HTMLInputElement | ||
@@ -16,2 +18,4 @@ const im = new InertialMouse(sandbox, { | ||
cursor.style.top = `${e.r.y}px` | ||
dxText.value = `${e.d.x}` | ||
dyText.value = `${e.d.y}` | ||
}, | ||
@@ -18,0 +22,0 @@ stop() { |
@@ -5,2 +5,3 @@ export declare class Coord { | ||
constructor(x: number, y: number); | ||
clone(): Coord; | ||
} | ||
@@ -7,0 +8,0 @@ export interface Callbacks { |
@@ -8,2 +8,3 @@ "use strict"; | ||
} | ||
Coord.prototype.clone = function () { return new Coord(this.x, this.y); }; | ||
return Coord; | ||
@@ -81,5 +82,6 @@ }()); | ||
} | ||
this.cb.move && this.cb.move(new MoveEvent(this.r, new Coord(this.r.x - this.lastR.x, this.r.y - this.lastR.y))); | ||
var dr = new Coord(this.r.x - this.lastR.x, this.r.y - this.lastR.y); | ||
this.cb.move && this.cb.move(new MoveEvent(this.r, dr)); | ||
this.lastT = now; | ||
this.lastR = this.r; | ||
this.lastR = this.r.clone(); | ||
}; | ||
@@ -86,0 +88,0 @@ InertialMouse.prototype.coord = function (e) { |
{ | ||
"name": "@hscmap/inertial-mouse", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
export class Coord { | ||
constructor(public x: number, public y: number) { } | ||
clone() { return new Coord(this.x, this.y) } | ||
} | ||
@@ -99,5 +100,6 @@ | ||
this.cb.move && this.cb.move(new MoveEvent(this.r, new Coord(this.r.x - this.lastR.x, this.r.y - this.lastR.y))) | ||
const dr = new Coord(this.r.x - this.lastR.x, this.r.y - this.lastR.y) | ||
this.cb.move && this.cb.move(new MoveEvent(this.r, dr)) | ||
this.lastT = now | ||
this.lastR = this.r | ||
this.lastR = this.r.clone() | ||
} | ||
@@ -104,0 +106,0 @@ |
Sorry, the diff of this file is not supported yet
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
15974
352