forked from MapComplete/MapComplete
UX: add zoom-cursor to clickable images
This commit is contained in:
parent
f95a1a8039
commit
6205da9d41
3 changed files with 17 additions and 6 deletions
|
@ -1356,6 +1356,10 @@ video {
|
||||||
cursor: wait;
|
cursor: wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cursor-zoom-in {
|
||||||
|
cursor: zoom-in;
|
||||||
|
}
|
||||||
|
|
||||||
.resize {
|
.resize {
|
||||||
resize: both;
|
resize: both;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,17 +14,24 @@ import AttributedImage from "./AttributedImage.svelte"
|
||||||
|
|
||||||
export class ImageCarousel extends Toggle {
|
export class ImageCarousel extends Toggle {
|
||||||
constructor(
|
constructor(
|
||||||
images: Store<{ id:string, key: string; url: string; provider: ImageProvider }[]>,
|
images: Store<{ id: string; key: string; url: string; provider: ImageProvider }[]>,
|
||||||
tags: Store<any>,
|
tags: Store<any>,
|
||||||
state: { osmConnection?: OsmConnection; changes?: Changes; layout: LayoutConfig, previewedImage?: UIEventSource<ProvidedImage> },
|
state: {
|
||||||
|
osmConnection?: OsmConnection
|
||||||
|
changes?: Changes
|
||||||
|
layout: LayoutConfig
|
||||||
|
previewedImage?: UIEventSource<ProvidedImage>
|
||||||
|
},
|
||||||
feature: Feature
|
feature: Feature
|
||||||
) {
|
) {
|
||||||
const uiElements = images.map(
|
const uiElements = images.map(
|
||||||
(imageURLS: { key: string; url: string; provider: ImageProvider, id: string }[]) => {
|
(imageURLS: { key: string; url: string; provider: ImageProvider; id: string }[]) => {
|
||||||
const uiElements: BaseUIElement[] = []
|
const uiElements: BaseUIElement[] = []
|
||||||
for (const url of imageURLS) {
|
for (const url of imageURLS) {
|
||||||
try {
|
try {
|
||||||
let image: BaseUIElement = new SvelteUIElement(AttributedImage, {image: url})
|
let image: BaseUIElement = new SvelteUIElement(AttributedImage, {
|
||||||
|
image: url,
|
||||||
|
})
|
||||||
|
|
||||||
if (url.key !== undefined) {
|
if (url.key !== undefined) {
|
||||||
image = new Combine([
|
image = new Combine([
|
||||||
|
@ -35,7 +42,7 @@ export class ImageCarousel extends Toggle {
|
||||||
]).SetClass("relative")
|
]).SetClass("relative")
|
||||||
}
|
}
|
||||||
image
|
image
|
||||||
.SetClass("w-full block")
|
.SetClass("w-full block cursor-zoom-in")
|
||||||
.SetStyle("min-width: 50px; background: grey;")
|
.SetStyle("min-width: 50px; background: grey;")
|
||||||
.onClick(() => state.previewedImage.setData(url))
|
.onClick(() => state.previewedImage.setData(url))
|
||||||
uiElements.push(image)
|
uiElements.push(image)
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex w-fit shrink-0 flex-col">
|
<div class="flex w-fit shrink-0 flex-col">
|
||||||
<div on:click={() => state.previewedImage.setData(providedImage)}>
|
<div on:click={() => state.previewedImage.setData(providedImage)} class="cursor-zoom-in">
|
||||||
<AttributedImage image={providedImage} imgClass="max-h-64 w-auto"/>
|
<AttributedImage image={providedImage} imgClass="max-h-64 w-auto"/>
|
||||||
</div>
|
</div>
|
||||||
{#if linkable}
|
{#if linkable}
|
||||||
|
|
Loading…
Add table
Reference in a new issue