From 316c1888d2880145750030d8b6fb8cdd103ecdd5 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 26 Mar 2013 14:48:23 +0100 Subject: [PATCH] Use the last child of the container only if loading was aborted Otherwise we may pick a tile that is already half way through the transition, which will cause the backbuffer to go away too early. --- lib/OpenLayers/Layer/Grid.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 8e9e56e9af..30a55b2ff4 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -1116,7 +1116,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { this.removeBackBuffer(); } else { // wait until transition has ended or delay has passed - this._transitionElement = this.div.lastChild; + this._transitionElement = aborted ? + this.div.lastChild : tile.imgDiv; var transitionendEvents = this.transitionendEvents; for (var i=transitionendEvents.length-1; i>=0; --i) { OpenLayers.Event.observe(this._transitionElement,