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

Leaflet.markercluster zoomToShowLayer() not working #2

Closed
frodrigo opened this issue Aug 7, 2014 · 4 comments
Closed

Leaflet.markercluster zoomToShowLayer() not working #2

frodrigo opened this issue Aug 7, 2014 · 4 comments

Comments

@frodrigo
Copy link

frodrigo commented Aug 7, 2014

From the project https://github.com/Leaflet/Leaflet.markercluster the function zoomToShowLayer() not respect the active area. In place It use the full map.

@frodrigo
Copy link
Author

frodrigo commented Aug 7, 2014

BTW, I have done a ruby gem of Leaflet-active-area : https://github.com/frodrigo/leaflet-active-area-rails

@mcellier
Copy link
Contributor

mcellier commented Aug 7, 2014

Can you give me a code sample ?

@frodrigo
Copy link
Author

frodrigo commented Aug 8, 2014

https://gist.github.com/frodrigo/2bf7d328bd7f6219b853
Not working when Paris marker is on the screen but outside of active area.

@mcellier
Copy link
Contributor

When you call zoomToShowLayer(), the MarkerCluster plugin uses the getBounds() method to know if the layer is in map.

this._map.getBounds().contains(layer.getLatLng()) 

We didn't override the original getBounds() method, but created this method instead :

getViewportLatLngBounds: function() {
    var bounds = this.getViewportBounds();
    return L.latLngBounds(this.containerPointToLatLng(bounds.min), this.containerPointToLatLng(bounds.max));
}

I don't know yet why we didn't choose to override the original getBounds(), but i'll investigate

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