From 20e0c03b39b9a396c9aa3884bcb77bbe574876ec Mon Sep 17 00:00:00 2001 From: Le_Futuriste Date: Fri, 25 Aug 2023 15:19:49 +0200 Subject: [PATCH] feat(web): add link to external map in leaflet popup (#3847) * feat(web): add link to external map in leaflet popup Sometimes it's useful to open a geo location to an external map application to not have to copy the coordinates manually. Here I put a link to OpenStreetMap because it's what I personally use. But I known some people would want to use something different. We could instead link to geohacks (eg. https://geohack.toolforge.org/geohack.php?params=048.861085_N_0002.313158_E_globe:Earth) or make it a configurable param. * chore: cleanup --------- Co-authored-by: Jason Rasmussen --- .../components/asset-viewer/detail-panel.svelte | 14 ++++++++++++-- .../shared-components/leaflet/marker.svelte | 12 ++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index 8d066b4920..c37b28b9a4 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -35,10 +35,13 @@ const lng = asset.exifInfo?.longitude; if (lat && lng) { - return [lat, lng] as LatLngTuple; + return [Number(lat.toFixed(7)), Number(lng.toFixed(7))] as LatLngTuple; } })(); + $: lat = latlng ? latlng[0] : undefined; + $: lng = latlng ? latlng[1] : undefined; + $: people = asset.people || []; const dispatch = createEventDispatcher(); @@ -259,7 +262,14 @@ attribution: '© OpenStreetMap', }} /> - + +

+ {lat}, {lng} +

+ + Open in OpenStreetMap + +
{/await} diff --git a/web/src/lib/components/shared-components/leaflet/marker.svelte b/web/src/lib/components/shared-components/leaflet/marker.svelte index dac3967037..8731e66d04 100644 --- a/web/src/lib/components/shared-components/leaflet/marker.svelte +++ b/web/src/lib/components/shared-components/leaflet/marker.svelte @@ -1,13 +1,13 @@ + + + +