aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-06-25 10:08:25 +0200
committerlonkaars <loek@pipeframe.xyz>2021-06-25 10:08:25 +0200
commita9910cd880a38aa6dc5a5c2b63a61291cdb56e0e (patch)
treea0261608169a8bb16388a7f9421b88bc96a6407b /pages
parent279c165e2d9f633052f53a609bb721ba0c9710a1 (diff)
deletion working better (no more variable referencing)
Diffstat (limited to 'pages')
-rw-r--r--pages/editor.tsx13
1 files changed, 4 insertions, 9 deletions
diff --git a/pages/editor.tsx b/pages/editor.tsx
index 722c4a8..0290fe1 100644
--- a/pages/editor.tsx
+++ b/pages/editor.tsx
@@ -439,15 +439,10 @@ function TimelineSelection(props: { selectionAreaRef: Ref<ReactNode>; }) {
useMousetrap(['del', 'backspace'], () => {
if (!project.selection.placed) return;
- var indexOffset = 0;
- project.selection.slides.forEach(slide => {
- if (!slideTypes.includes(slide.value.type)) return;
- var index = project.timeline.workingTimeline.findIndex(s => s.value?.id == slide.value.id);
- if (index == -1) return;
- index -= indexOffset;
- project.timeline.workingTimeline[index].set(none);
- indexOffset++;
- });
+ var selection = project.selection.slides.attach(Downgraded).value
+ .map(s => ({ id: s.id.toString(), type: s.type.toString() }))
+ .filter(s => slideTypes.includes(s.type));
+ selection.forEach(slide => project.timeline.workingTimeline.find(s => s.value?.id == slide.id).set(none));
project.update.refreshLiveTimeline.value();
project.selection.merge({