This commit is contained in:
ct
2025-06-15 08:33:39 +08:00
parent 361f630293
commit 6431bdafc1
3 changed files with 101 additions and 141 deletions

View File

@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
import { useMitt } from '@/plugins/MittContext';
import useVideoEditorStore from '@/stores/VideoEditorStore';
import { Download, Edit3, Pause, Play, Type } from 'lucide-react';
import { Download, Edit3, Play, Square, Type } from 'lucide-react';
const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive = false }) => {
const { videoIsPlaying } = useVideoEditorStore();
@@ -14,13 +14,13 @@ const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive =
emitter.emit('video-play');
};
const handlePause = () => {
emitter.emit('video-pause');
const handleReset = () => {
emitter.emit('video-reset');
};
const togglePlayPause = () => {
if (videoIsPlaying) {
handlePause();
handleReset();
} else {
handlePlay();
}
@@ -29,7 +29,7 @@ const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive =
return (
<div className={cn('flex items-center justify-center gap-2', className)}>
<Button onClick={togglePlayPause} variant="ghost" size="icon" className="h-12 w-12 rounded-full border shadow-sm">
{videoIsPlaying ? <Pause className="h-8 w-8" /> : <Play className="h-8 w-8" />}
{videoIsPlaying ? <Square className="h-8 w-8" /> : <Play className="h-8 w-8" />}
</Button>
{/* <Button