Properly destroy OpenLayers.Handler.MouseWheel, patch from fredj. Added
tests for it as well. (Closes #935) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4100 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -46,9 +46,8 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
|
|||||||
* Method: destroy
|
* Method: destroy
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
this.deactivate();
|
|
||||||
this.wheelListener = null;
|
|
||||||
OpenLayers.Handler.prototype.destroy.apply(this, arguments);
|
OpenLayers.Handler.prototype.destroy.apply(this, arguments);
|
||||||
|
this.wheelListener = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -117,6 +117,15 @@
|
|||||||
t.ok(deactivated,
|
t.ok(deactivated,
|
||||||
"deactivate returns true if the handler was active already");
|
"deactivate returns true if the handler was active already");
|
||||||
}
|
}
|
||||||
|
function test_handler_MouseWheel_destroy(t) {
|
||||||
|
t.plan(1);
|
||||||
|
var control = new OpenLayers.Control();
|
||||||
|
var handler = new OpenLayers.Handler.MouseWheel(control);
|
||||||
|
handler.deactivate = function() {
|
||||||
|
t.ok(true, "Deactivate called one time.");
|
||||||
|
}
|
||||||
|
handler.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user