forked from MapComplete/MapComplete
Add style loading indicator, fix #1626
This commit is contained in:
parent
1f9cab7134
commit
57a6677149
3 changed files with 28 additions and 3 deletions
19
src/UI/Map/StyleLoadingIndicator.svelte
Normal file
19
src/UI/Map/StyleLoadingIndicator.svelte
Normal file
|
@ -0,0 +1,19 @@
|
|||
<script lang="ts">
|
||||
import Loading from "../Base/Loading.svelte"
|
||||
import { Stores, UIEventSource } from "../../Logic/UIEventSource"
|
||||
import { Map as MlMap } from "maplibre-gl"
|
||||
import { onDestroy } from "svelte"
|
||||
|
||||
let isLoading = false
|
||||
export let map: UIEventSource<MlMap>
|
||||
onDestroy(Stores.Chronic(250).addCallback(
|
||||
() => {
|
||||
isLoading = !map.data?.isStyleLoaded()
|
||||
},
|
||||
))
|
||||
</script>
|
||||
|
||||
|
||||
{#if isLoading}
|
||||
<Loading />
|
||||
{/if}
|
Loading…
Add table
Add a link
Reference in a new issue