mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 00:11:49 +02:00
Fix the handling of older 120 based deltas.
This commit is contained in:
+18
-11
@@ -1,7 +1,7 @@
|
|||||||
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
||||||
* Licensed under the MIT License (LICENSE.txt).
|
* Licensed under the MIT License (LICENSE.txt).
|
||||||
*
|
*
|
||||||
* Version: 3.1.7
|
* Version: 3.1.8-pre
|
||||||
*
|
*
|
||||||
* Requires: jQuery 1.2.2+
|
* Requires: jQuery 1.2.2+
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
||||||
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
||||||
slice = Array.prototype.slice,
|
slice = Array.prototype.slice,
|
||||||
nullLowestDeltaTimeout, lowestDelta;
|
oldMode, nullLowestDeltaTimeout, lowestDelta;
|
||||||
|
|
||||||
if ( $.event.fixHooks ) {
|
if ( $.event.fixHooks ) {
|
||||||
for ( var i = toFix.length; i; ) {
|
for ( var i = toFix.length; i; ) {
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var special = $.event.special.mousewheel = {
|
var special = $.event.special.mousewheel = {
|
||||||
version: '3.1.6',
|
version: '3.1.8-pre',
|
||||||
|
|
||||||
setup: function() {
|
setup: function() {
|
||||||
if ( this.addEventListener ) {
|
if ( this.addEventListener ) {
|
||||||
@@ -137,17 +137,23 @@
|
|||||||
|
|
||||||
if ( !lowestDelta || absDelta < lowestDelta ) {
|
if ( !lowestDelta || absDelta < lowestDelta ) {
|
||||||
lowestDelta = absDelta;
|
lowestDelta = absDelta;
|
||||||
|
|
||||||
|
// Assuming that if the lowestDelta is 120, then that the browser
|
||||||
|
// is treating this as an older mouse wheel event.
|
||||||
|
// We'll divide it by 40 to try and get a more usable deltaFactor.
|
||||||
|
if ( lowestDelta === 120 ) {
|
||||||
|
oldMode = true;
|
||||||
|
lowestDelta /= 40;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assuming that if the lowestDelta is 120, then that the browser
|
// When in oldMode the delta is based on 120. We devide
|
||||||
// is treating this as an older mouse wheel event.
|
// by 40 to try and get a more usable deltaFactor.
|
||||||
// We'll divide it by 40 to try and get a more usable deltaFactor.
|
if ( oldMode ) {
|
||||||
if ( lowestDelta === 120 ) {
|
|
||||||
// Divide all the things by 40!
|
// Divide all the things by 40!
|
||||||
delta /= 40;
|
delta /= 40;
|
||||||
deltaX /= 40;
|
deltaX /= 40;
|
||||||
deltaY /= 40;
|
deltaY /= 40;
|
||||||
lowestDelta /= 40;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a whole, normalized value for the deltas
|
// Get a whole, normalized value for the deltas
|
||||||
@@ -179,6 +185,7 @@
|
|||||||
|
|
||||||
function nullLowestDelta() {
|
function nullLowestDelta() {
|
||||||
lowestDelta = null;
|
lowestDelta = null;
|
||||||
|
oldMode = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user