summaryrefslogtreecommitdiff
path: root/apps/web/src/stores/timeline-store.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-08-04 20:45:48 +0200
committerMaze Winther <mazewinther@gmail.com>2025-08-04 20:45:48 +0200
commitb0329f1372f10b887ad056b9220bf49a4e822e0a (patch)
tree59d620989cbe06239e458198edd981761ac3acf5 /apps/web/src/stores/timeline-store.ts
parentf0dd30ebfc16a61c2869da8407101e8533e584f0 (diff)
downloadopencut-b0329f1372f10b887ad056b9220bf49a4e822e0a.tar.gz
refactor: move canvas size to be a project-level setting instead of editor-level
Diffstat (limited to 'apps/web/src/stores/timeline-store.ts')
-rw-r--r--apps/web/src/stores/timeline-store.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index 71ddedca..ed2ed612 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -10,17 +10,16 @@ import {
ensureMainTrack,
validateElementTrackCompatibility,
} from "@/types/timeline";
-import { useEditorStore } from "./editor-store";
import {
useMediaStore,
getMediaAspectRatio,
type MediaItem,
} from "./media-store";
+import { findBestCanvasPreset } from "@/lib/editor-utils";
import { storageService } from "@/lib/storage/storage-service";
import { useProjectStore } from "./project-store";
import { generateUUID } from "@/lib/utils";
import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants";
-import { toast } from "sonner";
import { checkElementOverlaps, resolveElementOverlaps } from "@/lib/timeline";
// Helper function to manage element naming with suffixes
@@ -533,9 +532,10 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
mediaItem &&
(mediaItem.type === "image" || mediaItem.type === "video")
) {
- const editorStore = useEditorStore.getState();
- editorStore.setCanvasSizeFromAspectRatio(
- getMediaAspectRatio(mediaItem)
+ const projectStore = useProjectStore.getState();
+ projectStore.updateCanvasSize(
+ findBestCanvasPreset(getMediaAspectRatio(mediaItem)),
+ "original"
);
}