Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random acts of non-expansion when clicking on clusters #144

Closed
JSCSJSCS opened this issue Mar 13, 2013 · 8 comments
Closed

Random acts of non-expansion when clicking on clusters #144

JSCSJSCS opened this issue Mar 13, 2013 · 8 comments

Comments

@JSCSJSCS
Copy link

I need help discovering why some clusters do not expand when clicked. There does not seem to be any logical reason for it that I can find. It is the same on all browsers and yes, I checked my mouse .

I made a screencast of the issue available here: http://www.screenr.com/Pfz7

I do get some warnings (no errors) in the console, but I get them for clusters that work correctly when clicked too.

Timestamp: 3/13/2013 1:49:26 PM
Warning: ReferenceError: reference to undefined property this._animRequest
Source File: http://localhost/migrate/sites/all/libraries/leaflet/dist/leaflet.js?v=0.4
Line: 7

Timestamp: 3/13/2013 1:49:26 PM
Warning: ReferenceError: reference to undefined property this._longPressTimeout
Source File: http://localhost/migrate/sites/all/libraries/leaflet/dist/leaflet.js?v=0.4
Line: 7

etc.

If I press the "+" button to zoom the map, then the clusters expand as expected, even the ones that don't when clicked.

@danzel
Copy link
Member

danzel commented Mar 14, 2013

When you click a cluster it works out the bounds covered by its child markers, then zooms to those bounds.
In your case, the bounds of those markers is so big, that to zoom to those bounds means that we don't zoom down at all.

Try make your map bigger or reduce maxClusterRadius

@JSCSJSCS
Copy link
Author

I am using user input (geocoder looked-up location and a variable distance) to decide what points to display on the map. I will not know how big the map will be or how many points are in the cluster from one map to the next. Shouldn't there be a test (on cluster click) to determine if the bounds of the markers do not require a zoom, but spiderfy anyway because the user clicked to expand the cluster?

@JSCSJSCS
Copy link
Author

I'd like to add that I do not know javascript, so any suggestions to solve my issue that include code would be most appreciated!

@danzel
Copy link
Member

danzel commented Mar 14, 2013

Yeah, we should probably always go down a zoom level or spiderfy when clicking a cluster.

For now you could try decrease maxClusterRadius:

Instead of

var markers = new L.MarkerClusterGroup();

do:

var markers = new L.MarkerClusterGroup({ maxClusterRadius: 50 });

(Default is 80)

@JSCSJSCS
Copy link
Author

Thanks!

I did as you suggested and set the maxClusterRadius to 50. The maps that I had tried previously are working as expected now, but logically, I can see that someone might put in search parameters, or be displaying the map on a mobile phone that changes the map pixel height/width and it will not work for the reasons you mentioned.

I have to say I am very excited that this is basically working right now!~

Being new to GitHub, how will I know when you have implemented the "zoom or spiderfy on cluster click" feature so I don't have to override the default maxClusterRadius?

@danzel
Copy link
Member

danzel commented Mar 14, 2013

I'll leave this bug open for that feature. So If you are getting emails from this one, then you'll get an email when its done :)

@JSCSJSCS
Copy link
Author

Wonderful!

@danzel danzel closed this as completed in 957a69d Dec 17, 2013
@danzel
Copy link
Member

danzel commented Dec 17, 2013

finally implemented this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants