MapComplete/src/UI/Map/DynamicMarker.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
1.1 KiB
Svelte
Raw Normal View History

<script lang="ts">
2023-12-01 15:23:28 +01:00
import { IconConfig } from "../../Models/ThemeConfig/PointRenderingConfig"
import { ImmutableStore, Store } from "../../Logic/UIEventSource"
import DynamicIcon from "./DynamicIcon.svelte"
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
import { Orientation } from "../../Sensors/Orientation"
/**
* Renders a 'marker', which consists of multiple 'icons'
*/
export let marker: IconConfig[]
2023-12-01 15:23:28 +01:00
export let tags: Store<Record<string, string>>
2023-12-19 22:08:00 +01:00
export let rotation: TagRenderingConfig = undefined
let _rotation: Store<string> = rotation
2023-12-01 15:23:28 +01:00
? tags.map((tags) => rotation.GetRenderValue(tags).Subs(tags).txt)
: new ImmutableStore("0deg")
2023-12-30 15:24:30 +01:00
if (rotation?.render?.txt === "{alpha}deg") {
_rotation = Orientation.singleton.alpha.map((alpha) => (alpha ? alpha + "deg" : "0deg "))
}
</script>
2023-11-09 16:30:26 +01:00
{#if marker && marker}
<div class="relative h-full w-full" style={`transform: rotate(${$_rotation})`}>
{#each marker as icon}
2023-11-22 19:39:19 +01:00
<div class="absolute top-0 left-0 h-full w-full">
<DynamicIcon {icon} {tags} />
</div>
{/each}
</div>
{/if}