From 7874d3c2919a2f214873c45c433645e2caf3bf96 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Fri, 12 Apr 2024 19:15:01 +0200 Subject: [PATCH] draw booleans as 0-1 --- .../BasicKeyframedTrack/BasicKeyframedTrack.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx b/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx index e62b64f..d3cbc9c 100644 --- a/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx +++ b/theatre/studio/src/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.tsx @@ -66,7 +66,7 @@ const BasicKeyframedTrack: React.VFC<{ const extremumSpace: ExtremumSpace = useMemo(() => { const extremums = - propConfig.type === 'number' + propConfig.type === 'number' || propConfig.type === 'boolean' ? calculateScalarExtremums(trackData.keyframes, propConfig) : calculateNonScalarExtremums(trackData.keyframes) @@ -109,7 +109,7 @@ const BasicKeyframedTrack: React.VFC<{ layoutP={layoutP} sheetObject={sheetObject} trackId={trackId} - isScalar={propConfig.type === 'number'} + isScalar={propConfig.type === 'number' || propConfig.type === 'boolean'} key={kf.id} extremumSpace={cachedExtremumSpace.current} color={color} @@ -146,12 +146,16 @@ function calculateScalarExtremums( } keyframes.forEach((cur, i) => { - const curVal = valueInProp(cur.value, propConfig) as number + const cv = typeof cur.value === 'boolean' ? (cur.value ? 1 : 0) : cur.value + const curVal = valueInProp(cv, propConfig) as number + check(curVal) if (!cur.connectedRight) return const next = keyframes[i + 1] if (!next) return - const diff = (typeof next.value === 'number' ? next.value : 1) - curVal + const nv = + typeof next.value === 'boolean' ? (next.value ? 1 : 0) : next.value + const diff = (typeof nv === 'number' ? nv : 1) - curVal check(curVal + cur.handles[3] * diff) check(curVal + next.handles[1] * diff) })