diff --git a/web/src/lib/components/trail/map_with_elevation_maplibre.svelte b/web/src/lib/components/trail/map_with_elevation_maplibre.svelte
index 916814cf..763a6407 100644
--- a/web/src/lib/components/trail/map_with_elevation_maplibre.svelte
+++ b/web/src/lib/components/trail/map_with_elevation_maplibre.svelte
@@ -196,7 +196,7 @@
},
} as GeoJSON);
}
- });
+ });
return r;
}
@@ -909,10 +909,8 @@
trails.forEach((t, i) => {
const layerId = t.id!;
addTrailLayer(t, layerId, i, data[i]);
- });
+ });
if (activeTrail !== null) {
- console.log(activeTrail);
-
addCaretLayer(trails[activeTrail].id!);
}
@@ -957,8 +955,31 @@
onDestroy(() => {
map?.remove();
});
+
+ function handleKeydown(e: KeyboardEvent) {
+ if (e.key == "m") {
+ if (trails.length === 1) {
+ removeCaretLayer();
+ removeTrailLayer(trails[0].id!);
+ }
+ }
+ }
+
+ function handleKeyup(e: KeyboardEvent) {
+ if (e.key == "m") {
+ if (trails.length === 1) {
+ addTrailLayer(trails[0], trails[0].id!, 0, data[0]);
+ addCaretLayer(trails[0].id);
+ }
+ } else if (e.key == "p") {
+ if (showElevation) {
+ epc?.toggleProfile();
+ }
+ }
+ }
+