summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/ripple/shift.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-06 00:02:23 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-06 00:02:23 +0200
commit44d8c4c8764d49a8e8d0ae713432c07f07cb7597 (patch)
tree4657187279adb475ea710231feb3d0bd4add36ed /apps/web/src/lib/ripple/shift.ts
parent20235d0724a70e6787b6cbdbfa054b1c5d8f62e9 (diff)
downloadopencut-44d8c4c8764d49a8e8d0ae713432c07f07cb7597.tar.gz
refactor: unify element updates into pipeline and centralize ripple
Diffstat (limited to 'apps/web/src/lib/ripple/shift.ts')
-rw-r--r--apps/web/src/lib/ripple/shift.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/web/src/lib/ripple/shift.ts b/apps/web/src/lib/ripple/shift.ts
new file mode 100644
index 00000000..03ab4a67
--- /dev/null
+++ b/apps/web/src/lib/ripple/shift.ts
@@ -0,0 +1,17 @@
+import type { TimelineElement } from "@/lib/timeline/types";
+
+export function rippleShiftElements<TElement extends TimelineElement>({
+ elements,
+ afterTime,
+ shiftAmount,
+}: {
+ elements: TElement[];
+ afterTime: number;
+ shiftAmount: number;
+}): TElement[] {
+ return elements.map((element) =>
+ element.startTime >= afterTime
+ ? ({ ...element, startTime: element.startTime - shiftAmount } as TElement)
+ : element,
+ );
+}