Tile images should not have an id

When the TileManager adds an image to its cache, it might be a backbuffer
image. Backbuffer images have an id with a '_bb' postfix. Regular images
do not have an id at all. In OpenLayers.Layer.Grid, in
addTileMonitoringHooks, a loadend listener is created for each tile. This
listener checks for tie image id, and will remove it from its parent node.
This will cause images to be removed from the layerDiv if the image comes
from the TileManager's tileCache and was on a backbuffer by the time it was
added to the cache.

Simply removing the image's id before assigning it to a tile resolves the
issue.
This commit is contained in:
ahocevar
2013-02-07 16:44:16 +01:00
parent 661df3593d
commit 7936f0345f

View File

@@ -363,6 +363,8 @@ OpenLayers.TileManager = OpenLayers.Class({
img.style.opacity = 0;
img.style.visibility = 'hidden';
}
// Only backbuffer tiles have an id, so we don't want one here
img.id = null;
tile.setImage(img);
// LRU - move tile to the end of the array to mark it as the most
// recently used