"JS error after using mousewheel without having moved the mouse before."
Update MouseWheel handler to use center of map if no mousemovement has been seen yet. (Closes #882) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4042 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -94,7 +94,17 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
|
||||
// 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
|
||||
e.xy = this.mousePosition;
|
||||
if (this.mousePosition) {
|
||||
e.xy = this.mousePosition;
|
||||
}
|
||||
if (!e.xy) {
|
||||
// If the mouse hasn't moved over the map yet, then
|
||||
// we don't have a mouse position (in FF), so we just
|
||||
// act as if the mouse was at the center of the map.
|
||||
// Note that we can tell we are in the map -- and
|
||||
// this.map is ensured to be true above.
|
||||
e.xy = this.map.getPixelFromLonLat(this.map.getCenter());
|
||||
}
|
||||
if (delta < 0) {
|
||||
this.callback("down", [e, delta]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user