mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 08:42:31 +00:00
fix routing issue with time data
This commit is contained in:
@@ -501,16 +501,18 @@ export class RoutingControls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (anchors[0].point._data.index === 0) { // First anchor is the first point of the segment
|
if (anchors[0].point._data.index === 0) { // First anchor is the first point of the segment
|
||||||
|
response[0]._data.index = 0;
|
||||||
|
response[0].time = anchors[0].point.time;
|
||||||
anchors[0].point = response[0]; // replace the first anchor
|
anchors[0].point = response[0]; // replace the first anchor
|
||||||
anchors[0].point._data.index = 0;
|
|
||||||
} else {
|
} else {
|
||||||
anchors[0].point = anchors[0].point.clone(); // Clone the anchor to assign new properties
|
anchors[0].point = anchors[0].point.clone(); // Clone the anchor to assign new properties
|
||||||
response.splice(0, 0, anchors[0].point); // Insert it in the response to keep it
|
response.splice(0, 0, anchors[0].point); // Insert it in the response to keep it
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anchors[anchors.length - 1].point._data.index === segment.trkpt.length - 1) { // Last anchor is the last point of the segment
|
if (anchors[anchors.length - 1].point._data.index === segment.trkpt.length - 1) { // Last anchor is the last point of the segment
|
||||||
|
response[response.length - 1]._data.index = segment.trkpt.length - 1;
|
||||||
|
response[response.length - 1].time = anchors[anchors.length - 1].point.time;
|
||||||
anchors[anchors.length - 1].point = response[response.length - 1]; // replace the 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 {
|
} else {
|
||||||
anchors[anchors.length - 1].point = anchors[anchors.length - 1].point.clone(); // Clone the anchor to assign new properties
|
anchors[anchors.length - 1].point = anchors[anchors.length - 1].point.clone(); // Clone the anchor to assign new properties
|
||||||
response.push(anchors[anchors.length - 1].point); // Insert it in the response to keep it
|
response.push(anchors[anchors.length - 1].point); // Insert it in the response to keep it
|
||||||
|
Reference in New Issue
Block a user