Skip to content

Fix scattermap selection across antimeridian#7905

Draft
coyaSONG wants to merge 2 commits into
plotly:masterfrom
coyaSONG:fix/7904-antimeridian-selection
Draft

Fix scattermap selection across antimeridian#7905
coyaSONG wants to merge 2 commits into
plotly:masterfrom
coyaSONG:fix/7904-antimeridian-selection

Conversation

@coyaSONG

Copy link
Copy Markdown

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:

  • select all six visible points;
  • report a continuous box longitude range; and
  • report a continuous lasso path across 180 degrees.

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 pretest
  • npm run test-jasmine -- select --nowatch (117/117 passing)
  • npm run test-syntax
  • npm run lint
  • git diff --check

The 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. I reviewed the repository guidelines, implementation, test coverage, and final diff.

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

Successfully merging this pull request may close these issues.

[BUG]: Select tools don't select all points within area when selection crosses the antimeridian

1 participant