diff --git a/lib/OpenLayers/Control/Navigation.js b/lib/OpenLayers/Control/Navigation.js index a43ed3d3cd..8f913766d5 100644 --- a/lib/OpenLayers/Control/Navigation.js +++ b/lib/OpenLayers/Control/Navigation.js @@ -54,6 +54,21 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, { OpenLayers.Control.prototype.initialize.apply(this, arguments); }, + /** + * Method: destroy + * The destroy method is used to perform any clean up before the control + * is dereferenced. Typically this is where event listeners are removed + * to prevent memory leaks. + */ + destroy: function() { + OpenLayers.Control.prototype.destroy.apply(this,arguments); + this.deactivate(); + this.dragPan.destroy(); + this.wheelHandler.destroy(); + this.clickHandler.destroy(); + this.zoomBox.destroy(); + }, + /** * Method: activate */