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

Add the isPointOnSurface method #12695

Merged
merged 6 commits into from
May 8, 2023
Merged

Add the isPointOnSurface method #12695

merged 6 commits into from
May 8, 2023

Conversation

stepankuzmin
Copy link
Contributor

@stepankuzmin stepankuzmin commented May 5, 2023

Adds the isPointOnSurface map method to determine if the given point is located on a visible map surface.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • manually test the debug page
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Add the "isPointOnSurface" map method to determine if the given point is located on a visible map surface.</changelog>

@stepankuzmin stepankuzmin marked this pull request as ready for review May 5, 2023 14:00
@stepankuzmin stepankuzmin requested a review from a team as a code owner May 5, 2023 14:00
Comment on lines +1367 to +1368
const coord = this.pointCoordinate(p);
return coord.y >= 0 && coord.y <= 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check works well for the Mercator projection, but I need to figure out how to properly check this for alternate projections.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way currently to use this method properly on globe projection?

src/ui/map.js Outdated Show resolved Hide resolved
Co-authored-by: Volodymyr Agafonkin <[email protected]>
@mourner
Copy link
Member

mourner commented May 5, 2023

Also needs a fix to the unit tests.

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

Successfully merging this pull request may close these issues.

3 participants