Skip to content

Commit 7258a05

Browse files
committed
fix: compute distance
1 parent 38f614d commit 7258a05

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/component/itinerary/navigator/NaviUtils.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ export function pathProgress(pos, geom) {
111111
}
112112

113113
export function getRemainingTraversal(leg, pos, origin, time) {
114-
if (!leg) {
115-
return 0;
116-
}
117114
if (pos) {
118115
// TODO: maybe apply only when distance is close enough to the path
119116
const posXY = GeodeticToEnu(pos.lat, pos.lon, origin);

app/component/itinerary/navigator/hooks/useRealtimeLegs.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ const useRealtimeLegs = (relayEnvironment, initialLegs, position) => {
238238
const { firstLeg, lastLeg, currentLeg, nextLeg, previousLeg } =
239239
getLegsOfInterest(realTimeLegs, time);
240240

241-
const tailLength = getRemainingTraversal(currentLeg, position, origin, time);
241+
const tailLength = currentLeg
242+
? getRemainingTraversal(currentLeg, position, origin, time) *
243+
currentLeg.distance
244+
: 0;
242245

243246
return {
244247
realTimeLegs,

0 commit comments

Comments
 (0)