Skip to content

fix(core): let GlobeController zoom past level 12 - #10737

Open
dchaudhari7177 wants to merge 5 commits into
visgl:masterfrom
dchaudhari7177:fix/10736-globe-zoom-past-12
Open

dchaudhari7177 wants to merge 5 commits into
visgl:masterfrom
dchaudhari7177:fix/10736-globe-zoom-past-12

Conversation

@dchaudhari7177

@dchaudhari7177 dchaudhari7177 commented Sep 23, 2026 •

Copy link
Copy Markdown

Closes #10736

Background

Above zoom 12, GlobeView renders with a WebMercatorViewport. That class has no getZoomAnchorStrength, so a pointer-anchored wheel zoom threw in GlobeController.applyConstraints, and the view couldn't zoom in any further. Now only a GlobeViewport is asked for its anchor strength. A WebMercatorViewport's map covers the whole screen, so the anchor holds at full strength there.

Change List

  • GlobeController.applyConstraints: check instanceof GlobeViewport before calling getZoomAnchorStrength
  • Unit tests: a wheel zoom from 12.5 zooms in and keeps the pointer's coordinate (to 4 decimals). Without the fix it fails with viewport.getZoomAnchorStrength is not a function.

Checked locally: controllers.spec.ts (86 tests) passes, tsc --noEmit -p modules/core passes, and prettier is clean. The spec normally runs in the headless project, but I don't have Playwright's Chromium on this machine, so I ran it through the node project from a temporary *.node.spec.ts copy. CI will run it in headless.


Note

Low Risk
Small, targeted change to globe zoom anchor logic with new unit tests; no auth, data, or broad API surface impact.

Overview
Fixes GlobeController pointer-anchored wheel zoom above zoom level 12, where GlobeView switches from GlobeViewport to WebMercatorViewport (#10736).

getZoomPosition no longer assumes a globe viewport or calls getZoomAnchorStrength on every viewport. For a WebMercatorViewport it keeps zooming around the pointer (full-screen map = full anchor strength); globe-only off-globe fallback behavior is unchanged.

Adds controller tests for wheel zoom starting above 12.5 and for a single gesture crossing the zoom-12 handoff, asserting zoom increases and the coordinate under the pointer stays stable.

Reviewed by Cursor Bugbot for commit 9a83120. Bugbot is set up for automated code reviews on this repo. Configure here.

Above zoom 12 GlobeView renders with a WebMercatorViewport, which has no
getZoomAnchorStrength, so a pointer-anchored wheel zoom threw
'viewport.getZoomAnchorStrength is not a function' and the view could not
zoom in any further. Only ask a GlobeViewport for its anchor strength; a
WebMercatorViewport's map covers the screen, so anchor at full strength.

Fixes visgl#10736
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The production fix appears safe to merge; the only remaining concern is non-blocking test precision at the zoom-12 viewport handoff.

Findings

  1. P2 Viewport handoff remains untested ▶

Summary

This PR allows pointer-anchored GlobeController wheel zoom beyond zoom 12, when GlobeView switches to WebMercatorViewport.

  • Calls the globe-specific anchor-strength method only for GlobeViewport instances.
  • Preserves full-strength pointer anchoring for WebMercatorViewport.
  • Adds regression coverage above zoom 12 and across the viewport handoff.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Pointer wheel zoom] --> B{Resolved viewport}
  B -->|GlobeViewport| C[Check globe anchor strength]
  C -->|On globe| D[Zoom around pointer]
  C -->|Off globe| E[Fall back to center]
  B -->|WebMercatorViewport| D
Loading

Reviews (4) · Last reviewed commit: "test(core): cover the GlobeView zoom 12 ..." · Reviewed by Greptile

Comment on lines +633 to +638
initialViewState: {
width: 1280,
height: 720,
longitude: 10,
latitude: 45,
zoom: 12.5,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Viewport handoff remains untested

This test begins at zoom 12.5 and zooms further in, so it uses WebMercatorViewport throughout. It does not cover the zoom-12 handoff, where the viewport changes and anchor strength switches from the globe-specific calculation to 1. A pointer jump during the first wheel event that crosses this boundary could therefore escape the regression suite. Please add a case that starts at or below zoom 12, crosses above it, and verifies that the pointer coordinate remains stable.

Knowledge Base Used: Distribution and quality

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@dchaudhari7177

Copy link
Copy Markdown
Author

Heads-up: #10713, merged on 09-28, reverted #10598. That revert removed the getZoomAnchorStrength call this PR guarded. GlobeState.applyConstraints on master now does viewport.panByPosition(...), and both GlobeViewport and WebMercatorViewport have that method. So the #10736 crash (n.getZoomAnchorStrength is not a function) should no longer reproduce on master, and this branch now conflicts with code that no longer exists.

I see two options:

  1. Close this PR and close [Bug] GlobeView can not zoom in past 12 zoom - n.getZoomAnchorStrength is not a function #10736 as fixed by the revert, or
  2. Rescope it to a regression test only. It would keep the wheel-zoom-above-12 case and add the zoom-12 handoff case Greptile asked for (start at 11.9, cross 12, assert the pointer's lng/lat stay put), so a later re-land of fix(core): rotate GlobeView like a ball through poles #10598 can't bring the crash back.

I'm happy to do either. Let me know which you'd prefer. If I don't hear back, I'll close it in a few days rather than leave a stale conflict.

@chrisgervang

Copy link
Copy Markdown
Collaborator

Hey @dchaudhari7177, thanks for working on this and re-evaluating after we reverted #10598. I'm in favor of adding the regression tests you've described and re-purposing this PR for that.

Please let me know when the tests are up and I'll review.

@chrisgervang chrisgervang self-assigned this Oct 10, 2026
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 10, 2026
Resolve conflicts with the visgl#10713 revert: the getZoomAnchorStrength call now
lives in GlobeController.getZoomPosition, so guard it there.
@coveralls

coveralls commented Oct 11, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 83.718% (+0.02%) from 83.703% — dchaudhari7177:fix/10736-globe-zoom-past-12 into visgl:master

chrisgervang and others added 3 commits October 11, 2026 13:22
Adds the zoom-12 handoff case asked for in visgl#10737 review: a wheel gesture
that starts at zoom 11.9 on a GlobeViewport and lands above 12 on a
WebMercatorViewport keeps the coordinate under the pointer.

This branch has not been deployed

No deployments
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.

[Bug] GlobeView can not zoom in past 12 zoom - n.getZoomAnchorStrength is not a function

3 participants