@@ -5,7 +5,10 @@ import { Check, Crop, Loader2, Maximize2, Monitor, X } from 'lucide-react'
55import { useCallback , useEffect , useRef , useState } from 'react'
66import { useIsMobile } from '../../hooks/use-mobile'
77import { triggerSFX } from '../../lib/sfx-bus'
8- import useEditor , { type SnapshotCropMode } from '../../store/use-editor'
8+ import useEditor , {
9+ type SnapshotCropMode ,
10+ type SnapshotStandardAspect ,
11+ } from '../../store/use-editor'
912
1013// Local alias — distinct from `useEditor.captureMode` (which describes *why*
1114// a capture is happening, e.g. `preset`). This one says HOW the captured
@@ -25,14 +28,14 @@ interface Drag {
2528}
2629
2730// Output presets for `standard` captures — long edge stays near 1920.
28- const STANDARD_SIZES = {
31+ const STANDARD_SIZES : Record < SnapshotStandardAspect , { w : number ; h : number } > = {
2932 '16:9' : { w : 1920 , h : 1080 } ,
3033 '9:16' : { w : 1080 , h : 1920 } ,
3134 '4:3' : { w : 1920 , h : 1440 } ,
3235 '3:4' : { w : 1440 , h : 1920 } ,
3336 '1:1' : { w : 1440 , h : 1440 } ,
34- } as const
35- type StandardAspect = keyof typeof STANDARD_SIZES
37+ }
38+ type StandardAspect = SnapshotStandardAspect
3639
3740function getResolution (
3841 mode : CropMode ,
@@ -105,6 +108,7 @@ export function SnapshotCaptureOverlay({ projectId }: { projectId: string }) {
105108 // crop shape. Matches the unified preset-thumbnail capture flow.
106109 const isPreset = captureMode . mode === 'preset'
107110 const requestedCrop = captureMode . mode === 'standard' ? captureMode . crop : undefined
111+ const requestedAspect = captureMode . mode === 'standard' ? captureMode . standardAspect : undefined
108112
109113 const [ mode , setMode ] = useState < CropMode > ( 'standard' )
110114 const [ standardAspect , setStandardAspect ] = useState < StandardAspect > ( '16:9' )
@@ -145,6 +149,7 @@ export function SnapshotCaptureOverlay({ projectId }: { projectId: string }) {
145149 useEffect ( ( ) => {
146150 if ( ! isCaptureMode ) return
147151 setMode ( isPreset ? 'area' : ( requestedCrop ?? 'standard' ) )
152+ setStandardAspect ( requestedAspect ?? '16:9' )
148153 setAspectMenuOpen ( false )
149154 setIsDragging ( false )
150155 setCaptureState ( 'idle' )
@@ -160,7 +165,7 @@ export function SnapshotCaptureOverlay({ projectId }: { projectId: string }) {
160165 } else {
161166 setDrag ( null )
162167 }
163- } , [ isCaptureMode , isPreset , requestedCrop ] )
168+ } , [ isCaptureMode , isPreset , requestedCrop , requestedAspect ] )
164169
165170 // Listen for snapshot saved to show feedback then exit
166171 useEffect ( ( ) => {
0 commit comments