summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor
diff options
context:
space:
mode:
authorAnwarul Islam <anwaarulislaam@gmail.com>2025-07-15 07:03:36 +0600
committerAnwarul Islam <anwaarulislaam@gmail.com>2025-07-15 07:03:36 +0600
commit2cc25b70d56c7bd9a9d23b38f1cd64e797139fa1 (patch)
treec12f26ec28eee77fab952c7c4bc26af42803a5fe /apps/web/src/components/editor
parent9cc77b4499023fa48b9a1abcb05a59c94fcfc4c5 (diff)
downloadopencut-2cc25b70d56c7bd9a9d23b38f1cd64e797139fa1.tar.gz
feat: enhance snapping functionality by adding snap point handling in Timeline component
Diffstat (limited to 'apps/web/src/components/editor')
-rw-r--r--apps/web/src/components/editor/timeline.tsx14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx
index 2f0e3d91..882af66e 100644
--- a/apps/web/src/components/editor/timeline.tsx
+++ b/apps/web/src/components/editor/timeline.tsx
@@ -55,7 +55,7 @@ import {
import { SelectionBox } from "./selection-box";
import { useSelectionBox } from "@/hooks/use-selection-box";
import { SnapIndicator } from "./snap-indicator";
-import { useTimelineSnapping } from "@/hooks/use-timeline-snapping";
+import { useTimelineSnapping, SnapPoint } from "@/hooks/use-timeline-snapping";
import type { DragData, TimelineTrack } from "@/types/timeline";
import {
getTrackHeight,
@@ -172,9 +172,16 @@ export function Timeline() {
});
// Calculate snap indicator state
- const [currentSnapPoint, setCurrentSnapPoint] = useState<any>(null);
+ const [currentSnapPoint, setCurrentSnapPoint] = useState<SnapPoint | null>(
+ null
+ );
const showSnapIndicator =
- dragState.isDragging && snappingEnabled && currentSnapPoint;
+ dragState.isDragging && snappingEnabled && currentSnapPoint !== null;
+
+ // Callback to handle snap point changes from TimelineTrackContent
+ const handleSnapPointChange = useCallback((snapPoint: SnapPoint | null) => {
+ setCurrentSnapPoint(snapPoint);
+ }, []);
// Timeline content click to seek handler
const handleTimelineContentClick = useCallback(
@@ -1113,6 +1120,7 @@ export function Timeline() {
<TimelineTrackContent
track={track}
zoomLevel={zoomLevel}
+ onSnapPointChange={handleSnapPointChange}
/>
</div>
</ContextMenuTrigger>