mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 05:42:32 +00:00
The 446-line FreeCam class is gone. Its responsibilities split: - Math (move/rotate vectors, pan/zoom from inputs, lookAt) lives in cameraMath.ts as pure functions, plus a freeCamFrameTick() that integrates the per-frame state. - Listener attachment + drag/key state ownership moves into hooks/useFreeCam.ts. Listeners are scoped to the canvas (no window/document handlers); held-key state is reset on CAMERA_VIEW exit so a stale W keypress can't drift the camera. - The shared FreeCamControlState struct flows through Editor via editor.setFreeCamState(state); the render loop reads it and calls freeCamFrameTick() each frame. Side effects: keybinds_controls.ts now imports isPointerLockSupported from browserChecks; helper.ts and PageEditor's camera-select handler stop poking .cameraViewControls and reset velocity via freeCamState instead. PreviewEngineCamera's camera-view toggle now just flips the store state — useFreeCam picks it up on its own (no more enableFreeCamControls/disableFreeCamControls call site).