UI: direction picker now uses the general background layer as well

This commit is contained in:
Pieter Vander Vennet 2024-09-24 16:41:00 +02:00
parent 83a8d35c97
commit 644552b88d
2 changed files with 6 additions and 0 deletions

View file

@ -5,11 +5,14 @@
import { MapLibreAdaptor } from "../../Map/MapLibreAdaptor" import { MapLibreAdaptor } from "../../Map/MapLibreAdaptor"
import MaplibreMap from "../../Map/MaplibreMap.svelte" import MaplibreMap from "../../Map/MaplibreMap.svelte"
import Direction_stroke from "../../../assets/svg/Direction_stroke.svelte" import Direction_stroke from "../../../assets/svg/Direction_stroke.svelte"
import type { SpecialVisualizationState } from "../../SpecialVisualization"
/** /**
* A visualisation to pick a direction on a map background. * A visualisation to pick a direction on a map background.
*/ */
export let value: UIEventSource<undefined | string> export let value: UIEventSource<undefined | string>
export let state: SpecialVisualizationState = undefined
export let mapProperties: Partial<MapProperties> & { export let mapProperties: Partial<MapProperties> & {
readonly location: UIEventSource<{ lon: number; lat: number }> readonly location: UIEventSource<{ lon: number; lat: number }>
} }
@ -17,6 +20,8 @@
let mla = new MapLibreAdaptor(map, mapProperties) let mla = new MapLibreAdaptor(map, mapProperties)
mla.allowMoving.setData(false) mla.allowMoving.setData(false)
mla.allowZooming.setData(false) mla.allowZooming.setData(false)
state?.mapProperties?.rasterLayer?.addCallbackAndRunD(l => mla.rasterLayer.set(l))
let directionElem: HTMLElement | undefined let directionElem: HTMLElement | undefined
$: value.addCallbackAndRunD((degrees) => { $: value.addCallbackAndRunD((degrees) => {
if (directionElem === undefined) { if (directionElem === undefined) {

View file

@ -33,6 +33,7 @@
{:else if type === "direction"} {:else if type === "direction"}
<DirectionInput <DirectionInput
{value} {value}
{state}
mapProperties={InputHelpers.constructMapProperties({ feature, args: args ?? [] })} mapProperties={InputHelpers.constructMapProperties({ feature, args: args ?? [] })}
/> />
{:else if type === "date"} {:else if type === "date"}