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:
euzuro
2006-08-16 17:24:55 +00:00
parent 2e3ff459b2
commit c2355d207c

View File

@@ -183,6 +183,20 @@ OpenLayers.Control.MouseDefaults.prototype =
* @param {Event} e * @param {Event} e
*/ */
onWheelEvent: function(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; var delta = 0;
if (!e) { if (!e) {
e = window.event; e = window.event;
@@ -202,6 +216,10 @@ OpenLayers.Control.MouseDefaults.prototype =
this.defaultWheelUp(); this.defaultWheelUp();
} }
} }
//only wheel the map, not the window
Event.stop(e);
}
}, },