From c92527fae58ac543de4e76a962bb82548cdcb880 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 28 Feb 2008 19:47:38 +0000 Subject: [PATCH] Improve calls to movestart/moveend so that they happen at the start/end of moves. This includes fixing pantween to set playing to false after it is done, and fixing the map to store its dragging state again so we can use it to figure out when a move has started. git-svn-id: http://svn.openlayers.org/trunk/openlayers@6398 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Map.js | 6 +++++- lib/OpenLayers/Tween.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index b8ae5d015f..2770726bd4 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -1449,7 +1449,7 @@ OpenLayers.Map = OpenLayers.Class({ // if neither center nor zoom will change, no need to do anything if (zoomChanged || centerChanged || !dragging) { - if (!dragging && !noEvent) { + if (!this.dragging && !noEvent) { this.events.triggerEvent("movestart"); } @@ -1522,6 +1522,10 @@ OpenLayers.Map = OpenLayers.Class({ if (!dragging && !noEvent) { this.events.triggerEvent("moveend"); } + + // Store the map dragging state for later use + this.dragging = !!dragging; + }, /** diff --git a/lib/OpenLayers/Tween.js b/lib/OpenLayers/Tween.js index 1c09703db0..b5e0407be0 100644 --- a/lib/OpenLayers/Tween.js +++ b/lib/OpenLayers/Tween.js @@ -146,6 +146,7 @@ OpenLayers.Tween = OpenLayers.Class({ if (this.time > this.duration) { if (this.callbacks && this.callbacks.done) { this.callbacks.done.call(this, this.finish); + this.playing = false; } window.clearInterval(this.interval); this.interval = null;