1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-27 05:11:11 +02:00

feat(web): coordinate input for asset location (#11291)

This commit is contained in:
Michel Heusschen
2024-07-23 14:01:10 +02:00
committed by GitHub
parent 8725656fd2
commit 7d3db11a5c
5 changed files with 126 additions and 8 deletions

View File

@ -12,6 +12,7 @@
import SearchBar from '../elements/search-bar.svelte';
import { listNavigation } from '$lib/actions/list-navigation';
import { t } from 'svelte-i18n';
import CoordinatesInput from '$lib/components/shared-components/coordinates-input.svelte';
export let asset: AssetResponseDto | undefined = undefined;
@ -34,9 +35,9 @@
confirm: Point;
}>();
$: lat = asset?.exifInfo?.latitude || 0;
$: lng = asset?.exifInfo?.longitude || 0;
$: zoom = lat && lng ? 15 : 1;
$: lat = asset?.exifInfo?.latitude ?? undefined;
$: lng = asset?.exifInfo?.longitude ?? undefined;
$: zoom = lat !== undefined && lng !== undefined ? 15 : 1;
$: {
if (places) {
@ -148,7 +149,7 @@
{/if}
</div>
</div>
<label for="datetime">{$t('pick_a_location')}</label>
<span>{$t('pick_a_location')}</span>
<div class="h-[500px] min-h-[300px] w-full">
{#await import('../shared-components/map/map.svelte')}
{#await delay(timeToLoadTheMap) then}
@ -157,10 +158,9 @@
<LoadingSpinner />
</div>
{/await}
{:then component}
<svelte:component
this={component.default}
mapMarkers={lat && lng && asset
{:then { default: Map }}
<Map
mapMarkers={lat !== undefined && lng !== undefined && asset
? [
{
id: asset.id,
@ -181,5 +181,16 @@
/>
{/await}
</div>
<div class="grid sm:grid-cols-2 gap-4 text-sm text-left mt-4">
<CoordinatesInput
lat={point ? point.lat : lat}
lng={point ? point.lng : lng}
onUpdate={(lat, lng) => {
point = { lat, lng };
addClipMapMarker(lng, lat);
}}
/>
</div>
</div>
</ConfirmDialog>