diff --git a/lib/OpenLayers/Control/OverviewMap.js b/lib/OpenLayers/Control/OverviewMap.js index 3a2a58dc27..9755b4082a 100644 --- a/lib/OpenLayers/Control/OverviewMap.js +++ b/lib/OpenLayers/Control/OverviewMap.js @@ -199,8 +199,6 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { this.div.appendChild(this.element); - this.map.events.register('moveend', this, this.update); - // Optionally add min/max buttons if the control will go in the // map viewport. if(!this.outsideViewport) { @@ -259,6 +257,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { if(this.map.getExtent()) { this.update(); } + + this.map.events.register('moveend', this, this.update); + return this.div; }, @@ -435,6 +436,11 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { var options = OpenLayers.Util.extend( {controls: [], maxResolution: 'auto'}, this.mapOptions); this.ovmap = new OpenLayers.Map(this.mapDiv, options); + + // prevent ovmap from being destroyed when the page unloads, because + // the OverviewMap control has to do this (and does it). + OpenLayers.Event.stopObserving(window, 'unload', this.ovmap.unloadDestroy); + this.ovmap.addLayers(this.layers); this.ovmap.zoomToMaxExtent(); // check extent rectangle border width @@ -469,11 +475,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, { null, true); this.rectEvents.register("mouseover", this, function(e) { if(!this.dragHandler.active && !this.map.dragging) { - // this click handler de/activation can be removed when - // ticket #1247 is addressed - this.clickHandler.deactivate(); this.dragHandler.activate(); - this.clickHandler.activate(); } }); this.rectEvents.register("mouseout", this, function(e) {