feat(core): GlobeView pointer-anchored zoom (wheel + transitions)#10385
Open
charlieforward9 wants to merge 8 commits into
Open
feat(core): GlobeView pointer-anchored zoom (wheel + transitions)#10385charlieforward9 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.
c29d36e to
4b98253
Compare
…pout) Per #10307 review: zoomAround is a config option that always needs a value, unlike the transient gesture anchors guarded the same way. The !== undefined guard let a partial-props / HMR reconstruction drop the key, so _shouldZoomAroundPointer() saw undefined and silently reverted to center zoom.
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
GlobeView, keeping the existing center-anchored behavior as the default.Changes
zoomAround?: 'center' | 'pointer'to controller options.GlobeViewport.panByGlobeAnchor— spherical (ray-to-sphere) pointer anchoring, with edge damping near the limb and a grace band so anchors don't snap when the cursor grazes the globe's edge.zoomStartmisses the globe and leaves the anchor empty, pointer mode recovers an anchor from the current event and persists it for the rest of the gesture (fixes a sporadic fallback to center-anchoring).LinearInterpolatortransitions anchored onGlobeViewport, so animated zooms respect the pointer anchor.Tests
controllers.spec,view-states.spec,globe-viewport.spec,linear-interpolator.spec— anchor math, gesture recovery, and transition anchoring.Follow-up