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:
@@ -632,6 +632,11 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
if (!this.unloadDestroy) {
|
if (!this.unloadDestroy) {
|
||||||
return false;
|
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!
|
// map has been destroyed. dont do it again!
|
||||||
OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy);
|
OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy);
|
||||||
|
|||||||
@@ -1297,6 +1297,24 @@
|
|||||||
map.destroy();
|
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user