make sure scroll only scrolls if it was done over the map, and also stop event propagation so that the window doesnt scroll too
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1246 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -183,6 +183,20 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @param {Event} e
|
||||
*/
|
||||
onWheelEvent: function(e){
|
||||
|
||||
// first determine whether or not the wheeling was inside the map
|
||||
var inMap = false;
|
||||
var elem = Event.element(e);
|
||||
while(elem != null) {
|
||||
if (elem == this.map.div) {
|
||||
inMap = true;
|
||||
break;
|
||||
}
|
||||
elem = elem.parentNode;
|
||||
}
|
||||
|
||||
if (inMap) {
|
||||
|
||||
var delta = 0;
|
||||
if (!e) {
|
||||
e = window.event;
|
||||
@@ -202,6 +216,10 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
this.defaultWheelUp();
|
||||
}
|
||||
}
|
||||
|
||||
//only wheel the map, not the window
|
||||
Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user