From 5d2e017368a3d64735f2dc6e5c20fc6b3a8d240d Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 25 Jul 2021 13:49:16 +0200 Subject: fix loop selection slide settings --- pages/editor.tsx | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'pages') diff --git a/pages/editor.tsx b/pages/editor.tsx index 557fd10..a490e9b 100644 --- a/pages/editor.tsx +++ b/pages/editor.tsx @@ -1173,11 +1173,8 @@ function DefaultSettings() { ; } -function SlideProperties() { - var selection = useHookstate(global).selection.slides; - if (selection.length < 1) return null; - var slide = selection[0]; - if (slide.value.type == 'default') return null; +function SlideProperties(props: { slide: State; }) { + if (props.slide.value.type == 'default') return null; return
Properties @@ -1187,22 +1184,23 @@ function SlideProperties() { label='Duration' variant='filled' type='number' - value={(slide as State).frame.get() - (slide as State).beginFrame.get()} + value={(props.slide as State).frame.get() + - (props.slide as State).beginFrame.get()} /> ).beginFrame.get()} + value={(props.slide as State).beginFrame.get()} update={newValue => { - (slide as State).frame.set(newValue); + (props.slide as State).frame.set(newValue); global.update.refreshLiveTimeline.value(); }} player={player} /> ).frame.get()} + value={(props.slide as State).frame.get()} update={newValue => { - (slide as State).frame.set(newValue); + (props.slide as State).frame.set(newValue); global.update.refreshLiveTimeline.value(); }} player={player} @@ -1216,15 +1214,20 @@ function SlideProperties() { , - }[slide.value.type]} + }[props.slide.value.type]}
; } function SlideSettings() { - var selection = useHookstate(global).selection; - var multipleSlides = selection.slides.get().length > 1; - var slideType = selection.slides.get()[0]?.type || ''; - var clickThroughBehaviour = selection.slides.get()[0]?.clickThroughBehaviour || ''; + var selection = Array.from(useHookstate(global).selection.slides); + selection = selection.map(slide => { + if (slide.value.type as slideTypes | 'loopBegin' != 'loopBegin') return slide; + return global.timeline.workingTimeline.find(s => s.value.id == slide.value.id && s.value.type == 'loop'); + }).filter((value, index, arr) => arr.indexOf(arr.find(s => s.value.id == value.value.id)) == index); + var multipleSlides = selection.length > 1; + + var slideType = selection.length > 0 ? selection[0].value.type : ''; + var clickThroughBehaviour = selection.length > 0 ? selection[0].value.clickThroughBehaviour : ''; return <>

Slide settings

@@ -1252,14 +1255,14 @@ function SlideSettings() { - {!multipleSlides && } + {selection.length == 1 && }
Click through behaviour