From 9d5391805d972892d772569c073614f235b5158e Mon Sep 17 00:00:00 2001 From: vcoppe Date: Thu, 5 Sep 2024 09:51:43 +0200 Subject: [PATCH] fix consecutive splits --- .../lib/components/toolbar/tools/scissors/SplitControls.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/website/src/lib/components/toolbar/tools/scissors/SplitControls.ts b/website/src/lib/components/toolbar/tools/scissors/SplitControls.ts index b0e228a9..8f1cbc7d 100644 --- a/website/src/lib/components/toolbar/tools/scissors/SplitControls.ts +++ b/website/src/lib/components/toolbar/tools/scissors/SplitControls.ts @@ -49,9 +49,7 @@ export class SplitControls { } updateControls() { // Update the markers when the files change - let controlIndex = 0; - applyToOrderedSelectedItemsFromFile((fileId, level, items) => { let file = getFile(fileId); @@ -61,6 +59,7 @@ export class SplitControls { for (let point of segment.trkpt.slice(1, -1)) { // Update the existing controls (could be improved by matching the existing controls with the new ones?) if (point._data.anchor) { if (controlIndex < this.controls.length) { + this.controls[controlIndex].fileId = fileId; this.controls[controlIndex].point = point; this.controls[controlIndex].segment = segment; this.controls[controlIndex].trackIndex = trackIndex; @@ -137,7 +136,7 @@ export class SplitControls { marker.getElement().addEventListener('click', (e) => { e.stopPropagation(); - dbUtils.split(fileId, trackIndex, segmentIndex, point.getCoordinates(), point._data.index); + dbUtils.split(control.fileId, control.trackIndex, control.segmentIndex, control.point.getCoordinates(), control.point._data.index); }); return control;