Skip to content

feat(core): configure zoom anchors across controllers - #10595

Merged
charlieforward9 merged 5 commits into
masterfrom
codex/shared-controller-zoom-anchor
Aug 30, 2026
Merged

feat(core): configure zoom anchors across controllers#10595
charlieforward9 merged 5 commits into
masterfrom
codex/shared-controller-zoom-anchor

Conversation

@charlieforward9

@charlieforward9 charlieforward9 commented Aug 24, 2026

Copy link
Copy Markdown
Member

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

  • adds the shared zoomAround: 'pointer' | 'center' controller option, with pointer preserving the existing default
  • applies the policy uniformly to wheel, pinch, pinch inertia, double-click, and double-click-drag zoom
  • keeps keyboard zoom center-based because it has no pointer position
  • resolves the asymmetric-padding review feedback by projecting viewport.center through the active viewport's pixel projection matrix instead of assuming [width / 2, height / 2]
  • keeps the implementation view-agnostic across Map, Orbit, Orthographic, and FirstPerson controllers, including live option updates
  • documents the public option

Validation

  • focused controller Vitest: 75/75, including asymmetric viewport padding
  • yarn build
  • yarn lint
  • pre-commit checks: 15/15
  • GitHub CI green: coverage, WebGPU, website, Python, Greptile, and Coveralls
  • no unresolved review threads

The 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.

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown

Greptile Summary

The PR introduces a shared controller-level zoom-anchor policy while preserving pointer anchoring as the default.

  • Adds the public zoomAround: 'pointer' | 'center' controller option.
  • Applies the selected anchor to wheel, pinch, pinch inertia, double-click, and double-click-drag interactions.
  • Projects the viewport’s semantic center to account for asymmetric padding.
  • Adds coverage across Map, Orbit, Orthographic, and FirstPerson controllers, including live option updates.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

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
Loading

Reviews (5): Last reviewed commit: "Merge branch 'master' into codex/shared-..." | Re-trigger Greptile

Comment thread modules/core/src/controllers/controller.ts Outdated
@coveralls

coveralls commented Aug 24, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 82.23% (-0.006%) from 82.236% — codex/shared-controller-zoom-anchor into master

Comment thread modules/core/src/controllers/controller.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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' to ControllerOptions, defaulting to 'pointer'.
  • Applies zoomAround anchoring 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.

@charlieforward9
charlieforward9 merged commit a91c56d into master Aug 30, 2026
7 checks passed
@charlieforward9
charlieforward9 deleted the codex/shared-controller-zoom-anchor branch August 30, 2026 03:21
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.

4 participants