Canvas CircleMarker flicker on cluster animation
See original GitHub issueOriginally https://github.com/Leaflet/Leaflet/issues/5011, reported by @stefanhagiu
When:
- There is a markercluster
- Which has its
animated
option is set to true - And has
L.CircleMarker
s instead ofL.Marker
s - And the markers are rendered in a
L.Canvas
then, the CircleMarker
s will flicker during a zoom animation, as the cluster marker is destroyed/created and the individual markers are destroyed/created.
Reproducible test case:
- using leaflet + marker cluster + svg [ works as expected ]: https://codepen.io/anon/pen/YGLbGq?editors=1010
- using leaflet + marker cluster + canvas [ fails to work ]: https://codepen.io/anon/pen/PGZONy?editors=1010
- using leaflet + canvas [ no clustering works as expected]: https://codepen.io/anon/pen/wzjbgP?editors=1010
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
HTML5/Canvas flickering animation - javascript - Stack Overflow
Have no idea how flickering happen or never happen in almost same code, same buffered. I've test it in Chrome 20 and FireFox...
Read more >Leaflet circleMarker's not working - but marker works fine
Using Leaflet, I'm adding around 15,000 circleMarker's to a geoJson layer. The circleMarker's, however, are not showing on my map when the ...
Read more >docker/korp/app/components/leaflet/CHANGELOG.md ... - GitLab
Fixed a regression that broke animation in Leaflet.markercluster. ... on a Canvas-powered CircleMarker would cause an infinite loop (by @snkashis).
Read more >Autodesk Maya Online Help: Adjusting nParticle size and color
Click the far left circle marker (at Selected Position 0) of the ramp. Click the color swatch beside Selected Color. The Color Chooser...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like it is caused by
L.Canvas
flaglayer._removed
https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Canvas.js#L95It is set when layer is removed from canvas, but cleared only on deferred
_draw
. Therefore when adding the layer to the canvas, it catches the flag and removes the layer from canvas just after having adding it…Clearing that flag when calling
_initPath
looks to fix the issue. https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Canvas.js#L87Fixed Plunker: https://plnkr.co/edit/jm1qNpdEpPJPDRdXk9ja?p=preview
Fixed upstream in https://github.com/Leaflet/Leaflet/issues/5011