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

Spiderfied icons showing on top of clustered icons when zooming out to default zoom level. #268

Closed
Vaesive opened this issue Oct 30, 2013 · 7 comments

Comments

@Vaesive
Copy link

Vaesive commented Oct 30, 2013

Using a custom icon for individual/spiderfied points.
Implemented a DefaultZoom control (clicking on the control resets the location and zoom level to a default setting.

Code of Default Zoom:

var defaultZoomControl = new L.Control.DefaultZoom({onclick: function (e) {
   var northEast = new L.LatLng(${defaultZoom['northEast'][1]}, ${defaultZoom['northEast'][0]});
   var southWest = new L.LatLng(${defaultZoom['southWest'][1]}, ${defaultZoom['southWest'][0]});

   map1_vars['map'].fitBounds(new L.LatLngBounds(southWest, northEast));
}});

Zoom into a location where multiple points are
image

Press DefaultZoom. The spidered icons seem to stack onto each other and on top of the clustered icon.
image

When zooming out with the standard zoom out button, the unspiderfy events get fired. As far as I can tell, the same events are getting fired for the default zoom but the unspiderfy events don't get called.

@Vaesive
Copy link
Author

Vaesive commented Oct 30, 2013

zoomanim doesn't seem to get called when using the default zoom button.

@danzel danzel closed this as completed in cf40d8a Oct 30, 2013
@danzel
Copy link
Member

danzel commented Oct 30, 2013

Thanks for the report, fixed!

@Vaesive
Copy link
Author

Vaesive commented Oct 30, 2013

Thank you for the extremely quick fix! :D

However, this causes another issue.
If you zoom into a spidered point, use default zoom then click the clustered icons to get back to the original zoomed point, the points do not spider out. You have to long-click on the clustered icon to show the individual points again.

@danzel
Copy link
Member

danzel commented Oct 30, 2013

clicking a point should either spider or zoom by default, not both.
So the first click should zoom in, and the second spiderfy (or maybe zoom in more depending on the cluster)

Is this what is happening or something else?

@bmacphee
Copy link

I fixed this by adding one line at the bottom of the L.MarkerCluster._noanimationUnspiderfy function:
group._spiderfied = null;

I don't know if this is the right approach.

I think the second issue mentioned here existed all along and was not caused by the fix, just revealed by it.

Steps to reproduce:

  1. Zoom in and spiderfy a cluster.
  2. Programmatically modify the zoom level such that animation is not performed (perhaps through some other control)
  3. Click again on your cluster to zoom to the bounds again.
  4. Click the cluster to spiderfy it (for me I was already at max zoom when I did this)

Observed: Step 4 does nothing
Expected: Step 4 should cause the cluster to spiderfy

It looks like the code thought it was already spiderfied because _group._spiderfied never got reset in step 2

@danzel
Copy link
Member

danzel commented Oct 30, 2013

Thanks, will take a look at this shortly, what you've done sounds about right.

@danzel danzel reopened this Oct 30, 2013
@danzel danzel closed this as completed in a47562c Oct 31, 2013
@danzel
Copy link
Member

danzel commented Oct 31, 2013

Okay fixed now :)

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

3 participants