Check return values from activate()/deactivate() in subclassed Handlers and Controls, as appropriate. Fixes #599.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2955 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-04-01 21:33:59 +00:00
parent 75b81b2374
commit 07abc57037
4 changed files with 68 additions and 36 deletions

View File

@@ -103,21 +103,29 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
},
activate: function (evt) {
OpenLayers.Handler.prototype.activate.apply(this, arguments);
//register mousewheel events specifically on the window and document
var wheelListener = this.wheelListener;
OpenLayers.Event.observe(window, "DOMMouseScroll", wheelListener);
OpenLayers.Event.observe(window, "mousewheel", wheelListener);
OpenLayers.Event.observe(document, "mousewheel", wheelListener);
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
//register mousewheel events specifically on the window and document
var wheelListener = this.wheelListener;
OpenLayers.Event.observe(window, "DOMMouseScroll", wheelListener);
OpenLayers.Event.observe(window, "mousewheel", wheelListener);
OpenLayers.Event.observe(document, "mousewheel", wheelListener);
return true;
} else {
return false;
}
},
deactivate: function (evt) {
OpenLayers.Handler.prototype.deactivate.apply(this, arguments);
// unregister mousewheel events specifically on the window and document
var wheelListener = this.wheelListener;
OpenLayers.Event.stopObserving(window, "DOMMouseScroll", wheelListener);
OpenLayers.Event.stopObserving(window, "mousewheel", wheelListener);
OpenLayers.Event.stopObserving(document, "mousewheel", wheelListener);
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
// unregister mousewheel events specifically on the window and document
var wheelListener = this.wheelListener;
OpenLayers.Event.stopObserving(window, "DOMMouseScroll", wheelListener);
OpenLayers.Event.stopObserving(window, "mousewheel", wheelListener);
OpenLayers.Event.stopObserving(document, "mousewheel", wheelListener);
return true;
} else {
return false;
}
},
/** @final @type String */