Interactive camera-framing sandbox for exploring profile-view geometry, field of view, tilt, and subject framing constraints.
The app includes:
- Profile view with draggable camera, line-of-sight handle, and subject top handle
- Camera preview panel with in-frame/out-of-frame status
- Minimum-distance solver with multi-step formula derivation (KaTeX)
- Persistent settings via URL and local storage
- React + TypeScript + Vite
- Material UI
- Vitest + Testing Library
- ESLint
- KaTeX
Run from project root:
npm install
npm run dev
npm run test
npm run lint
npm run build
npm run clean
npm run pristine-
npm run cleanRemoves build/test artifacts and local tool caches (dist,coverage,.vitest,node_modules/.vite,node_modules/.tmp). -
npm run pristinePerforms a clone-like reset: runscleanand deletesnode_moduleswithout reinstalling dependencies.
Before tagging a release:
- Run
npm run clean. - Run
npm test. - Run
npm run build. - Bump the version in
package.json. - Commit changes and create a version tag (for example:
v0.0.1).
-
src/App.tsxThin entry component. Delegates orchestration to controller hook and renders the page shell. -
src/components/SandboxPage.tsxHigh-level page layout (header, profile scene region, preview/solver region, controls region).
-
src/components/ProfileScene.tsxSVG-based profile view renderer and pointer event surface. -
src/components/CameraPreview.tsxPreview window status panel. -
src/components/MinimumDistancePanel.tsxFormula rendering, derivation steps, and solve result state UI. -
src/components/ControlsPanel.tsxSlider/input controls and reset actions.
-
src/hooks/useSandboxController.tsAggregates all app-level orchestration and returns props for page composition. -
src/hooks/useSolveDistance.tsSolve state machine and minimum-distance solve flow. -
src/hooks/useSceneInteractions.tsDrag/pointer interaction logic for scene manipulators. -
src/hooks/useControlsPanel.tsControls metadata, mark generation, and input/slider handlers. -
src/hooks/useScenePanelProps.tsBuilds grouped props for scene and right-side panels.
-
src/math/sceneMath.tsCore geometry and solver math helpers. -
src/math/sceneLayout.tsDerived scene layout model from current settings. -
src/math/solvePresentation.tsFormula/derivation presentation formatting. -
src/sceneSettings.tsSource of truth for control ranges, defaults, snapping, normalization, and persistence serialization.
Current tests cover:
- UI integration behavior in
src/App.test.tsx - Math helper behavior in
src/math/sceneMath.test.ts - Solve presentation formatting in
src/math/solvePresentation.test.ts - Hook behavior in:
src/hooks/useSolveDistance.test.tssrc/hooks/useControlsPanel.test.ts
- Build currently reports a chunk-size warning from Vite reporter. This is informational and does not fail the build.
- If desired, next optimization can focus on route/component-level code splitting.
MIT. See the LICENSE file for details.