mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 17:51:39 -05:00
Convert meters to kilometers in route hover
This commit is contained in:
parent
b1f7b98c11
commit
9104e612cb
2 changed files with 10 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
|
@ -244,7 +244,7 @@ export default class extends Controller {
|
|||
<b>Start:</b> ${firstTimestamp}<br>
|
||||
<b>End:</b> ${lastTimestamp}<br>
|
||||
<b>Duration:</b> ${timeOnRoute}<br>
|
||||
<b>Distance:</b> ${Math.round(distance)}m<br>
|
||||
<b>Distance:</b> ${this.formatDistance(distance)}<br>
|
||||
`;
|
||||
|
||||
if (isDebugMode) {
|
||||
|
|
@ -315,4 +315,12 @@ export default class extends Controller {
|
|||
})
|
||||
).addTo(map);
|
||||
}
|
||||
|
||||
formatDistance(distance) {
|
||||
if (distance >= 1000) {
|
||||
return (distance / 1000).toFixed(2) + ' km';
|
||||
} else {
|
||||
return distance.toFixed(0) + ' meters';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue