From e4ec1b58b0f39317ef9cac25b7b3b4e599ff2f42 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Fri, 25 Jan 2008 01:35:34 +0000 Subject: [PATCH] Cleanup after the Navigation control (at least slightly more) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5891 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/Navigation.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 */