forked from MapComplete/MapComplete
Feature: add zoomable image when clicked
This commit is contained in:
parent
c65ccdbc24
commit
d7413e8228
20 changed files with 481 additions and 181 deletions
29
src/UI/Image/AttributedImage.svelte
Normal file
29
src/UI/Image/AttributedImage.svelte
Normal file
|
@ -0,0 +1,29 @@
|
|||
<script lang="ts">
|
||||
/**
|
||||
* Shows an image with attribution
|
||||
*/
|
||||
import ImageAttribution from "./ImageAttribution.svelte"
|
||||
import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
|
||||
import { Mapillary } from "../../Logic/ImageProviders/Mapillary"
|
||||
|
||||
export let image: ProvidedImage
|
||||
let fallbackImage: string = undefined
|
||||
if (image.provider === Mapillary.singleton) {
|
||||
fallbackImage = "./assets/svg/blocked.svg"
|
||||
}
|
||||
|
||||
let imgEl: HTMLImageElement
|
||||
</script>
|
||||
|
||||
|
||||
<div class="relative">
|
||||
<img bind:this={imgEl} src={image.url} on:error={(event) => {
|
||||
if(fallbackImage){
|
||||
imgEl.src = fallbackImage
|
||||
}
|
||||
}}>
|
||||
|
||||
<div class="absolute bottom-0 left-0">
|
||||
<ImageAttribution {image}/>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue