From 8ed0a32d153d4a434602c86a85eaf02881f6d480 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 21 May 2023 23:27:01 +0200 Subject: [PATCH] Fix: addnewpoint-dialog works again --- UI/Map/RasterLayerOverview.svelte | 4 ++-- UI/Map/RasterLayerPicker.svelte | 10 +++++----- UI/Popup/AddNewPoint/AddNewPoint.svelte | 23 ++++++++++++++--------- UI/SpecialVisualization.ts | 3 +++ 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/UI/Map/RasterLayerOverview.svelte b/UI/Map/RasterLayerOverview.svelte index 5ffd43467..cc8e435de 100644 --- a/UI/Map/RasterLayerOverview.svelte +++ b/UI/Map/RasterLayerOverview.svelte @@ -45,8 +45,8 @@ visible.setData(false) } - function getPref(type: CategoryType): UIEventSource { - return userstate.osmConnection.GetPreference("preferred-layer-" + type) + function getPref(type: CategoryType): undefined | UIEventSource { + return userstate?.osmConnection?.GetPreference("preferred-layer-" + type) } diff --git a/UI/Map/RasterLayerPicker.svelte b/UI/Map/RasterLayerPicker.svelte index 01c6a6735..b8d11801a 100644 --- a/UI/Map/RasterLayerPicker.svelte +++ b/UI/Map/RasterLayerPicker.svelte @@ -17,7 +17,7 @@ let dispatch = createEventDispatcher<{appliedLayer}>() - export let favourite : UIEventSource = undefined + export let favourite : UIEventSource | undefined = undefined let rasterLayer = new UIEventSource(availableLayers.data?.[0]) @@ -39,11 +39,11 @@ } rasterLayer.setData(fav) })) - } - onDestroy(rasterLayer.addCallbackAndRunD(selected => { - favourite?.setData(selected.properties.id) - })) + onDestroy(rasterLayer.addCallbackAndRunD(selected => { + favourite?.setData(selected.properties.id) + })) + } let rasterLayerOnMap = UIEventSource.feedFrom(rasterLayer) diff --git a/UI/Popup/AddNewPoint/AddNewPoint.svelte b/UI/Popup/AddNewPoint/AddNewPoint.svelte index 9413fcd58..da8f4b9a2 100644 --- a/UI/Popup/AddNewPoint/AddNewPoint.svelte +++ b/UI/Popup/AddNewPoint/AddNewPoint.svelte @@ -31,7 +31,8 @@ import BackButton from "../../Base/BackButton.svelte"; import ToSvelte from "../../Base/ToSvelte.svelte"; import Svg from "../../../Svg"; - import RasterLayerOverview from "../../Map/RasterLayerOverview.svelte"; + import MapControlButton from "../../Base/MapControlButton.svelte"; + import {Square3Stack3dIcon} from "@babeard/svelte-heroicons/solid"; export let coordinate: { lon: number, lat: number }; export let state: SpecialVisualizationState; @@ -197,7 +198,8 @@ - @@ -263,11 +265,16 @@ {:else if !creating} -
+
- + +
+
+ state.guistate.backgroundLayerSelectionIsOpened.setData(true)}> + +
@@ -282,9 +289,7 @@
- - - + {:else} Creating point... {/if} diff --git a/UI/SpecialVisualization.ts b/UI/SpecialVisualization.ts index 4fcfc744c..6291247d3 100644 --- a/UI/SpecialVisualization.ts +++ b/UI/SpecialVisualization.ts @@ -14,6 +14,7 @@ import LayerConfig from "../Models/ThemeConfig/LayerConfig"; import FeatureSwitchState from "../Logic/State/FeatureSwitchState"; import { MenuState } from "../Models/MenuState"; import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader"; +import {RasterLayerPolygon} from "../Models/RasterLayers"; /** * The state needed to render a special Visualisation. @@ -69,6 +70,8 @@ export interface SpecialVisualizationState { readonly preferencesAsTags: Store> } readonly lastClickObject: WritableFeatureSource + + readonly availableLayers: Store } export interface SpecialVisualization {