aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-07-22 11:16:07 +0200
committerlonkaars <loek@pipeframe.xyz>2021-07-22 11:16:07 +0200
commit0100b295a13138b982888910b6e05e7ad56808a6 (patch)
treeebf7edd6fa6e32475c86bd6c6367d5789efc1d71
parent77cd794b98ede903caa8e181fea39ba2d7eac5a9 (diff)
fix crash on selection
-rw-r--r--pages/editor.tsx17
1 files changed, 9 insertions, 8 deletions
diff --git a/pages/editor.tsx b/pages/editor.tsx
index 115411f..02c69f0 100644
--- a/pages/editor.tsx
+++ b/pages/editor.tsx
@@ -483,6 +483,7 @@ function TimelineSelection(props: { selectionDragArea: Ref<ReactNode>; }) {
if (global.selection.type.left.value) global.selection.type.left.set(null);
if (global.selection.type.right.value) global.selection.type.right.set(null);
if (global.selection.placed.value) global.selection.placed.set(false);
+ setSetting('default');
selectionPosAPI.start({
center: 0,
startOffset: 0,
@@ -539,6 +540,7 @@ function TimelineSelection(props: { selectionDragArea: Ref<ReactNode>; }) {
);
select(keyframesInSelection);
+ setSetting('slide');
}
}
}, { domTarget: props.selectionDragArea, eventOptions: { passive: false } });
@@ -1269,12 +1271,11 @@ function DefaultSettings() {
</>;
}
-function SlideProperties(props: {
- type: slideTypes;
-}) {
- if (props.type == 'default') return null;
-
- var slide = useHookstate(global).selection.slides[0];
+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;
return <div className='section'>
<span className='title'>Properties</span>
@@ -1313,7 +1314,7 @@ function SlideProperties(props: {
<TextField label='New speed' variant='filled' />
<TextField label='Factor' variant='filled' />
</>,
- }[props.type]}
+ }[slide.value.type]}
</div>;
}
@@ -1349,7 +1350,7 @@ function SlideSettings() {
</ToggleButton>
</ToggleButtonGroup>
</div>
- {!multipleSlides && <SlideProperties type={slideType as slideTypes} />}
+ {!multipleSlides && <SlideProperties />}
<div className='section'>
<FormControl variant='filled'>
<InputLabel>Click through behaviour</InputLabel>