Merge pull request #920 from ahocevar/backbuffer-conditional
Backbuffer and transitionend only when there are tiles. r=@bartvde
This commit is contained in:
@@ -1111,18 +1111,26 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
}
|
||||
//if that was the last tile, then trigger a 'loadend' on the layer
|
||||
if (this.numLoadingTiles === 0) {
|
||||
if(this.backBuffer) {
|
||||
this._transitionElement = tile.imgDiv;
|
||||
for (var i=this.transitionendEvents.length-1; i>=0; --i) {
|
||||
OpenLayers.Event.observe(this._transitionElement,
|
||||
this.transitionendEvents[i],
|
||||
this._removeBackBuffer);
|
||||
if (this.backBuffer) {
|
||||
if (this.backBuffer.childNodes.length === 0) {
|
||||
// no tiles transitioning, remove immediately
|
||||
this.removeBackBuffer();
|
||||
} else {
|
||||
// wait until transition has ended or delay has passed
|
||||
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,
|
||||
transitionendEvents[i],
|
||||
this._removeBackBuffer);
|
||||
}
|
||||
// the removal of the back buffer is delayed to prevent
|
||||
// flash effects due to the animation of tile displaying
|
||||
this.backBufferTimerId = window.setTimeout(
|
||||
this._removeBackBuffer, this.removeBackBufferDelay
|
||||
);
|
||||
}
|
||||
// the removal of the back buffer is delayed to prevent
|
||||
// flash effects due to the animation of tile displaying
|
||||
this.backBufferTimerId = window.setTimeout(
|
||||
this._removeBackBuffer, this.removeBackBufferDelay
|
||||
);
|
||||
}
|
||||
this.loading = false;
|
||||
this.events.triggerEvent("loadend");
|
||||
|
||||
Reference in New Issue
Block a user