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

feat: Add a map.corners() utility function #1354

Merged
merged 3 commits into from
Dec 10, 2024
Merged

feat: Add a map.corners() utility function #1354

merged 3 commits into from
Dec 10, 2024

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Dec 10, 2024

This gets the current corners of the map as a list of four points.

This gets the current corners of the map as a list of four points.
If the range tree returns multiple points or markers that might be
within the search area, we were sorting them to maintain a stable
response order.  Javascript sort defaults to a lexical sort which casts
all values to strings, so we had been doing `points.sort((a, b) => a
- b)` to do a numerical sort, but this has a lot of function call
overhead and probably is casting each value between strings and numeric
datatypes.  Instead, we do `points = Uint32Array.from(points).sort();`
which uses native javascript functions and is much faster.
perf: Speed up hit tests for points and markers
@manthey manthey merged commit d7faab3 into master Dec 10, 2024
12 checks passed
@manthey manthey deleted the map-corners branch December 10, 2024 21:24
Copy link

🎉 This PR is included in version 1.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 this pull request may close these issues.

1 participant