Race conditions with creation and destruction of OverviewMap. r=tschaub (closes #1320)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6010 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2008-02-06 22:49:41 +00:00
parent 8d5d8f6d94
commit ae6588140a

View File

@@ -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) {