Skip to content

feat(core): support pointer-anchored zoom in GlobeView - #10385

Merged
charlieforward9 merged 22 commits into
masterfrom
codex/globe-anchored-zoom
Aug 31, 2026
Merged

charlieforward9 merged 22 commits into
masterfrom
codex/globe-anchored-zoom

Conversation

@charlieforward9

@charlieforward9 charlieforward9 commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

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 shared zoomAround controller policy. The review diff remains 8 files and supersedes the fork-based #10307.

Changes

  • teaches GlobeViewport.panByPosition to preserve a geographic anchor during zoom using spherical ray math
  • damps correction near the globe limb and falls back to center behavior for far off-globe pointers
  • resolves off-globe anchors before they enter the shared wheel, pinch, double-click, or double-click-drag paths, so zoom still changes scale without pulling the camera toward a phantom point
  • follows the shortest wrapped longitude delta across the antimeridian
  • routes GlobeState constraints and LinearInterpolator anchoring through the generic viewport contract
  • keeps the existing globe drag form of panByPosition intact
  • splits the demo UI into settings-control.js, with the same pointer/center control operating in both Globe and Map views
  • removes the old localStorage path and updates the point radius accessor

Pole continuity and physical-ball camera rotation remain isolated in follow-up #10598.

Validation

Current pushed head: c0c0430abb

  • merged current master (4f4e89732f) with a normal merge commit; no conflicts
  • git diff --check upstream/master...HEAD
  • yarn lint
  • yarn build
  • focused Vitest, headless project: 92/92
  • focused Vitest, browser project: 92/92
  • all five existing review threads are resolved

All seven reported GitHub check contexts pass on the current head: coverage, patch coverage, test-coverage, Python, WebGPU, website, and Greptile.

Stack

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.
@charlieforward9
charlieforward9 force-pushed the codex/globe-anchored-zoom branch from c29d36e to 4b98253 Compare June 16, 2026 17:36
…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.
@coveralls

coveralls commented Jun 16, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.255% (+0.01%) from 82.241% — codex/globe-anchored-zoom into master

@charlieforward9 charlieforward9 mentioned this pull request Jun 23, 2026
14 of 35 tasks
@chrisgervang chrisgervang added this to the v9.4 milestone Jun 28, 2026

@ibgreen-openai ibgreen-openai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread test/apps/globe/app.js Resolved

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread test/apps/globe/app.js Resolved
Comment thread docs/api-reference/core/controller.md Resolved
…ared-zoom

# Conflicts:
#	docs/api-reference/core/globe-controller.md
#	modules/core/src/controllers/controller.ts
#	test/modules/core/controllers/controllers.spec.ts
@greptile-apps

greptile-apps Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR adds spherical pointer-anchored zoom behavior to GlobeView and routes transition anchoring through the generic viewport contract.

  • Adds ray-to-globe calculations, limb damping, off-globe fallback, and wrapped-longitude correction.
  • Applies constrained zoom anchors through GlobeState and LinearInterpolator.
  • Extends controller, transition, and viewport tests and updates the Globe demo controls.

Confidence Score: 4/5

The 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 zoomAround inherit the shared pointer default, and the GlobeController override preserves pointer anchoring for on-globe positions, so wheel, pinch, and double-click zoom can unexpectedly alter longitude and latitude.

Files Needing Attention: modules/core/src/controllers/globe-controller.ts and the Globe controller default configuration

Important Files Changed

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
Loading

Reviews (8): Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." | Re-trigger Greptile

# Conflicts:
#	test/modules/core/controllers/controllers.spec.ts
@charlieforward9 charlieforward9 changed the title feat(core): GlobeView pointer-anchored zoom (wheel + transitions) feat(core): support pointer-anchored zoom in GlobeView Aug 24, 2026
@charlieforward9
charlieforward9 changed the base branch from master to codex/shared-controller-zoom-anchor August 24, 2026 22:55
@charlieforward9

This comment was marked as low quality.

@charlieforward9

This comment was marked as low quality.

Base automatically changed from codex/shared-controller-zoom-anchor to master August 30, 2026 03:21
@charlieforward9

Copy link
Copy Markdown
Member Author

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.

@charlieforward9

Copy link
Copy Markdown
Member Author

@ibgreen-openai @chrisgervang @felixpalmer @Pessimistress #10595 is now in master. I merged current master into this branch with a normal merge commit and resolved the one test-matrix conflict by taking the shared cases from master while keeping the two Globe-specific cases.

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.

@charlieforward9

Copy link
Copy Markdown
Member Author

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.

@charlieforward9
charlieforward9 merged commit 8126bb9 into master Aug 31, 2026
7 checks passed
@charlieforward9
charlieforward9 deleted the codex/globe-anchored-zoom branch August 31, 2026 01:47
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.

6 participants