summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-01 19:27:49 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-01 19:27:49 +0200
commitbd9ec023eefc4b5d26fa8b66c4338e97104f0f96 (patch)
tree08350eaa107b27f026eebdb65df54b1ca25521fd /apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
parentf4b9f40ab1ba1cedf208bba708f4331d36bb30cc (diff)
downloadopencut-bd9ec023eefc4b5d26fa8b66c4338e97104f0f96.tar.gz
refactor: split constants by domain and isolate timeline panel from core
Diffstat (limited to 'apps/web/src/hooks/timeline/element/use-keyframe-drag.ts')
-rw-r--r--apps/web/src/hooks/timeline/element/use-keyframe-drag.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts b/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
index e0bf8084..bbe843f2 100644
--- a/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
+++ b/apps/web/src/hooks/timeline/element/use-keyframe-drag.ts
@@ -9,10 +9,8 @@ import { useEditor } from "@/hooks/use-editor";
import { useKeyframeSelection } from "./use-keyframe-selection";
import { snapTimeToFrame, getSnappedSeekTime } from "opencut-wasm";
import { timelineTimeToSnappedPixels } from "@/lib/timeline";
-import {
- DRAG_THRESHOLD_PX,
- TIMELINE_CONSTANTS,
-} from "@/constants/timeline-constants";
+import { BASE_TIMELINE_PIXELS_PER_SECOND } from "@/lib/timeline/scale";
+import { TIMELINE_DRAG_THRESHOLD_PX } from "@/components/editor/panels/timeline/interaction";
import { RetimeKeyframeCommand } from "@/lib/commands/timeline/element/keyframes/retime-keyframe";
import { BatchCommand } from "@/lib/commands";
import type { SelectedKeyframeRef } from "@/lib/animation/types";
@@ -64,7 +62,7 @@ export function useKeyframeDrag({
const activeProject = editor.project.getActive();
const fps = activeProject.settings.fps;
- const pixelsPerSecond = TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel;
+ const pixelsPerSecond = BASE_TIMELINE_PIXELS_PER_SECOND * zoomLevel;
const endDrag = useCallback(() => {
setDragState(initialDragState);
@@ -127,7 +125,7 @@ export function useKeyframeDrag({
const handleMouseMove = ({ clientX }: MouseEvent) => {
if (isPendingDrag && pendingDragRef.current) {
const deltaX = Math.abs(clientX - pendingDragRef.current.startMouseX);
- if (deltaX <= DRAG_THRESHOLD_PX) return;
+ if (deltaX <= TIMELINE_DRAG_THRESHOLD_PX) return;
const pending = pendingDragRef.current;
pendingDragRef.current = null;
@@ -248,7 +246,8 @@ export function useKeyframeDrag({
const wasDrag =
mouseDownXRef.current !== null &&
- Math.abs(event.clientX - mouseDownXRef.current) > DRAG_THRESHOLD_PX;
+ Math.abs(event.clientX - mouseDownXRef.current) >
+ TIMELINE_DRAG_THRESHOLD_PX;
mouseDownXRef.current = null;
if (wasDrag) return;