summaryrefslogtreecommitdiff
path: root/apps/web/src/components
diff options
context:
space:
mode:
authorleimingsheng <leimingsheng@58.com>2025-07-21 19:51:11 +0800
committerleimingsheng <leimingsheng@58.com>2025-07-21 19:51:11 +0800
commit3c76a3f241c8d0d00f9aa635bb14728e61296c58 (patch)
treebbeb71239a6ffa553ebd342927787ddd7c258594 /apps/web/src/components
parent768a1dbfbc629f3817cc872d02ca080ab7a091ec (diff)
downloadopencut-3c76a3f241c8d0d00f9aa635bb14728e61296c58.tar.gz
feat: fix some error
Diffstat (limited to 'apps/web/src/components')
-rw-r--r--apps/web/src/components/editor/timeline-fixed.tsx21
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/web/src/components/editor/timeline-fixed.tsx b/apps/web/src/components/editor/timeline-fixed.tsx
index 12b7012c..52103bda 100644
--- a/apps/web/src/components/editor/timeline-fixed.tsx
+++ b/apps/web/src/components/editor/timeline-fixed.tsx
@@ -198,12 +198,11 @@ export function Timeline() {
!target.closest("[data-track-labels]");
if (isTimelineBackground) {
- const now = Date.now();
mouseTrackingRef.current = {
isMouseDown: true,
downX: e.clientX,
downY: e.clientY,
- downTime: now,
+ downTime: e.timeStamp,
};
}
}, []);
@@ -250,7 +249,8 @@ export function Timeline() {
clickX / (TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel);
// Snap to frame boundary for accurate seeking
- const snappedTime = snapTimeToFrame(timeFromClick);
+ const projectFps = activeProject?.fps || 30;
+ const snappedTime = snapTimeToFrame(timeFromClick, projectFps);
// Seek to the clicked time
seek(Math.max(0, snappedTime));
@@ -382,7 +382,11 @@ export function Timeline() {
});
for (const media of processedMedia) {
- addMediaItem(media);
+ if (!activeProject) {
+ toast.error("No active project");
+ return;
+ }
+ await addMediaItem(activeProject.id, media);
// Add to timeline automatically
const trackId = crypto.randomUUID();
@@ -517,9 +521,12 @@ export function Timeline() {
// --- Scroll synchronization effect ---
useEffect(() => {
const rulerViewport = rulerScrollRef.current;
- const tracksViewport = tracksScrollRef.current?.parentElement; // The container with overflow-auto
- const trackLabelsViewport = trackLabelsScrollRef.current?.parentElement; // The container with overflow-y-auto
-
+ const tracksViewport = tracksScrollRef.current?.querySelector(
+ "[data-radix-scroll-area-viewport]"
+ ) as HTMLElement;
+ const trackLabelsViewport = trackLabelsScrollRef.current?.querySelector(
+ "[data-radix-scroll-area-viewport]"
+ ) as HTMLElement;
if (!rulerViewport || !tracksViewport) return;
// Horizontal scroll synchronization between ruler and tracks