From dbff95309642178dcccb4a0a365a263c722c5a96 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 2 Sep 2024 03:39:40 +0200 Subject: [PATCH] Fix: use proper selected element --- src/UI/ThemeViewGUI.svelte | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte index fbf5a24ad..ec2bedf4c 100644 --- a/src/UI/ThemeViewGUI.svelte +++ b/src/UI/ThemeViewGUI.svelte @@ -14,7 +14,7 @@ import Geosearch from "./BigComponents/Geosearch.svelte" import Translations from "./i18n/Translations" import { - MenuIcon + MenuIcon, } from "@rgossiaux/svelte-heroicons/solid" import Tr from "./Base/Tr.svelte" import FloatOver from "./Base/FloatOver.svelte" @@ -46,10 +46,12 @@ import SelectedElementPanel from "./Base/SelectedElementPanel.svelte" import MenuDrawer from "./BigComponents/MenuDrawer.svelte" import DrawerLeft from "./Base/DrawerLeft.svelte" + import Hash from "../Logic/Web/Hash" export let state: ThemeViewState let layout = state.layout let maplibremap: UIEventSource = state.map + let state_selectedElement = state.selectedElement let selectedElement: UIEventSource = new UIEventSource(undefined) let compass = Orientation.singleton.alpha let compassLoaded = Orientation.singleton.gotMeasurement @@ -71,6 +73,7 @@ }) }) + let selectedLayer: Store = state.selectedElement.mapD((element) => { const id = element.properties.id if (id.startsWith("current_view")) { @@ -97,11 +100,11 @@ state.mapProperties.installCustomKeyboardHandler(viewport) let canZoomIn = mapproperties.maxzoom.map( (mz) => mapproperties.zoom.data < mz, - [mapproperties.zoom] + [mapproperties.zoom], ) let canZoomOut = mapproperties.minzoom.map( (mz) => mapproperties.zoom.data > mz, - [mapproperties.zoom] + [mapproperties.zoom], ) function updateViewport() { @@ -117,7 +120,7 @@ const bottomRight = mlmap.unproject([rect.right, rect.bottom]) const bbox = new BBox([ [topLeft.lng, topLeft.lat], - [bottomRight.lng, bottomRight.lat] + [bottomRight.lng, bottomRight.lat], ]) state.visualFeedbackViewportBounds.setData(bbox) } @@ -137,7 +140,7 @@ onDestroy( rasterLayer.addCallbackAndRunD((l) => { rasterLayerName = l.properties.name - }) + }), ) let previewedImage = state.previewedImage let addNewFeatureMode = state.userRelatedState.addNewFeatureMode @@ -166,6 +169,7 @@ animation?.cameraAnimation(mlmap) } + let hash = Hash.hash
@@ -217,6 +221,11 @@ + {#if $debug && $hash} +
+ {$hash} +
+ {/if}
@@ -415,11 +424,11 @@ { - selectedElement.setData(undefined) + state.selectedElement.setData(undefined) }} >
- + {/if} @@ -433,7 +442,7 @@ }} > - + {:else} - + {/if} {/if}