MapComplete/src/UI/Map/DynamicIcon.svelte

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

30 lines
886 B
Svelte
Raw Normal View History

<script lang="ts">
2023-12-19 22:08:00 +01:00
import { IconConfig } from "../../Models/ThemeConfig/PointRenderingConfig"
import { Store } from "../../Logic/UIEventSource"
import Icon from "./Icon.svelte"
import { Utils } from "../../Utils"
/**
* Renders a single icon.
*
* Icons -placed on top of each other- form a 'Marker' together
*/
2023-11-09 16:30:26 +01:00
export let icon: IconConfig
export let tags: Store<Record<string, string>>
/**
* Only used in case of emoji
*/
export let emojiHeight: number = 40
2023-11-11 11:33:29 +01:00
let iconItem = icon.icon?.GetRenderValue($tags)?.Subs($tags)?.txt
$: iconItem = icon.icon?.GetRenderValue($tags)?.Subs($tags)?.txt
let color = icon.color?.GetRenderValue($tags)?.txt ?? "#000000"
2023-11-09 16:30:26 +01:00
$: color = icon.color?.GetRenderValue($tags)?.txt ?? "#000000"
</script>
{#if iconItem?.startsWith("<")}
{@html iconItem}
{:else}
<Icon icon={iconItem} {color} {emojiHeight} />
{/if}