From 6cb16877e8e27a70c1e1c327d965be1e0ab45788 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 17 Dec 2024 19:03:05 +0100 Subject: [PATCH 1/4] Fix: imagepreview: improve typing; fix comparison tool --- src/UI/Comparison/ComparisonTable.svelte | 2 +- src/UI/Image/AttributedImage.svelte | 11 +++++++---- src/UI/Image/ImageOperations.svelte | 2 +- src/UI/Image/ImagePreview.svelte | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/UI/Comparison/ComparisonTable.svelte b/src/UI/Comparison/ComparisonTable.svelte index d528f849c..ff6c7bfae 100644 --- a/src/UI/Comparison/ComparisonTable.svelte +++ b/src/UI/Comparison/ComparisonTable.svelte @@ -137,7 +137,7 @@ diff --git a/src/UI/Image/AttributedImage.svelte b/src/UI/Image/AttributedImage.svelte index e2c677386..851e4231d 100644 --- a/src/UI/Image/AttributedImage.svelte +++ b/src/UI/Image/AttributedImage.svelte @@ -28,7 +28,7 @@ export let imgClass: string = undefined export let state: SpecialVisualizationState = undefined export let attributionFormat: "minimal" | "medium" | "large" = "medium" - export let previewedImage: UIEventSource = undefined + export let previewedImage: UIEventSource> = undefined export let canZoom = previewedImage !== undefined let loaded = false let showBigPreview = new UIEventSource(false) @@ -37,13 +37,13 @@ if (!shown) { previewedImage?.set(undefined) } - }) + }), ) if (previewedImage) { onDestroy( previewedImage.addCallbackAndRun((previewedImage) => { - showBigPreview.set(previewedImage !== undefined && previewedImage?.id === image.id) - }) + showBigPreview.set(previewedImage !== undefined && (previewedImage?.id ?? previewedImage?.url) === (image.id ?? image.url)) + }), ) } @@ -89,6 +89,8 @@ /> + + {#if image.status !== undefined && image.status !== "ready" && image.status !== "hidden"}
@@ -113,6 +115,7 @@ class={imgClass ?? ""} class:cursor-zoom-in={canZoom} on:click={() => { + console.log("Setting",image.url) previewedImage?.set(image) }} on:error={() => { diff --git a/src/UI/Image/ImageOperations.svelte b/src/UI/Image/ImageOperations.svelte index 9a4df51fa..a27b53eda 100644 --- a/src/UI/Image/ImageOperations.svelte +++ b/src/UI/Image/ImageOperations.svelte @@ -15,7 +15,7 @@ import Translations from "../i18n/Translations" import DotMenu from "../Base/DotMenu.svelte" - export let image: ProvidedImage + export let image: Partial & ({ id: string, url: string }) export let clss: string = undefined let isLoaded = new UIEventSource(false) diff --git a/src/UI/Image/ImagePreview.svelte b/src/UI/Image/ImagePreview.svelte index bf966cfcf..0dabcebce 100644 --- a/src/UI/Image/ImagePreview.svelte +++ b/src/UI/Image/ImagePreview.svelte @@ -8,7 +8,7 @@ import Zoomcontrol from "../Zoomcontrol" import { onDestroy } from "svelte" - export let image: ProvidedImage + export let image: Partial let panzoomInstance = undefined let panzoomEl: HTMLElement export let isLoaded: UIEventSource = undefined From 375913492cf6da22389d27a2458e817fa5c19d37 Mon Sep 17 00:00:00 2001 From: Midgard Date: Wed, 18 Dec 2024 01:41:40 +0100 Subject: [PATCH 2/4] Fix: order of commands in npm run init ELI should be downloaded before generate, because it depends on that file. After clearing the generated assets directory, npm run init failed, this commit fixes that. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 23153a906..66eaba818 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ } }, "scripts": { - "init": "npm ci && npm run prep:layeroverview && npm run generate && npm run download:editor-layer-index && npm run generate:layouts && npm run clean", + "init": "npm ci && npm run prep:layeroverview && npm run download:editor-layer-index && npm run generate && npm run generate:layouts && npm run clean", "start": "npm run generate:layeroverview && npm run strt", "strt": "vite --host | sed 's/localhost:/127.0.0.1:/g'", "build": "./scripts/build.sh", From c88ffdae5513e57cdbaf702116714496d6fb3380 Mon Sep 17 00:00:00 2001 From: Midgard Date: Wed, 18 Dec 2024 02:12:00 +0100 Subject: [PATCH 3/4] Fix: remove checked-in file that is covered by .gitignore --- .../generated/editor-layer-index-global.json | 131 ------------------ 1 file changed, 131 deletions(-) delete mode 100644 src/assets/generated/editor-layer-index-global.json diff --git a/src/assets/generated/editor-layer-index-global.json b/src/assets/generated/editor-layer-index-global.json deleted file mode 100644 index f6818d833..000000000 --- a/src/assets/generated/editor-layer-index-global.json +++ /dev/null @@ -1,131 +0,0 @@ -[ - { - "name": "CyclOSM", - "id": "cyclosm", - "url": "https://{switch:a,b,c}.tile-cyclosm.openstreetmap.fr/cyclosm/{zoom}/{x}/{y}.png", - "attribution": { - "text": "Rendering: CyclOSM (hosted by OpenStreetMap France) © Map data OpenStreetMap contributors", - "url": "https://www.cyclosm.org/" - }, - "type": "tms", - "category": "osmbasedmap", - "max_zoom": 20 - }, - { - "name": "Esri World Imagery", - "id": "EsriWorldImagery", - "url": "https://{switch:services,server}.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}", - "attribution": { - "required": true, - "text": "Terms & Feedback", - "url": "https://wiki.openstreetmap.org/wiki/Esri" - }, - "type": "tms", - "category": "photo", - "max_zoom": 22, - "default": true - }, - { - "name": "Esri World Imagery (Clarity) Beta", - "id": "EsriWorldImageryClarity", - "url": "https://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}", - "attribution": { - "required": true, - "text": "Terms & Feedback", - "url": "https://wiki.openstreetmap.org/wiki/Esri" - }, - "type": "tms", - "category": "photo", - "max_zoom": 22, - "default": true - }, - { - "name": "Mapbox Satellite", - "id": "Mapbox", - "url": "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/mapbox.satellite/{zoom}/{x}/{y}.jpg?access_token=pk.eyJ1Ijoib3BlbnN0cmVldG1hcCIsImEiOiJjbGZkempiNDkyandvM3lwY3M4MndpdWdzIn0.QnvRv52n3qffVEKmQa9vJA", - "attribution": { - "required": true, - "text": "Terms & Feedback", - "url": "https://www.mapbox.com/about/maps" - }, - "type": "tms", - "category": "photo", - "max_zoom": 22, - "default": true - }, - { - "name": "OpenAerialMap Mosaic, by Kontur.io", - "id": "OpenAerialMapMosaic", - "url": "https://apps.kontur.io/raster-tiler/oam/mosaic/{zoom}/{x}/{y}.png", - "type": "tms", - "category": "photo", - "min_zoom": 1, - "max_zoom": 31, - "default": true - }, - { - "name": "OpenStreetMap (Basque Style)", - "id": "osmfr-basque", - "url": "https://tile.openstreetmap.bzh/eu/{zoom}/{x}/{y}.png", - "attribution": { - "required": true, - "text": "Tiles © OpenStreetMap France, data © OpenStreetMap contributors, ODbL", - "url": "https://www.openstreetmap.org/" - }, - "type": "tms", - "category": "osmbasedmap", - "max_zoom": 20 - }, - { - "name": "OpenStreetMap (Breton Style)", - "id": "osmfr-breton", - "url": "https://tile.openstreetmap.bzh/br/{zoom}/{x}/{y}.png", - "attribution": { - "required": true, - "text": "Tiles © OpenStreetMap France, data © OpenStreetMap contributors, ODbL", - "url": "https://www.openstreetmap.org/" - }, - "type": "tms", - "category": "osmbasedmap", - "max_zoom": 20 - }, - { - "name": "OpenStreetMap (French Style)", - "id": "osmfr", - "url": "https://{switch:a,b,c}.tile.openstreetmap.fr/osmfr/{zoom}/{x}/{y}.png", - "attribution": { - "required": true, - "text": "Tiles © cquest@Openstreetmap France, data © OpenStreetMap contributors, ODBL", - "url": "https://www.openstreetmap.org/" - }, - "type": "tms", - "category": "osmbasedmap", - "max_zoom": 20 - }, - { - "name": "OpenStreetMap (HOT Style)", - "id": "HDM_HOT", - "url": "https://{switch:a,b,c}.tile.openstreetmap.fr/hot/{zoom}/{x}/{y}.png", - "attribution": { - "required": true, - "text": "© OpenStreetMap contributors, tiles courtesy of Humanitarian OpenStreetMap Team", - "url": "https://www.hotosm.org/" - }, - "type": "tms", - "category": "osmbasedmap", - "max_zoom": 20 - }, - { - "name": "OpenStreetMap (Occitan Style)", - "id": "osmfr-occitan", - "url": "https://tile.openstreetmap.bzh/oc/{zoom}/{x}/{y}.png", - "attribution": { - "required": true, - "text": "Tiles © OpenStreetMap France, data © OpenStreetMap contributors, ODbL", - "url": "https://www.openstreetmap.org/" - }, - "type": "tms", - "category": "osmbasedmap", - "max_zoom": 20 - } -] \ No newline at end of file From 8c1a73c9d50824b668dd0a31b435bbed2b15ffc1 Mon Sep 17 00:00:00 2001 From: Midgard Date: Wed, 18 Dec 2024 02:12:58 +0100 Subject: [PATCH 4/4] Fix: deduplicate .gitignore and reorder --- .gitignore | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 715afe780..eeb8ce127 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,10 @@ node_modules .cache/* .idea/* scratch +src/assets/editor-layer-index.json +src/assets/generated/ assets/editor-layer-index.json assets/generated/* -src/assets/generated/ assets/layers/favourite/favourite.json public/*.webmanifest /*.html @@ -20,8 +21,6 @@ missing_translations.txt .DS_Store Svg.ts data/ -src/assets/generated/nsi_stats/brand.json -src/assets/generated/nsi_stats/brand.summarized.json Folder.DotSettings.user index_*.ts @@ -29,7 +28,6 @@ index_*.ts *.doctest.ts service-worker.js .env -src/assets/editor-layer-index.json error_changeset_*