Leaflet / Leaflet

🍃 JavaScript library for mobile-friendly interactive maps 🇺🇦
https://leafletjs.com
BSD 2-Clause "Simplified" License
41.49k stars 5.85k forks source link

TileLayer sometimes loads multiple times during zoom animation #8073

Open gagamilano opened 2 years ago

gagamilano commented 2 years ago

Steps to reproduce Steps to reproduce the behavior:

Expected behavior The tile should only be loading once, like it does with no animations

Current behavior The tile is sometimes loading multiple times during the same zoom animation

Environment

Additional context The feature I'm trying to work on relies on the tile's load event to load features onto the map. Every time the tile loads I have to remove the previous ones and load a new set of features. But with the animations turned on and the tiles loading twice in a row I get a lot of flickering. The only way I've found to make sure my features are loaded only once is disabling zoom animations. I found the zoomAnimation workaround browsing other issues. See #7234 , except in my case I didn't need to turn off fade animations as well.

Minimal example reproducing the issue

https://plnkr.co/edit/ENeOvh40r1t3BXkL

Malvoz commented 2 years ago

Related https://github.com/Leaflet/Leaflet/issues/4109.

Falke-Design commented 2 years ago

Some other times it fires twice during the same animation:

Only happens while zooming out