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 { Store, UIEventSource } from "../../Logic/UIEventSource"
|
||||||
import { Map as MlMap } from "maplibre-gl"
|
import { Map as MlMap } from "maplibre-gl"
|
||||||
import { createEventDispatcher, onDestroy } from "svelte"
|
import { createEventDispatcher, onDestroy } from "svelte"
|
||||||
import StyleLoadingIndicator from "./StyleLoadingIndicator.svelte"
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Chooses a background-layer out of available options
|
* Chooses a background-layer out of available options
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
|
|
||||||
let isLoading = false
|
let isLoading = false
|
||||||
export let map: UIEventSource<MlMap>
|
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
|
export let rasterLayer: UIEventSource<any> = undefined
|
||||||
|
|
||||||
let didChange = undefined
|
let didChange = undefined
|
||||||
|
@ -16,7 +19,7 @@
|
||||||
onDestroy(Stores.Chronic(250).addCallback(
|
onDestroy(Stores.Chronic(250).addCallback(
|
||||||
() => {
|
() => {
|
||||||
const mapIsLoading = !map.data?.isStyleLoaded()
|
const mapIsLoading = !map.data?.isStyleLoaded()
|
||||||
isLoading = mapIsLoading && didChange
|
isLoading = mapIsLoading && (didChange || rasterLayer === undefined)
|
||||||
if(didChange && !mapIsLoading){
|
if(didChange && !mapIsLoading){
|
||||||
didChange = false
|
didChange = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue