Repository navigation
feat(core): support pointer-anchored zoom in GlobeView - #10385
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.
ibgreen-openai
left a comment
There was a problem hiding this comment.
I wonder if this could be split into stacked PR, one that adds general things like zoomStart, zoomEnd and other plumbing, and then the globe specific feature could be a much smaller, easier review on top of that?
chrisgervang
left a comment
There was a problem hiding this comment.
Agree with @ibgreen, since this changes a lot of core functionality I'd prefer to split the PRs up and test each of them in the stack
…ared-zoom # Conflicts: # docs/api-reference/core/globe-controller.md # modules/core/src/controllers/controller.ts # test/modules/core/controllers/controllers.spec.ts
Greptile SummaryThe PR adds spherical pointer-anchored zoom behavior to GlobeView and routes transition anchoring through the generic viewport contract.
Confidence Score: 4/5The PR is not yet safe to merge because GlobeView still changes omitted/default controller configurations from center-anchored to pointer-anchored zoom. Existing GlobeView users that omit Files Needing Attention: modules/core/src/controllers/globe-controller.ts and the Globe controller default configuration
|
| Filename | Overview |
|---|---|
| modules/core/src/controllers/globe-controller.ts | Adds Globe-specific anchor selection and constraint application, but the inherited pointer default leaves the previously reported compatibility issue outstanding. |
| modules/core/src/viewports/globe-viewport.ts | Adds reusable ray geometry, anchor damping, off-globe fallback, and wrapped geographic correction with descriptive naming. |
| modules/core/src/transitions/linear-interpolator.ts | Removes the Globe exclusion and delegates transition anchoring through the viewport’s generic panByPosition contract. |
| test/apps/globe/app.js | Updates the Globe demo to switch between Globe and Map views and between pointer- and center-anchored zoom. |
| test/apps/globe/settings-control.js | Adds the demo’s view, zoom-anchor, reset, and view-state controls. |
| test/modules/core/controllers/controllers.spec.ts | Adds GlobeController coverage to the shared zoom matrix and verifies far off-globe center fallback. |
| test/modules/core/transitions/linear-interpolator.spec.ts | Tests Globe transition anchoring and anchoring across a viewport implementation change. |
| test/modules/core/viewports/globe-viewport.spec.ts | Tests on-globe stability, limb behavior, off-globe fallback, and antimeridian correction. |
Sequence Diagram
sequenceDiagram
participant Input as Pointer input
participant Controller as GlobeController
participant Viewport as GlobeViewport
participant State as GlobeState
Input->>Controller: wheel/pinch/double-click
Controller->>Viewport: getZoomAnchorStrength(screenPosition)
alt usable globe anchor
Controller->>State: zoom around pointer
State->>Viewport: panByPosition(anchor, screenPosition)
Viewport-->>State: corrected longitude/latitude
else far off globe
Controller->>State: zoom around projected center
State-->>Input: scale changes without camera pull
end
Reviews (8): Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." | Re-trigger Greptile
# Conflicts: # test/modules/core/controllers/controllers.spec.ts
This comment was marked as low quality.
This comment was marked as low quality.
…nchor' into codex/pr-10385-shared-zoom
This comment was marked as low quality.
This comment was marked as low quality.
|
Not a bug. The pointer default is the shared controller policy already landed in #10595, not a behavior change introduced by this PR. Evidence:
Suggested re-rank: Please treat the default-policy concern as resolved by #10595 and assess #10385 on the Globe-specific capability it adds on top of that merged contract. |
|
@ibgreen-openai @chrisgervang @felixpalmer @Pessimistress #10595 is now in The current review diff is 8 Globe-specific files. Fresh checks are 5/5 green, focused tests are 99/99, all five review threads are resolved, and the rebuilt exact-head demo is running at http://127.0.0.1:41085/ with the shared Globe/Map and pointer/center controls. This is ready for the Globe-specific review now. |
|
Since this moves GlobeView further out of experimental status - im going to assume this is an improvement and any regressions will be hotfixed instead of waiting for another reviewers feedback. Merging. |
Goal
Add stable pointer-anchored zoom to GlobeView through the same controller and transition contracts used by the other views, without Globe-specific branches in shared controller code.
#10595 has landed in
master, so this PR is the Globe-specific layer on top of the sharedzoomAroundcontroller policy. The review diff remains 8 files and supersedes the fork-based #10307.Changes
GlobeViewport.panByPositionto preserve a geographic anchor during zoom using spherical ray mathGlobeStateconstraints andLinearInterpolatoranchoring through the generic viewport contractpanByPositionintactsettings-control.js, with the same pointer/center control operating in both Globe and Map viewsPole continuity and physical-ball camera rotation remain isolated in follow-up #10598.
Validation
Current pushed head:
c0c0430abbmaster(4f4e89732f) with a normal merge commit; no conflictsgit diff --check upstream/master...HEADyarn lintyarn buildAll seven reported GitHub check contexts pass on the current head: coverage, patch coverage, test-coverage, Python, WebGPU, website, and Greptile.
Stack