Fix style loading indicator
This commit is contained in:
parent
2fd36242e9
commit
573a2e0045
2 changed files with 4 additions and 2 deletions
|
@ -5,7 +5,6 @@
|
|||
import { Store, UIEventSource } from "../../Logic/UIEventSource"
|
||||
import { Map as MlMap } from "maplibre-gl"
|
||||
import { createEventDispatcher, onDestroy } from "svelte"
|
||||
import StyleLoadingIndicator from "./StyleLoadingIndicator.svelte"
|
||||
|
||||
/***
|
||||
* Chooses a background-layer out of available options
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
let isLoading = false
|
||||
export let map: UIEventSource<MlMap>
|
||||
/**
|
||||
* Optional. Only used for the 'global' change indicator so that it won't spin on pan/zoom but only when a change _actually_ occured
|
||||
*/
|
||||
export let rasterLayer: UIEventSource<any> = undefined
|
||||
|
||||
let didChange = undefined
|
||||
|
@ -16,7 +19,7 @@
|
|||
onDestroy(Stores.Chronic(250).addCallback(
|
||||
() => {
|
||||
const mapIsLoading = !map.data?.isStyleLoaded()
|
||||
isLoading = mapIsLoading && didChange
|
||||
isLoading = mapIsLoading && (didChange || rasterLayer === undefined)
|
||||
if(didChange && !mapIsLoading){
|
||||
didChange = false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue