From e98000149c5f727467fcbd6b0dc2b257c355fcf1 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sun, 15 Mar 2026 15:39:24 +1100 Subject: [PATCH] Port crop modal snapshot handling from OpenScreen --- src/components/video-editor/SettingsPanel.tsx | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx index dda58035..bc12a142 100644 --- a/src/components/video-editor/SettingsPanel.tsx +++ b/src/components/video-editor/SettingsPanel.tsx @@ -211,7 +211,8 @@ export function SettingsPanel({ const [selectedColor, setSelectedColor] = useState('#ADADAD'); const [gradient, setGradient] = useState(GRADIENTS[0]); - const [showCropDropdown, setShowCropDropdown] = useState(false); + const [showCropModal, setShowCropModal] = useState(false); + const cropSnapshotRef = useRef(null); const zoomEnabled = Boolean(selectedZoomDepth); const trimEnabled = Boolean(selectedTrimId); @@ -228,6 +229,20 @@ export function SettingsPanel({ } }; + const handleCropToggle = () => { + if (!showCropModal && cropRegion) { + cropSnapshotRef.current = { ...cropRegion }; + } + setShowCropModal(!showCropModal); + }; + + const handleCropCancel = () => { + if (cropSnapshotRef.current && onCropChange) { + onCropChange(cropSnapshotRef.current); + } + setShowCropModal(false); + }; + const handleImageUpload = (event: React.ChangeEvent) => { const files = event.target.files; if (!files || files.length === 0) return; @@ -588,7 +603,7 @@ export function SettingsPanel({