draw booleans as 0-1
This commit is contained in:
parent
86d3e07f6f
commit
7874d3c291
1 changed files with 8 additions and 4 deletions
|
@ -66,7 +66,7 @@ const BasicKeyframedTrack: React.VFC<{
|
||||||
|
|
||||||
const extremumSpace: ExtremumSpace = useMemo(() => {
|
const extremumSpace: ExtremumSpace = useMemo(() => {
|
||||||
const extremums =
|
const extremums =
|
||||||
propConfig.type === 'number'
|
propConfig.type === 'number' || propConfig.type === 'boolean'
|
||||||
? calculateScalarExtremums(trackData.keyframes, propConfig)
|
? calculateScalarExtremums(trackData.keyframes, propConfig)
|
||||||
: calculateNonScalarExtremums(trackData.keyframes)
|
: calculateNonScalarExtremums(trackData.keyframes)
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ const BasicKeyframedTrack: React.VFC<{
|
||||||
layoutP={layoutP}
|
layoutP={layoutP}
|
||||||
sheetObject={sheetObject}
|
sheetObject={sheetObject}
|
||||||
trackId={trackId}
|
trackId={trackId}
|
||||||
isScalar={propConfig.type === 'number'}
|
isScalar={propConfig.type === 'number' || propConfig.type === 'boolean'}
|
||||||
key={kf.id}
|
key={kf.id}
|
||||||
extremumSpace={cachedExtremumSpace.current}
|
extremumSpace={cachedExtremumSpace.current}
|
||||||
color={color}
|
color={color}
|
||||||
|
@ -146,12 +146,16 @@ function calculateScalarExtremums(
|
||||||
}
|
}
|
||||||
|
|
||||||
keyframes.forEach((cur, i) => {
|
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)
|
check(curVal)
|
||||||
if (!cur.connectedRight) return
|
if (!cur.connectedRight) return
|
||||||
const next = keyframes[i + 1]
|
const next = keyframes[i + 1]
|
||||||
if (!next) return
|
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 + cur.handles[3] * diff)
|
||||||
check(curVal + next.handles[1] * diff)
|
check(curVal + next.handles[1] * diff)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue