Feature: add zoomable image when clicked

This commit is contained in:
Pieter Vander Vennet 2023-12-05 18:35:18 +01:00
parent c65ccdbc24
commit d7413e8228
20 changed files with 481 additions and 181 deletions

View file

@ -0,0 +1,29 @@
<script lang="ts">
import { Store } from "../../Logic/UIEventSource"
/**
* The image preview allows to drag and zoom in to the image
*/
import * as panzoom from "panzoom"
import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
export let image : ProvidedImage
let panzoomInstance = undefined
let panzoomEl: HTMLElement
$: {
if (panzoomEl) {
panzoomInstance = panzoom(panzoomEl, { bounds: true,
boundsPadding: 1,
minZoom: 1,
maxZoom: 25
})
} else {
panzoomInstance?.dispose()
}
}
</script>
<img bind:this={panzoomEl} src={image.url} />