From cc9a65fbd82c07a0633f63a0d7f6967d77742994 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Mon, 28 Feb 2022 14:33:41 +0100 Subject: [PATCH] Don't allow the length of a sequence to go below zero Fixes THE-80 --- theatre/studio/src/store/stateEditors.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/theatre/studio/src/store/stateEditors.ts b/theatre/studio/src/store/stateEditors.ts index d80eff0..66b3a5d 100644 --- a/theatre/studio/src/store/stateEditors.ts +++ b/theatre/studio/src/store/stateEditors.ts @@ -36,7 +36,7 @@ import type { PanelPosition, StudioAhistoricState, } from './types' -import {uniq} from 'lodash-es' +import {clamp, uniq} from 'lodash-es' import { isProject, isSheet, @@ -415,7 +415,11 @@ namespace stateEditors { export function setLength( p: WithoutSheetInstance & {length: number}, ) { - _ensure(p).length = parseFloat(p.length.toFixed(2)) + _ensure(p).length = clamp( + parseFloat(p.length.toFixed(2)), + 0.01, + Infinity, + ) } function _ensureTracksOfObject(