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.1 to 1.0.2

2

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

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

'use strict'
var toPX = require('to-px')
var now = require('right-now')
var sgn = require('signum')
module.exports = mouseWheelListen
function filter(cur, prev, dt) {
return sgn(cur) * Math.sqrt(Math.abs(cur))
}
function mouseWheelListen(element, callback, noScroll) {

@@ -20,6 +14,2 @@ if(typeof element === 'function') {

var lineHeight = toPX('ex', element)
var lastT = now()
var lastX = 0
var lastY = 0
var lastZ = 0
element.addEventListener('wheel', function(ev) {

@@ -29,4 +19,2 @@ if(noScroll) {

}
var t = now()
var dt = t - lastT
var dx = ev.deltaX || 0

@@ -37,3 +25,2 @@ var dy = ev.deltaY || 0

var scale = 1
lastT = t
switch(mode) {

@@ -50,9 +37,2 @@ case 1:

dz *= scale
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) {

@@ -59,0 +39,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