mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-05 01:42:54 +00:00
refactor elevation queries
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user