leaflet-geotiff-2 icon indicating copy to clipboard operation
leaflet-geotiff-2 copied to clipboard

layer jumps position when moving map

Open crawld opened this issue 4 years ago • 3 comments

On firefox and safari, when the map is moved (pan), the layer jumps on the map. You can see this with the demo site:

https://danwild.github.io/leaflet-geotiff-2/

In _reset(), L.DomUtil.setPosition() moves the layer to the wrong place, then setting this._image.src in _drawImage() moves it back.

Seems ok on chrome desktop but not chrome ipad.

crawld avatar Sep 24 '21 19:09 crawld

I think that the problem is the way that these browsers manage the styles update. They are supposedly to update styles when javascript execution is finished, but the styles are updated when the line of code is executed, so it flickers. A double-buffer approach could be used to avoid this, but I think that it would be faster only to create an image with the full ndvi render and plot it with css.

Mforcen avatar Oct 27 '21 08:10 Mforcen

Can this be solved with the current build or is inner-work needed?

hoetmaaiers avatar Dec 08 '21 13:12 hoetmaaiers

AFAIK, changes should be done in the javascript engine, telling them not to process the change during the script execution. If I come up with some workaround, I will post it in here.

P.D.: This could be solved also by rendering the whole image and transforming it using CSS. I have a POC in my fork of this repo, under the direct-render branch.

Mforcen avatar Dec 09 '21 15:12 Mforcen