Continue messing with stores

This commit is contained in:
ThePetrovich 2025-06-27 19:27:19 +08:00
parent c7df38e6ce
commit 52558ed3b2
7 changed files with 148 additions and 83 deletions

View file

@ -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>