[OpenLayers-Users] OL 2.12 and Image layer flicker

teknocreator teknocreator at gmail.com
Mon Jul 23 11:12:44 PDT 2012


Just to note, I reviewed the changes in #560 and in #116 and I think there's
some confusion here between flicker for single tile layers from a WMS and
flicker when changing image overlays, i.e. OpenLayers.Layer.Image().  I
think the problems resides in the clear method in this piece of 2.12 code:

clear: function() {
OpenLayers.Tile.prototype.clear.apply(this, arguments);
var img = this.imgDiv;
if (img) {
OpenLayers.Event.stopObservingElement(img);
var tile = this.getTile();
if (tile.parentNode === this.layer.div) {
*this.layer.div.removeChild(tile);*
} 

The statement in bold removes the image overlay completely.  After some
bounds and extent checking, via the renderTile method, it appears that
everything that was with the previous image overlay has to be reinitialized
(initImage is called) before it can be appended back.  This is much
different than in 2.10/2.11 in that eventually, this piece of code was
called:

OpenLayers.Util.modifyDOMElement(this.imgDiv,
null, null, imageSize) ;
this.imgDiv.src = this.url;
} 

So that there's a modification rather than a complete removal and
rebuilding/adding to the layer that contained the image.  Now, there was
still flicker previously but here's what fixed that in 2.10 and 2.11:

Comment out the "this.hide()" statement in the clear method:
clear: function() {
if(this.imgDiv) {
/*this.hide();*/
if (OpenLayers.Tile.Image.useBlankTile) {
this.imgDiv.src = OpenLayers.Util.getImagesLocation() + "blank.gif";
}
}
}, 

So that the image would still be there while some checks about the extent
and positioning could be done before calling the modifyDOMElement statement
above.  As soon as put that fix in, the image seamlessly changed from the
old to the new.

You'll have to excuse my lack of using correct nomenclature when attempting
to explain what I think is going on in 2.12 vs 2.10/2.11.  I think what's
important here is that in 2.12, there appears to be a removal going on
rather than a modification as was the case in 2.10/2.11.

Dave



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/OL-2-12-and-Image-layer-flicker-tp4984910p4990161.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list