mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
Merge pull request [#388](https://github.com/mazeincoding/AppCut/issues/388)
This commit is contained in:
@@ -18,6 +18,8 @@ import {
|
|||||||
Lock,
|
Lock,
|
||||||
LockOpen,
|
LockOpen,
|
||||||
Link,
|
Link,
|
||||||
|
ZoomIn,
|
||||||
|
ZoomOut,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -56,6 +58,7 @@ import {
|
|||||||
TIMELINE_CONSTANTS,
|
TIMELINE_CONSTANTS,
|
||||||
snapTimeToFrame,
|
snapTimeToFrame,
|
||||||
} from "@/constants/timeline-constants";
|
} from "@/constants/timeline-constants";
|
||||||
|
import { Slider } from "@/components/ui/slider";
|
||||||
|
|
||||||
export function Timeline() {
|
export function Timeline() {
|
||||||
// Timeline shows all tracks (video, audio, effects) and their elements.
|
// Timeline shows all tracks (video, audio, effects) and their elements.
|
||||||
@@ -504,7 +507,7 @@ export function Timeline() {
|
|||||||
onMouseEnter={() => setIsInTimeline(true)}
|
onMouseEnter={() => setIsInTimeline(true)}
|
||||||
onMouseLeave={() => setIsInTimeline(false)}
|
onMouseLeave={() => setIsInTimeline(false)}
|
||||||
>
|
>
|
||||||
<TimelineToolbar />
|
<TimelineToolbar zoomLevel={zoomLevel} setZoomLevel={setZoomLevel} />
|
||||||
|
|
||||||
{/* Timeline Container */}
|
{/* Timeline Container */}
|
||||||
<div
|
<div
|
||||||
@@ -778,7 +781,13 @@ function TrackIcon({ track }: { track: TimelineTrack }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function TimelineToolbar() {
|
function TimelineToolbar({
|
||||||
|
zoomLevel,
|
||||||
|
setZoomLevel,
|
||||||
|
}: {
|
||||||
|
zoomLevel: number;
|
||||||
|
setZoomLevel: (zoom: number) => void;
|
||||||
|
}) {
|
||||||
const {
|
const {
|
||||||
tracks,
|
tracks,
|
||||||
addTrack,
|
addTrack,
|
||||||
@@ -797,8 +806,6 @@ function TimelineToolbar() {
|
|||||||
toggleRippleEditing,
|
toggleRippleEditing,
|
||||||
} = useTimelineStore();
|
} = useTimelineStore();
|
||||||
const { currentTime, duration, isPlaying, toggle } = usePlaybackStore();
|
const { currentTime, duration, isPlaying, toggle } = usePlaybackStore();
|
||||||
const { activeProject } = useProjectStore();
|
|
||||||
const { mediaItems, addMediaItem } = useMediaStore();
|
|
||||||
|
|
||||||
// Action handlers
|
// Action handlers
|
||||||
const handleSplitSelected = () => {
|
const handleSplitSelected = () => {
|
||||||
@@ -915,6 +922,19 @@ function TimelineToolbar() {
|
|||||||
});
|
});
|
||||||
clearSelectedElements();
|
clearSelectedElements();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Zoom handlers
|
||||||
|
const handleZoomIn = () => {
|
||||||
|
setZoomLevel(Math.min(4, zoomLevel + 0.25));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleZoomOut = () => {
|
||||||
|
setZoomLevel(Math.max(0.25, zoomLevel - 0.25));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleZoomSliderChange = (values: number[]) => {
|
||||||
|
setZoomLevel(values[0]);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="border-b flex items-center justify-between px-2 py-1">
|
<div className="border-b flex items-center justify-between px-2 py-1">
|
||||||
<div className="flex items-center gap-1 w-full">
|
<div className="flex items-center gap-1 w-full">
|
||||||
@@ -1077,6 +1097,22 @@ function TimelineToolbar() {
|
|||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Button variant="text" size="icon" onClick={handleZoomOut}>
|
||||||
|
<ZoomOut className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
<Slider
|
||||||
|
className="w-24"
|
||||||
|
value={[zoomLevel]}
|
||||||
|
onValueChange={handleZoomSliderChange}
|
||||||
|
min={0.25}
|
||||||
|
max={4}
|
||||||
|
step={0.25}
|
||||||
|
/>
|
||||||
|
<Button variant="text" size="icon" onClick={handleZoomIn}>
|
||||||
|
<ZoomIn className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user