Skip to content

Add camera zoom controls (Stage 7D)#2

Open
JMRussas wants to merge 5 commits intomainfrom
feature/camera-zoom-controls
Open

Add camera zoom controls (Stage 7D)#2
JMRussas wants to merge 5 commits intomainfrom
feature/camera-zoom-controls

Conversation

@JMRussas
Copy link
Owner

@JMRussas JMRussas commented Feb 28, 2026

Summary

  • Add zoom in/out via +/- UI buttons, scroll wheel, and keyboard shortcuts (+/=/-)
  • Smooth exponential lerp with epsilon gating to avoid unnecessary per-frame projection matrix rebuilds
  • Zoom state in dedicated cameraStore (separated from playerStore to avoid unrelated re-renders), persisted to localStorage

Review Findings

Self-review found 7 issues (3M, 4L) — all resolved in this PR:

# Sev Fix
1 M updateProjectionMatrix() gated on epsilon check — no longer called 60x/sec at rest
2 M Zoom state extracted from playerStore into dedicated cameraStore
3 M Added 8 unit tests for cameraStore (zoomIn, zoomOut, setTargetZoom, clamping)
4 L Scroll wheel handler checks e.ctrlKey to pass through trackpad pinch-to-zoom
5 L Keyboard handler checks isContentEditable in addition to form elements
6 L ZoomControls moved from ui/ to ui/camera/ to match existing subdirectory convention
7 L CAMERA_ZOOM JSDoc updated from "Camera orthographic zoom level" to "Default camera zoom level"

Test plan

  • pnpm test — 411 tests passing (8 new cameraStore tests)
  • tsc --noEmit — no type errors
  • Manual: zoom in/out with +/- buttons, scroll wheel, +/= and - keys
  • Manual: verify zoom persists across page reload (localStorage)
  • Manual: verify zoom persists across room switches

Generated by Claude Code · Claude Opus 4.6

JMRussas and others added 5 commits February 27, 2026 19:07
Zoom in/out via +/- UI buttons, scroll wheel, and keyboard shortcuts.
Smooth lerp interpolation, clamped to configurable min/max bounds,
zoom level persisted to localStorage across sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Zoom in/out via +/- UI buttons, scroll wheel, and keyboard shortcuts.
Smooth lerp interpolation with epsilon gating to avoid per-frame
projection matrix rebuilds at rest. Zoom state in dedicated cameraStore
(separated from playerStore), persisted to localStorage. Trackpad
pinch-to-zoom passthrough (ctrlKey check), contentEditable-aware
keyboard handler, ZoomControls moved to ui/camera/ for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Surface staged review process, bug fix trails, and test
coverage for visitors who won't click into PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Protect implementation code while keeping it publicly viewable.
Anyone who distributes or runs this as a service must open-source
their derivative work under AGPL v3 or negotiate a commercial license.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant