From 6c166a40e66b7de49a5c5f514fd66c6b56266b1f Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Fri, 30 Mar 2007 21:54:42 +0000 Subject: [PATCH] Destroy and doc fixes to PanZoomBar. Fixes #592. Passes all tests. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2933 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/PanZoomBar.js | 38 +++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index adb78f0553..5c35cb7d47 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -14,21 +14,53 @@ OpenLayers.Control.PanZoomBar.Y = 4; OpenLayers.Control.PanZoomBar.prototype = OpenLayers.Class.inherit( OpenLayers.Control.PanZoom, { - /** @type Array(...) */ - buttons: null, - /** @type int */ zoomStopWidth: 18, /** @type int */ zoomStopHeight: 11, + /** @type DOMElement */ + slider: null, + + /** @type OpenLayers.Events */ + sliderEvents: null, + + /** @type DOMElement */ + zoomBarDiv: null, + + /** @type OpenLayers.Events */ + divEvents: null, + initialize: function() { OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments); this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X, OpenLayers.Control.PanZoomBar.Y); }, + /** + * + */ + destroy: function() { + + this.div.removeChild(this.slider); + this.slider = null; + + this.sliderEvents.destroy(); + this.sliderEvents = null; + + this.div.removeChild(this.zoombarDiv); + this.zoomBarDiv = null; + + this.divEvents.destroy(); + this.divEvents = null; + + this.map.events.unregister("zoomend", this, this.moveZoomBar); + this.map.events.unregister("changebaselayer", this, this.redraw) + + OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments); + }, + /** * @param {OpenLayers.Map} map */