Skip to content

fix: pan the globe from the center when the grab is off the sphere - #8174

Open
mondsichtung wants to merge 1 commit into
maplibre:mainfrom
mondsichtung:globe-pan-off-disc
Open

fix: pan the globe from the center when the grab is off the sphere#8174
mondsichtung wants to merge 1 commit into
maplibre:mainfrom
mondsichtung:globe-pan-off-disc

Conversation

@mondsichtung

@mondsichtung mondsichtung commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Dragging the globe from the empty space around it barely moves the map and often in the wrong direction; releasing then flings it fast the way the cursor actually moved, because the inertia only looks at the pixel offset.

pr8174-side-by-side

JSBin

This regressed in #8154: panning makes the grabbed surface point follow the cursor. To reproduce on its demo, https://jcolot.github.io/maplibre-gl-js/, grab the empty space top right of the globe with the mouse and drag left. Off the sphere there is no such point, so a falloff substitutes one near the globe's edge, and dragging mostly swings that point around the center, a motion panning with a fixed bearing discards; only the small part of the drag aimed at or away from the globe still pans.

Grabs that miss the sphere now pan from the screen center, the same fallback the gesture's zoom already uses in HandlerManager._applyChanges. Off the globe the map now moves a pixel per pixel in the drag direction, matching the inertia; grabs on the globe are unchanged (#5296).

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • If you changed code in a file that has a benchmark file next to it (*.bench.ts), post before/after results of npm run bench (the compare workflow is in test/bench/README.md).
  • Add an entry to CHANGELOG.md under the ## main section.
  • Confirm you have read our AI policy here.

Assisted-By: Claude Code (Opus 5, xhigh)

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.91%. Comparing base (ef90e66) to head (defdd01).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8174      +/-   ##
==========================================
- Coverage   93.92%   93.91%   -0.01%     
==========================================
  Files         290      290              
  Lines       24916    24917       +1     
  Branches     6575     6576       +1     
==========================================
- Hits        23402    23401       -1     
- Misses       1514     1516       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HarelM

HarelM commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Can you share a before and after video maybe? Or an interactive site that has the old and new behavior side by side?
CC: @jcolot

@mondsichtung

Copy link
Copy Markdown
Contributor Author

Attached both a GIF as well as a JSBin URL.

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.

2 participants