summaryrefslogtreecommitdiff
path: root/apps/web/src/timeline/creation.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-26 17:31:28 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-26 17:31:28 +0200
commit56ca09692a308b22455420d11376ff8d41244c47 (patch)
tree4eca5ae032451c5db954801008aa9f164b2e2b1d /apps/web/src/timeline/creation.ts
parente6c6193638e4247ff1e6f2df40de2a057112c773 (diff)
downloadopencut-56ca09692a308b22455420d11376ff8d41244c47.tar.gz
refactor: thinner hooks
Diffstat (limited to 'apps/web/src/timeline/creation.ts')
-rw-r--r--apps/web/src/timeline/creation.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/web/src/timeline/creation.ts b/apps/web/src/timeline/creation.ts
index f3c93b8d..0f28af56 100644
--- a/apps/web/src/timeline/creation.ts
+++ b/apps/web/src/timeline/creation.ts
@@ -1,5 +1,17 @@
-import { mediaTime, TICKS_PER_SECOND } from "@/wasm";
+import { mediaTime, mediaTimeFromSeconds, TICKS_PER_SECOND } from "@/wasm";
export const DEFAULT_NEW_ELEMENT_DURATION = mediaTime({
ticks: 5 * TICKS_PER_SECOND,
});
+
+export function toElementDurationTicks({
+ seconds,
+}: {
+ seconds: number | null | undefined;
+}) {
+ if (seconds == null) {
+ return DEFAULT_NEW_ELEMENT_DURATION;
+ }
+
+ return mediaTimeFromSeconds({ seconds });
+}