feat(core): configure zoom anchors across controllers - #10595
Merged
Conversation
charlieforward9
requested review from
chrisgervang,
felixpalmer and
ibgreen-openai
August 24, 2026 22:56
Greptile SummaryThe PR introduces a shared controller-level zoom-anchor policy while preserving pointer anchoring as the default.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| modules/core/src/controllers/controller.ts | Adds the shared zoom-anchor option and consistently resolves pointer-based zoom interactions through the selected anchor. |
| test/modules/core/controllers/controllers.spec.ts | Covers shared center and pointer behavior, default behavior, asymmetric padding, and live option updates across controller types. |
| docs/api-reference/core/controller.md | Documents the new option, its default, supported interactions, padding behavior, and keyboard exception. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Pointer-based zoom event] --> B{zoomAround}
B -->|pointer| C[Use event position]
B -->|center| D[Project viewport.center to pixels]
C --> E[Apply zoom around anchor]
D --> E
Reviews (5): Last reviewed commit: "Merge branch 'master' into codex/shared-..." | Re-trigger Greptile
charlieforward9
requested review from
Pessimistress
and
a lite review from Copilot
August 26, 2026 01:25
There was a problem hiding this comment.
Pull request overview
Introduces a controller-level zoomAround policy to make zoom anchoring consistent across controller implementations (Map, Orbit, Orthographic, FirstPerson), while correctly handling padded viewports in a view-agnostic way.
Changes:
- Adds
zoomAround: 'pointer' | 'center'toControllerOptions, defaulting to'pointer'. - Applies
zoomAroundanchoring across wheel, pinch (including inertia), double-click, and double-click-drag zoom paths. - Adds controller tests (including padded viewport center behavior) and documents the new public option.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/modules/core/controllers/controllers.spec.ts | Adds coverage ensuring zoomAround affects zoom anchoring consistently across controllers and verifies padded-center anchoring. |
| modules/core/src/controllers/controller.ts | Implements shared zoom anchor resolution (getZoomPosition) and routes zoom interactions through it. |
| docs/api-reference/core/controller.md | Documents the new zoomAround controller option and its behavior across input types. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Pessimistress
approved these changes
Aug 26, 2026
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.
Goal
Make the zoom anchor a controller-level policy so existing controls can use the same option across view types, without view-specific branches in shared controller code.
This is the view-agnostic base requested in the reviews on #10385. The GlobeViewport implementation remains in #10385 on top of this PR.
Changes
zoomAround: 'pointer' | 'center'controller option, withpointerpreserving the existing defaultviewport.centerthrough the active viewport's pixel projection matrix instead of assuming[width / 2, height / 2]Validation
yarn buildyarn lintThe padding regression demonstrates the previous failure directly: with left/right/top/bottom padding of 40/0/10/30, geometric-center zoom moved longitude by about
0.35127°; projecting the viewport's semantic center keeps it fixed.