If the pan tween is playing when the map is destroyed, stop the tween. r=pspencer (closes #2156)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9526 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-06-26 01:01:00 +00:00
parent 9d74c087ce
commit 1e35173c2b
2 changed files with 23 additions and 0 deletions

View File

@@ -632,6 +632,11 @@ OpenLayers.Map = OpenLayers.Class({
if (!this.unloadDestroy) {
return false;
}
// make sure panning doesn't continue after destruction
if(this.panTween && this.panTween.playing) {
this.panTween.stop();
}
// map has been destroyed. dont do it again!
OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy);

View File

@@ -1297,6 +1297,24 @@
map.destroy();
}
function test_panTo(t) {
t.plan(2);
var map = new OpenLayers.Map("map");
map.addLayer(
new OpenLayers.Layer(null, {isBaseLayer: true})
);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.panTo(new OpenLayers.LonLat(1, 0));
t.eq(map.panTween.playing, true, "the map pan tween is playing before destroy");
map.destroy();
t.ok(!map.panTween || !map.panTween.playing, "the map pan tween is not playing after destroy");
}
</script>
</head>