feat(core): GlobeView pointer-anchored zoom (wheel + transitions)#10307
Open
charlieforward9 wants to merge 8 commits into
Open
feat(core): GlobeView pointer-anchored zoom (wheel + transitions)#10307charlieforward9 wants to merge 8 commits into
charlieforward9 wants to merge 8 commits into
Conversation
Replace the `log.warn('around not supported in GlobeView')` no-op
with real spherical anchoring, mirroring the existing planar branch:
- `initializeProps`: when the start viewport is a GlobeViewport and the
screen anchor falls on the globe (`isPointOnGlobe`), unproject it to
lng/lat and stash it as `aroundLngLat`.
- `interpolateProps`: each frame, call `panByGlobeAnchor(aroundLngLat,
lerp(start.around, end.around, t))` so the geographic point stays
pinned under the anchor screen point during the transition.
This makes the `_onDoubleClick` zoom transition (`_getTransitionProps
({around: pos})`) actually anchor on GlobeView. Previously the warn
fired and the LERP ran without anchor maintenance, which read as a
center-anchored zoom-in regardless of where the user tapped.
Tests cover the on-globe anchored path and the off-globe fall-through.
- Consolidate stray imports at the top of the file. - Document the two GLOBE_ZOOM_ANCHOR_* constants so the empirical damping behavior (start damping at 0.75 of the limb, never below 35% strength) is self-explanatory. - Add a JSDoc to _getRayToGlobe explaining it as the shared ray/sphere math helper for unproject + isPointOnGlobe + panByGlobeAnchor.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Reviewed by Cursor Bugbot for commit 4ad99ed. Configure here.
charlieforward9
commented
Jun 11, 2026
| * `rotateSpeedX` (number) - speed of rotation using shift + left/right arrow keys, in degrees. Default `15`. | ||
| * `rotateSpeedY` (number) - speed of rotation using shift + up/down arrow keys, in degrees. Default `10`. | ||
| * `dragMode` (string) - drag behavior without pressing function keys, one of `pan` and `rotate`. | ||
| * `zoomAround` (`'center' | 'pointer'`) - zoom anchor mode when supported by the controller. Default depends on the controller. |
Collaborator
Author
There was a problem hiding this comment.
I believe zoomAround: pointer is default behavior for most controllers - not sure if this is necessary.
53 tasks
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.

Summary
Adds opt-in pointer-anchored zoom for
GlobeViewwhile preserving the existing center-anchored default.Screen.Recording.2026-06-06.at.3.53.35.PM.mov
Changes
zoomAround?: 'center' | 'pointer'to controller options.GlobeViewport.panByGlobeAnchorfor spherical pointer anchoring during wheel, pinch, and double-click zoom.GlobeViewport.isPointOnGlobeandpanByGlobeAnchor.LinearInterpolatortransitions onGlobeViewportwithout changing the requested final view state.deck.setProps({controller: {zoomAround}}), ahead of persisted controller state.startZoom: nullas cleared state.Center/Pointerzoom-anchor toggle.Validation
yarn vitest run --project headless test/modules/core/viewports/globe-viewport.spec.ts test/modules/core/transitions/linear-interpolator.spec.ts test/modules/core/controllers/controllers.spec.tsmodules/core/src/controllers/globe-controller.tsMerge Notes
Default remains
zoomAround: 'center', so existing GlobeView behavior is unchanged unless users opt in.Note
Medium Risk
Touches core globe viewport, controller zoom, and transition interpolation; behavior is opt-in with center as default, but pointer anchoring affects camera math at the limb and after constrained pans.
Overview
Adds opt-in pointer-anchored zoom for
GlobeViewvia a new controller optionzoomAround: 'center' | 'pointer'(default remains center).When set to
'pointer', wheel, pinch, and double-click zoom keep the lng/lat under the cursor fixed using newGlobeViewporthelpers (isPointOnGlobe,panByGlobeAnchor) with shared ray–sphere math, near-limb damping, and a grace band so anchors slightly off the rendered sphere still work. Off-globe pointers fall back to center zoom.GlobeStategainszoomStart/zoomEndand pointer-awarezoom;LinearInterpolatornow anchors globe transitions the same way instead of warning thataroundis unsupported. Controller state construction merges props after state so runtimedeck.setProps({ controller: { zoomAround } })wins over persisted state.The pure-js globe starter demo adds a persisted Center/Pointer toggle; API docs describe the option.
Reviewed by Cursor Bugbot for commit 4ad99ed. Bugbot is set up for automated code reviews on this repo. Configure here.