[OpenLayers-Users] OL 2.12 and Image layer flicker

teknocreator teknocreator at gmail.com
Wed Dec 12 11:47:24 PST 2012


Revisiting this as we'd like to use other features in OL 2.12.  I was going
to write a ticket on the problem but didn't want to duplicate one.  In my
search I found issue #792 written by antialize, which looked very similar in
which a lot of flicker was introduced when using mergeNewParams.  antialize
suggested adding his/her code changes which created a tile replace method. 
This which would delay the redraw of an Image tile until the new image has
been reloaded, where the DOM would then replace the node of the old image.

After I reviewed antialize's code, it appeared to be exactly what was needed
for our Image layer flicker issue as well.  So I incorporated the changes
listed in #792 and made one small change in the Layer Image.js file:

    setUrl: function(newUrl) {
        this.url = newUrl;
        //this.tile.draw();
        this.tile.replace();
    },

This would call antialize's new Tile replace method instead of the present
draw method.  Tested the changes with our application and they worked well
for the Image layer as well as a Mapserver layer which was returning image
tiles.  The application essentially steps through time via the mouse
hovering over different areas of the page.  With each time step, the url of
the Image layer is changed as well as returning new image tiles from
MapServer.  Calling antialize's replace method created a nice animation
effect which is what we need in our application.  Seemed to work well in
Firefox 16, Chrome 23, and IE8 on a Windows 7 platform. 

More testing may be needed on antialize's code, but I'm looking to
incorporate them in our application so we can move forward and use OL 2.12's
other features.  Even if it's not completely correct, think a replace
function for images is what's needed here to remove the flicker vs a
remove/reinitialize, which is essentially what OL 2.12's current draw method
does when it then calls the tile clear method.  As I noted earlier, I can
see in Firebug is the cause of the flicker.

Dave M



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


More information about the Users mailing list