refactor elevation queries

This commit is contained in:
vcoppe
2024-07-19 13:17:23 +02:00
parent 78fff5981c
commit 48aa88489e
4 changed files with 21 additions and 4 deletions

View File

@@ -8,6 +8,8 @@ import { base } from "$app/paths";
import { browser } from "$app/environment";
import { languages } from "$lib/languages";
import { locale } from "svelte-i18n";
import type Coordinates from "gpx";
import type mapboxgl from "mapbox-gl";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
@@ -67,6 +69,11 @@ export const flyAndScale = (
};
};
export function getElevation(map: mapboxgl.Map, coordinates: Coordinates): number {
let elevation = map.queryTerrainElevation(coordinates, { exaggerated: false });
return elevation === null ? 0 : elevation;
}
let previousCursors: string[] = [];
export function setCursor(cursor: string) {
let m = get(map);