2023-12-19 22:08:00 +01:00
|
|
|
<script lang="ts">
|
|
|
|
|
/**
|
|
|
|
|
* The 'imageOperations' previews an image and offers some extra tools (e.g. download)
|
|
|
|
|
*/
|
2023-12-05 18:35:18 +01:00
|
|
|
|
2024-11-05 00:18:16 +01:00
|
|
|
import ImageProvider from "../../Logic/ImageProviders/ImageProvider"
|
2025-04-10 04:53:01 +02:00
|
|
|
import type { HotspotProperties } from "../../Logic/ImageProviders/ImageProvider"
|
2023-12-19 22:08:00 +01:00
|
|
|
import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
|
|
|
|
|
import ImageAttribution from "./ImageAttribution.svelte"
|
|
|
|
|
import ImagePreview from "./ImagePreview.svelte"
|
|
|
|
|
import { DownloadIcon } from "@rgossiaux/svelte-heroicons/solid"
|
|
|
|
|
import { twMerge } from "tailwind-merge"
|
2023-12-26 12:26:26 +01:00
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
|
|
|
|
import Loading from "../Base/Loading.svelte"
|
2024-09-02 00:26:02 +02:00
|
|
|
import Tr from "../Base/Tr.svelte"
|
|
|
|
|
import Translations from "../i18n/Translations"
|
2024-09-30 13:11:29 +02:00
|
|
|
import DotMenu from "../Base/DotMenu.svelte"
|
2025-04-10 04:53:01 +02:00
|
|
|
import type { Feature, Geometry } from "geojson"
|
2025-03-30 03:10:29 +02:00
|
|
|
import { Store } from "../../Logic/UIEventSource"
|
2023-12-05 18:35:18 +01:00
|
|
|
|
2024-12-18 01:21:07 +01:00
|
|
|
export let image: Partial<ProvidedImage> & { id: string; url: string }
|
2023-12-19 22:08:00 +01:00
|
|
|
export let clss: string = undefined
|
2025-04-15 18:18:44 +02:00
|
|
|
export let nearbyFeatures:
|
|
|
|
|
| Feature<Geometry, HotspotProperties>[]
|
|
|
|
|
| Store<Feature<Geometry, HotspotProperties>[]> = []
|
2023-12-30 15:24:30 +01:00
|
|
|
|
2023-12-26 12:26:26 +01:00
|
|
|
let isLoaded = new UIEventSource(false)
|
2023-12-05 18:35:18 +01:00
|
|
|
</script>
|
|
|
|
|
|
2023-12-19 22:08:00 +01:00
|
|
|
<div class={twMerge("relative h-full w-full", clss)}>
|
2025-02-10 02:04:58 +01:00
|
|
|
<div class="panzoom-container focusable absolute left-0 top-0 h-full w-full overflow-hidden">
|
2023-12-26 12:26:26 +01:00
|
|
|
{#if !$isLoaded}
|
2023-12-30 15:24:30 +01:00
|
|
|
<div class="flex h-full w-full items-center justify-center">
|
|
|
|
|
<Loading />
|
2023-12-26 12:26:26 +01:00
|
|
|
</div>
|
2023-12-30 15:24:30 +01:00
|
|
|
{/if}
|
2025-03-30 03:10:29 +02:00
|
|
|
<ImagePreview {image} {isLoaded} {nearbyFeatures} />
|
2023-12-05 18:35:18 +01:00
|
|
|
</div>
|
2024-09-30 13:11:29 +02:00
|
|
|
|
2025-04-10 04:53:01 +02:00
|
|
|
{#if $$slots["dot-menu-actions"]}
|
2025-04-15 18:18:44 +02:00
|
|
|
<DotMenu dotsPosition="top-0 left-0" dotsSize="w-8 h-8" hideBackground>
|
|
|
|
|
<slot name="dot-menu-actions">
|
|
|
|
|
<button
|
|
|
|
|
class="no-image-background pointer-events-auto flex items-center"
|
|
|
|
|
on:click={() => ImageProvider.offerImageAsDownload(image)}
|
|
|
|
|
>
|
|
|
|
|
<DownloadIcon class="h-6 w-6 px-2 opacity-100" />
|
|
|
|
|
<Tr t={Translations.t.general.download.downloadImage} />
|
|
|
|
|
</button>
|
|
|
|
|
</slot>
|
|
|
|
|
</DotMenu>
|
2025-04-10 04:53:01 +02:00
|
|
|
{/if}
|
2023-12-19 22:08:00 +01:00
|
|
|
<div
|
|
|
|
|
class="pointer-events-none absolute bottom-0 left-0 flex w-full flex-wrap items-end justify-between"
|
|
|
|
|
>
|
2024-09-02 12:48:15 +02:00
|
|
|
<div class="pointer-events-auto m-1 w-fit transition-colors duration-200">
|
|
|
|
|
<ImageAttribution {image} attributionFormat="large" />
|
2023-12-05 18:35:18 +01:00
|
|
|
</div>
|
|
|
|
|
|
2024-09-30 13:11:29 +02:00
|
|
|
<slot />
|
2023-12-05 18:35:18 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|