From ac83e4bf7769a231fc5ad219bb3a50a50e860ec3 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Tue, 4 Jun 2024 15:30:49 +0200 Subject: [PATCH] fix routing detail --- .../components/toolbar/tools/routing/RoutingControls.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/src/lib/components/toolbar/tools/routing/RoutingControls.ts b/website/src/lib/components/toolbar/tools/routing/RoutingControls.ts index cfbb7129..6840d00a 100644 --- a/website/src/lib/components/toolbar/tools/routing/RoutingControls.ts +++ b/website/src/lib/components/toolbar/tools/routing/RoutingControls.ts @@ -356,7 +356,7 @@ export class RoutingControls { return; } - newPoint._data.index = lastAnchor.segment.trkpt.length; // Do as if the point was the last point in the segment + newPoint._data.index = lastAnchor.segment.trkpt.length - 1; // Do as if the point was the last point in the segment let newAnchor = { point: newPoint, segment: lastAnchor.segment, @@ -457,7 +457,7 @@ export class RoutingControls { } if (anchors[0].point._data.index === 0) { // First anchor is the first point of the segment - anchors[0].point = response[0]; // replaceTrackPoints the first anchor + anchors[0].point = response[0]; // replace the first anchor anchors[0].point._data.index = 0; } else { anchors[0].point = anchors[0].point.clone(); // Clone the anchor to assign new properties @@ -465,7 +465,8 @@ export class RoutingControls { } if (anchors[anchors.length - 1].point._data.index === segment.trkpt.length - 1) { // Last anchor is the last point of the segment - anchors[anchors.length - 1].point = response[response.length - 1]; // replaceTrackPoints the last anchor + console.log('last anchor'); + anchors[anchors.length - 1].point = response[response.length - 1]; // replace the last anchor anchors[anchors.length - 1].point._data.index = segment.trkpt.length - 1; } else { anchors[anchors.length - 1].point = anchors[anchors.length - 1].point.clone(); // Clone the anchor to assign new properties