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

@hscmap/magic-trackpad-detector

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hscmap/magic-trackpad-detector - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

9

lib/index.js

@@ -5,5 +5,5 @@ "use strict";

function MagicTrackpadDetector() {
this.tolerance = 7; // ms
this.tolerance = 5; // ms
this.interval = 1000 / 60; // events per second
this.minN1 = 7;
this.minN1 = 5;
this.minN2 = 15;

@@ -24,3 +24,3 @@ this.history = new RingBuffer(Math.max(this.minN1, this.minN2));

var dt = n[0] - o[0];
if (dt < this.interval - this.tolerance || this.interval + this.tolerance < dt)
if (dt < this.interval - this.tolerance)
return false;

@@ -42,4 +42,3 @@ if (n[1] * o[1] < 0 || n[1] / o[1] > 1)

var dt = n[0] - o[0];
if (!(this.interval - this.tolerance <= dt && dt <= this.interval + this.tolerance ||
2 * this.interval - this.tolerance <= dt && dt <= 2 * this.interval + this.tolerance))
if (dt < this.interval - this.tolerance)
return false;

@@ -46,0 +45,0 @@ if (n[1] * o[1] < 0 || n[1] / o[1] > 1)

{
"name": "@hscmap/magic-trackpad-detector",
"version": "0.0.3",
"version": "0.0.4",
"main": "./lib/index.js",

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

export class MagicTrackpadDetector {
tolerance = 7 // ms
tolerance = 5 // ms
interval = 1000 / 60 // events per second
minN1 = 7
minN1 = 5
minN2 = 15

@@ -22,3 +22,3 @@ private history = new RingBuffer<[number, number]>(Math.max(this.minN1, this.minN2))

const dt = n[0] - o[0]
if (dt < this.interval - this.tolerance || this.interval + this.tolerance < dt)
if (dt < this.interval - this.tolerance)
return false

@@ -29,3 +29,3 @@ if (n[1] * o[1] < 0 || n[1] / o[1] > 1)

}
else {
else { // |deltaY| == 1
if (h.length < this.minN2)

@@ -41,8 +41,3 @@ return false

const dt = n[0] - o[0]
if (
!(
this.interval - this.tolerance <= dt && dt <= this.interval + this.tolerance ||
2 * this.interval - this.tolerance <= dt && dt <= 2 * this.interval + this.tolerance
)
)
if (dt < this.interval - this.tolerance)
return false

@@ -49,0 +44,0 @@ if (n[1] * o[1] < 0 || n[1] / o[1] > 1)

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