This commit is contained in:
ct
2025-07-18 01:15:14 +08:00
parent cde2928694
commit 4775d77063
2 changed files with 15 additions and 3 deletions

View File

@@ -119,6 +119,10 @@ const VideoPreview = ({
elementRefs, elementRefs,
); );
const handleResetClick = () => {
emitter.emit('video-reset');
};
// Enhanced stage click handler that also clears guide lines // Enhanced stage click handler that also clears guide lines
const handleStageClick = (e) => { const handleStageClick = (e) => {
baseHandleStageClick(e); baseHandleStageClick(e);
@@ -281,6 +285,7 @@ const VideoPreview = ({
id="open-text-editor" id="open-text-editor"
className="h-16 w-16 rounded-full shadow-xl" className="h-16 w-16 rounded-full shadow-xl"
onClick={() => { onClick={() => {
handleResetClick();
handleElementSelect(element.id); handleElementSelect(element.id);
onOpenTextSidebar(); onOpenTextSidebar();
}} }}

View File

@@ -3,9 +3,9 @@
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import { useMitt } from '@/plugins/MittContext'; import { useMitt } from '@/plugins/MittContext';
import useVideoEditorStore from '@/stores/VideoEditorStore';
import useMediaStore from '@/stores/MediaStore'; import useMediaStore from '@/stores/MediaStore';
import { Download, Play, Square, SquarePen, RefreshCw } from 'lucide-react'; import useVideoEditorStore from '@/stores/VideoEditorStore';
import { Download, Play, RefreshCw, Square, SquarePen } from 'lucide-react';
const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive = false }) => { const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive = false }) => {
const { videoIsPlaying } = useVideoEditorStore(); const { videoIsPlaying } = useVideoEditorStore();
@@ -16,15 +16,22 @@ const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive =
emitter.emit('video-play'); emitter.emit('video-play');
}; };
const handleOnEditClick = () => {
handleReset();
onEditClick();
};
const handleReset = () => { const handleReset = () => {
emitter.emit('video-reset'); emitter.emit('video-reset');
}; };
const handleDownloadButton = () => { const handleDownloadButton = () => {
handleReset();
emitter.emit('video-open-download-modal'); emitter.emit('video-open-download-modal');
}; };
const handleAIButton = () => { const handleAIButton = () => {
handleReset();
emitter.emit('open-ai-editor-sheet'); emitter.emit('open-ai-editor-sheet');
}; };
@@ -60,7 +67,7 @@ const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive =
variant={isEditActive ? 'outline' : 'outline'} variant={isEditActive ? 'outline' : 'outline'}
size="icon" size="icon"
className="h-12 w-12 rounded-full border shadow-sm" className="h-12 w-12 rounded-full border shadow-sm"
onClick={onEditClick} onClick={handleOnEditClick}
> >
<SquarePen className={`h-8 w-8 ${isEditActive ? 'text-white' : ''}`} /> <SquarePen className={`h-8 w-8 ${isEditActive ? 'text-white' : ''}`} />
</Button> </Button>