forked from MapComplete/MapComplete
Fix undefined error in DirectionIndicator
This commit is contained in:
parent
8b6ee877f0
commit
0733c46fcb
2 changed files with 4 additions and 1 deletions
|
@ -994,6 +994,9 @@ export class GeoOperations {
|
|||
* @param meters
|
||||
*/
|
||||
public static distanceToHuman(meters: number): string {
|
||||
if (meters === undefined) {
|
||||
return ""
|
||||
}
|
||||
meters = Math.round(meters)
|
||||
if (meters < 1000) {
|
||||
return meters + "m"
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
<button class={twMerge("relative rounded-full soft", size)} use:ariaLabelStore={label} on:click={() => focusMap()}>
|
||||
<div class={twMerge("absolute top-0 left-0 flex items-center justify-center text-sm break-words",size)}>
|
||||
{GeoOperations.distanceToHuman($bearingAndDistGps.dist)}
|
||||
{GeoOperations.distanceToHuman($bearingAndDistGps?.dist)}
|
||||
</div>
|
||||
{#if $bearingFromGps !== undefined}
|
||||
<div class={twMerge("absolute top-0 left-0 rounded-full", size)}>
|
||||
|
|
Loading…
Reference in a new issue