Backbuffer and transitionend only when there are tiles
When an application zooms the map programmatically right after initialization, there will be an empty backbuffer. This should be avoided, because it adds an unnecessary DOM element. The tile.onLoadEnd handler registers a transitionend listener on the image of the last loaded tile. But if loading was aborted, there will be no image. The new logic registers the transitionend event on the last child of the layer div, which is not necessarily the tile we're handling loadend for. When the backbuffer is empty (i.e. no tile was loaded at the time the backbuffer was created), it will be removed immediately.
This commit is contained in:
@@ -1334,7 +1334,9 @@
|
||||
t.ok(layer.backBuffer === map.layerContainerDiv.firstChild,
|
||||
'[a] back buffer is first child of layer container div');
|
||||
|
||||
// Mark one tile loaded, to see if back buffer removal gets scheduled.
|
||||
// Mark one tile loaded and add an element to the backbuffer, to see if
|
||||
// backbuffer removal gets scheduled.
|
||||
layer.backBuffer.appendChild(document.createElement('img'));
|
||||
layer.grid[1][1].onImageLoad();
|
||||
|
||||
t.ok(layer.backBufferTimerId !== null,
|
||||
|
||||
Reference in New Issue
Block a user