Continue messing with stores
This commit is contained in:
parent
c7df38e6ce
commit
52558ed3b2
7 changed files with 148 additions and 83 deletions
|
|
@ -3,24 +3,29 @@
|
|||
import ControlPanel from '../ControlPanel.svelte';
|
||||
import Navbar from '../Navbar.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { latestPredictionParsed } from '$lib/stores';
|
||||
import { PredictionStore } from '$lib/stores';
|
||||
import { Modal } from '@sveltestrap/sveltestrap';
|
||||
import L from 'leaflet';
|
||||
|
||||
let map: { plotData?: (prediction: any) => void } | null = null;
|
||||
|
||||
let map: Map | null = null;
|
||||
let panel: ControlPanel | null = null;
|
||||
|
||||
onMount(() => {
|
||||
latestPredictionParsed.subscribe((prediction) => {
|
||||
if (prediction && map) {
|
||||
map.plotData?.(prediction);
|
||||
PredictionStore.subscribe((data) => {
|
||||
if (data) {
|
||||
map?.clearMapLayers();
|
||||
}
|
||||
});
|
||||
|
||||
L.DomEvent.disableClickPropagation(panel?.$element);
|
||||
L.DomEvent.disableScrollPropagation(panel?.$element);
|
||||
});
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<Navbar />
|
||||
<Map bind:this={map} mode="prediction">
|
||||
<ControlPanel
|
||||
/>
|
||||
<Map bind:this={map} mode="prediction" bind:data={$PredictionStore}>
|
||||
<ControlPanel bind:this={panel} />
|
||||
</Map>
|
||||
</main>
|
||||
Loading…
Add table
Add a link
Reference in a new issue