Fix scattermap selection across antimeridian#7905
Open
coyaSONG wants to merge 2 commits into
Open
Conversation
Contributor
|
Thanks for the PR! I'll take a look and follow up with you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes #7904.
Scattermap points are now projected into the world copy nearest the current map center before selection hit-testing. This keeps points on both sides of the antimeridian in the same visible coordinate frame while preserving the existing behavior when world copies are disabled.
The regression test reproduces the reported six-point example and verifies that both box and lasso selection:
Root cause and user impact
MapLibre renders repeated world copies, but scattermap selection normalized every point to
[-180, 180]before projecting it. Around the antimeridian, points from one side were therefore projected one full world away from the visible copy and failed the pixel-space selection test. Choosing the longitude copy nearest the map center aligns hit-testing with what the user sees.Validation
npm run pretestnpm run test-jasmine -- select --nowatch(117/117 passing)npm run test-syntaxnpm run lintgit diff --checkThe regression test was also run before the production change and failed with only 3 of 6 points selected for both box and lasso selection.
AI assistance
This contribution was prepared with OpenAI Codex assistance. Codex reviewed the repository guidelines, implementation, test coverage, and final diff; no human review is claimed.