summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/timeline/placement/overlap.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-20 11:31:17 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-20 11:31:17 +0200
commit3e89d2998588f8e35c524e523ba2ee853f0f6475 (patch)
tree57221f96c1259b3b07e3ddf8c1adefc502b9d8eb /apps/web/src/lib/timeline/placement/overlap.ts
parent729d10592f4e802f91c555c309ff3ba4b119f843 (diff)
downloadopencut-3e89d2998588f8e35c524e523ba2ee853f0f6475.tar.gz
refactor: restructure files to their domains, new preview overlay system, and dep graph
Diffstat (limited to 'apps/web/src/lib/timeline/placement/overlap.ts')
-rw-r--r--apps/web/src/lib/timeline/placement/overlap.ts44
1 files changed, 0 insertions, 44 deletions
diff --git a/apps/web/src/lib/timeline/placement/overlap.ts b/apps/web/src/lib/timeline/placement/overlap.ts
deleted file mode 100644
index 5e37c052..00000000
--- a/apps/web/src/lib/timeline/placement/overlap.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import type { TimelineElement } from "@/lib/timeline";
-import type { PlacementTimeSpan } from "./types";
-
-interface TrackWithElements {
- elements: TimelineElement[];
-}
-
-function wouldElementOverlap({
- elements,
- startTime,
- endTime,
- excludeElementId,
-}: {
- elements: TimelineElement[];
- startTime: number;
- endTime: number;
- excludeElementId?: string;
-}): boolean {
- return elements.some((element) => {
- if (excludeElementId && element.id === excludeElementId) {
- return false;
- }
-
- const elementEnd = element.startTime + element.duration;
- return startTime < elementEnd && endTime > element.startTime;
- });
-}
-
-export function canPlaceTimeSpansOnTrack({
- track,
- timeSpans,
-}: {
- track: TrackWithElements;
- timeSpans: PlacementTimeSpan[];
-}): boolean {
- return timeSpans.every(({ startTime, duration, excludeElementId }) => {
- return !wouldElementOverlap({
- elements: track.elements,
- startTime,
- endTime: startTime + duration,
- excludeElementId,
- });
- });
-}