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

Pinch zoom in Leaflet lead to "TypeError: undefined is not an object (evaluating 'tree.range')" #148

Closed
jabidof opened this issue Jan 31, 2020 · 2 comments · Fixed by #199
Labels

Comments

@jabidof
Copy link

jabidof commented Jan 31, 2020

When pinch-zooming on leaflet I do a clusters recalculation like so:
const clusterizedMarkers = index.getClusters(clustersBounds, zoom);
The zoom has sometimes non integer values coming from Leaflet:
From my console: zoom value – 8.383082795293051
At that moment, index.getClusters crashes the app as the zoom value is not an integer (which makes sense!)

The fix in that case is to change above code to:
const clusterizedMarkers = index.getClusters(clustersBounds, parseInt(zoom));

I'm happy with this fix and I thought it could help other but it would most probably be better to solve this directly in "supercluster" lib...

Enjoy the weekend

@Ej-leone
Copy link

This error still persists

@JClackett
Copy link

Still getting this error

var tree = this.trees[this._limitZoom(zoom)];

tree is undefined

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

Successfully merging a pull request may close this issue.

4 participants