With Erik's approval on #341, I'm happy with this. This restores the
mousewheel functionality we had in earlier releases in a similar way, rewritten for handlers. (The benefit of handlers in this case is that handlers are write-once, use many, so the next mousewheel thing we get will *also* be able to use this code.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@2877 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -13,6 +13,14 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
|
||||
/** @type function **/
|
||||
wheelListener: null,
|
||||
|
||||
/** @type OpenLayers.Pixel
|
||||
* @private
|
||||
*
|
||||
* mousePosition is necessary because evt.clientX/Y is buggy in Moz on
|
||||
* wheel events, so we cache and use the value from the last mousemove.
|
||||
**/
|
||||
mousePosition: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
@@ -68,8 +76,7 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
|
||||
// add the mouse position to the event because mozilla has a bug
|
||||
// with clientX and clientY (see https://bugzilla.mozilla.org/show_bug.cgi?id=352179)
|
||||
// getLonLatFromViewPortPx(e) returns wrong values
|
||||
// TODO FIXME FIXME this might not be the right way to port the 2.3 behavior
|
||||
e.xy = this.map.events.getMousePosition(e);
|
||||
e.xy = this.mousePosition;
|
||||
if (delta < 0) {
|
||||
this.callback("down", [e, delta]);
|
||||
} else {
|
||||
@@ -82,6 +89,10 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
|
||||
}
|
||||
},
|
||||
|
||||
mousemove: function (evt) {
|
||||
this.mousePosition = evt.xy;
|
||||
},
|
||||
|
||||
activate: function (evt) {
|
||||
OpenLayers.Handler.prototype.activate.apply(this, arguments);
|
||||
//register mousewheel events specifically on the window and document
|
||||
|
||||
Reference in New Issue
Block a user