Comments (5)
Looks like zooming out one level at a time before the animation finishes break it. Zooming in by itself is fine.
from leaflet.markercluster.
No I lie. Happens on zoom ins too, just less obvious.
Put the mouse in the corner of the zoom and do it.
from leaflet.markercluster.
Have fiddled with this all day. It's a pain to fix!
The issue is:
User hits zoom out.
[zoomstart]
[zoomanim]
Map does zoom out animation.
[zoomend]
Clusterer starts moving all markers towards their cluster position, queues up an event to remove them and add the cluster when the animation is done (250ms)
Then the silly user immediately hits zoom out before that timeout has fired, so:
[zoomstart]
[zoomanim]
Map does zoom out animation.
(In the middle of the animation the timeout fires and puts the markers on the map in the wrong place. I think)
[zoom end]
Clusterer does the same as above and fixes everything up.
My attempt to fix it was to remember the timeout when we set it up and if zoomstart fires before the timeout triggers then to call the timeout function then and clear the timeout. This should mean that the points are on the map as they should be, but it doesn't really work as expected as the new clusters get added at the location they should be at after the zoom animation rather than the location before and then .
One other problem is that when the user starts the second zoom out, the markers may be part way through their animation to move to their cluster location, so their location isn't known.
from leaflet.markercluster.
Okay, managed to get it to go!
The secret was to add the new (for the new zoom level) clusters to the map immediately after a zoom, but only make them visible when we want.
This means they are always correctly positioned (as leaflet looks after it for us) so the zoom animations don't break! yay!
from leaflet.markercluster.
Masterful fix David, awesome :)
from leaflet.markercluster.
Related Issues (20)
- Provide function to generate icon HOT 2
- tooltipAnchor option on icons create by iconCreateFunction is ignored
- Prevent spiderfy from closing on position changes HOT 2
- Leverage WebWorker for clustering HOT 1
- Examples don't work leaflet.markercluster-src.js missing in dist folder HOT 1
- Marker disappears from parent layer after setting marker new coordinates
- Uncaught (in promise) TypeError: L.MarkerClusterGroup is not a constructor at L.markerClusterGroup (MarkerClusterGroup.js:1397:9) HOT 1
- Not able to see cluster circle in offline mode
- Why aren't there any new releases published or built since 2021?
- Popup don't open manually if 2 marks have the exact coordinates HOT 2
- setLatLng adds marker back to map when hidden using LayerControl
- New release/tag with dist JavaScript files? HOT 2
- Spiderfy the cluster only on max zoom
- First marker is duplicated HOT 2
- Marker Cluster is overlapping circleMarker() HOT 1
- Cancel cluster expansion event HOT 5
- Hey
- How to use the latest version as a node module? HOT 1
- disable grouping
- Accessibility Issue: Cluster Markers do not allow title / alt to be set
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.markercluster.