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

mouse-wheel

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mouse-wheel - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "mouse-wheel",
"version": "1.0.0",
"version": "1.0.1",
"description": "Consistent cross browser mouse wheel movement",

@@ -5,0 +5,0 @@ "main": "wheel.js",

@@ -7,6 +7,8 @@ 'use strict'

var SCROLL_CUTOFF = 100
module.exports = mouseWheelListen
function filter(cur, prev, dt) {
return sgn(cur) * Math.sqrt(Math.abs(cur))
}
function mouseWheelListen(element, callback, noScroll) {

@@ -46,15 +48,9 @@ if(typeof element === 'function') {

dz *= scale
if(dt < SCROLL_CUTOFF) {
var cx = dx, cy = dy, cz = dz
dx = sgn(dx) * Math.max(0, Math.abs(dx) - Math.abs(lastX))
dy = sgn(dy) * Math.max(0, Math.abs(dy) - Math.abs(lastY))
dz = sgn(dz) * Math.max(0, Math.abs(dz) - Math.abs(lastZ))
lastX = cx
lastY = cy
lastZ = cz
} else {
lastX = dx
lastY = dy
lastZ = dz
}
var cx = dx, cy = dy, cz = dz
dx = filter(dx, lastX, dt)
dy = filter(dy, lastY, dt)
dz = filter(dz, lastZ, dt)
lastX = cx
lastY = cy
lastZ = cz
if(dx || dy || dz) {

@@ -61,0 +57,0 @@ return callback(dx, dy, dz)

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