diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-01-30 11:31:24 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-01-30 13:05:48 +0100 |
| commit | 0d4b61993cba37c180ac91e40a0fb362711de8de (patch) | |
| tree | f41dd68420b51766c1ca6fc1ee2c20dc5df830d1 /src/components/CameraSelector.tsx | |
Initial implementation
Diffstat (limited to 'src/components/CameraSelector.tsx')
| -rw-r--r-- | src/components/CameraSelector.tsx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/CameraSelector.tsx b/src/components/CameraSelector.tsx new file mode 100644 index 0000000..b3d787f --- /dev/null +++ b/src/components/CameraSelector.tsx @@ -0,0 +1,29 @@ +import React from "react"; +import { useStore, isValidCameraView } from "../store/store.ts"; + +export const CameraSelector: React.FC = () => { + const cameraView = useStore((state) => state.cameraView); + const setCameraView = useStore((state) => state.setCameraView); + + const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => { + const value = event.target.value; + if (isValidCameraView(value)) { + setCameraView(value); + } + }; + + return ( + <div className="camera-selector-wrapper"> + <select + className="camera-selector" + value={cameraView} + onChange={handleChange} + > + <option value="perspective">Perspective</option> + <option value="ortho-top">Top (Ortho)</option> + <option value="ortho-front">Front (Ortho)</option> + <option value="ortho-side">Side (Ortho)</option> + </select> + </div> + ); +}; |