mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
feat: add an input so the user can go to a specific timestamp (#530)
* feat: add an input so the user can go to a specific timestamp * fix: use TimeCode type for EditableTimecodeProps * cleanup --------- Co-authored-by: Maze Winther <mazewinther@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { useEffect } from "react";
|
||||
import { useActionHandler } from "@/constants/actions";
|
||||
import { useTimelineStore } from "@/stores/timeline-store";
|
||||
import { usePlaybackStore } from "@/stores/playback-store";
|
||||
import { useProjectStore } from "@/stores/project-store";
|
||||
import { DEFAULT_FPS, useProjectStore } from "@/stores/project-store";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export function useEditorActions() {
|
||||
@@ -66,7 +66,7 @@ export function useEditorActions() {
|
||||
useActionHandler(
|
||||
"frame-step-forward",
|
||||
() => {
|
||||
const projectFps = activeProject?.fps || 30;
|
||||
const projectFps = activeProject?.fps || DEFAULT_FPS;
|
||||
seek(Math.min(duration, currentTime + 1 / projectFps));
|
||||
},
|
||||
undefined
|
||||
@@ -75,7 +75,7 @@ export function useEditorActions() {
|
||||
useActionHandler(
|
||||
"frame-step-backward",
|
||||
() => {
|
||||
const projectFps = activeProject?.fps || 30;
|
||||
const projectFps = activeProject?.fps || DEFAULT_FPS;
|
||||
seek(Math.max(0, currentTime - 1 / projectFps));
|
||||
},
|
||||
undefined
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
|
||||
import { ResizeState, TimelineElement, TimelineTrack } from "@/types/timeline";
|
||||
import { useMediaStore } from "@/stores/media-store";
|
||||
import { useTimelineStore } from "@/stores/timeline-store";
|
||||
import { useProjectStore } from "@/stores/project-store";
|
||||
import { DEFAULT_FPS, useProjectStore } from "@/stores/project-store";
|
||||
import { snapTimeToFrame } from "@/constants/timeline-constants";
|
||||
|
||||
interface UseTimelineElementResizeProps {
|
||||
@@ -113,7 +113,7 @@ export function useTimelineElementResize({
|
||||
|
||||
// Get project FPS for frame snapping
|
||||
const projectStore = useProjectStore.getState();
|
||||
const projectFps = projectStore.activeProject?.fps || 30;
|
||||
const projectFps = projectStore.activeProject?.fps || DEFAULT_FPS;
|
||||
|
||||
if (resizing.side === "left") {
|
||||
// Left resize - different behavior for media vs text/image elements
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { snapTimeToFrame } from "@/constants/timeline-constants";
|
||||
import { useProjectStore } from "@/stores/project-store";
|
||||
import { DEFAULT_FPS, useProjectStore } from "@/stores/project-store";
|
||||
import { usePlaybackStore } from "@/stores/playback-store";
|
||||
import { useState, useEffect, useCallback, useRef } from "react";
|
||||
|
||||
@@ -86,7 +86,7 @@ export function useTimelinePlayhead({
|
||||
const rawTime = Math.max(0, Math.min(duration, x / (50 * zoomLevel)));
|
||||
// Use frame snapping for playhead scrubbing
|
||||
const projectStore = useProjectStore.getState();
|
||||
const projectFps = projectStore.activeProject?.fps || 30;
|
||||
const projectFps = projectStore.activeProject?.fps || DEFAULT_FPS;
|
||||
const time = snapTimeToFrame(rawTime, projectFps);
|
||||
|
||||
// Debug logging
|
||||
|
||||
Reference in New Issue
Block a user