Removed caching of the analog wheel detection for users switching between mouse/touchpad
This commit is contained in:
@@ -55,13 +55,6 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
|
||||
*/
|
||||
cumulative: true,
|
||||
|
||||
/**
|
||||
* Property: isAnalogScrollWheel
|
||||
* {Boolean} Will switch to true when an event with analog scroll value
|
||||
* is detected.
|
||||
*/
|
||||
isAnalogScrollWheel: false,
|
||||
|
||||
/**
|
||||
* Property: analogWheelPrecision
|
||||
* {Integer} Adjust to get analog scroll wheel to feel right
|
||||
@@ -186,17 +179,21 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
|
||||
if (e.wheelDelta) {
|
||||
delta = e.wheelDelta;
|
||||
|
||||
if (OpenLayers.BROWSER_NAME === "safari" && !this.isAnalogScrollWheel) {
|
||||
if (OpenLayers.BROWSER_NAME === "safari") {
|
||||
// Safari has a value 10 times other browsers
|
||||
delta = delta * 10;
|
||||
} else if (window.opera && window.opera.version() < 9.2) {
|
||||
delta = -delta;
|
||||
}
|
||||
|
||||
this.isAnalogScrollWheel = (this.isAnalogScrollWheel ||
|
||||
delta % 40 !== 0 || Math.abs(delta) < 120);
|
||||
var isAnalogScrollWheel = (delta % 40 !== 0 || Math.abs(delta) < 120);
|
||||
|
||||
if (this.isAnalogScrollWheel) {
|
||||
if (isAnalogScrollWheel) {
|
||||
delta = delta / this.analogWheelPrecision;
|
||||
if (OpenLayers.BROWSER_NAME === "safari") {
|
||||
// Undo the Safari multiplying for analog scrolling
|
||||
delta = delta / 10;
|
||||
}
|
||||
} else {
|
||||
delta = Math.round(delta / 120);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user