From 94744aba3af9a01f0c0ebb5cd169b0930ff84284 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Fri, 9 Aug 2024 15:12:33 +0100 Subject: [PATCH] Stop redrawing the network layer constantly. #13 --- web/src/App.svelte | 13 ++++++------- web/src/DebugMode.svelte | 2 ++ web/src/NetworkLayer.svelte | 4 ++++ web/src/RouteMode.svelte | 5 ----- web/src/ScoreMode.svelte | 6 ------ 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/web/src/App.svelte b/web/src/App.svelte index b5d9083..742ecb7 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -12,6 +12,7 @@ import DebugMode from "./DebugMode.svelte"; import RouteMode from "./RouteMode.svelte"; import ScoreMode from "./ScoreMode.svelte"; + import NetworkLayer from "./NetworkLayer.svelte"; import { map as mapStore, mode, @@ -144,15 +145,13 @@ + + + {#if $mode.kind == "route"} - + {:else if $mode.kind == "score"} - + {:else if $mode.kind == "debug"} {/if} diff --git a/web/src/DebugMode.svelte b/web/src/DebugMode.svelte index 693d89e..59e5566 100644 --- a/web/src/DebugMode.svelte +++ b/web/src/DebugMode.svelte @@ -7,6 +7,8 @@ import { model } from "./stores"; import NavBar from "./NavBar.svelte"; + // TODO Could try to reuse NetworkLayer and add in the interactivity + export let showSeverances: boolean; export let opacity: number; diff --git a/web/src/NetworkLayer.svelte b/web/src/NetworkLayer.svelte index d0516b0..f782941 100644 --- a/web/src/NetworkLayer.svelte +++ b/web/src/NetworkLayer.svelte @@ -5,6 +5,7 @@ import { constructMatchExpression } from "svelte-utils/map"; import { model } from "./stores"; + export let show: boolean; // TODO Use filter expressions? export let showSeverances: boolean; export let opacity: number; @@ -14,6 +15,9 @@ - - A B {#if route_gj} diff --git a/web/src/ScoreMode.svelte b/web/src/ScoreMode.svelte index 649fd5c..4b4735f 100644 --- a/web/src/ScoreMode.svelte +++ b/web/src/ScoreMode.svelte @@ -10,14 +10,10 @@ type LayerClickInfo, } from "svelte-maplibre"; import { colorScale, limits } from "./colors"; - import NetworkLayer from "./NetworkLayer.svelte"; import { SplitComponent } from "svelte-utils/top_bar_layout"; import { map, model, mode, minScore, maxScore } from "./stores"; import NavBar from "./NavBar.svelte"; - export let showSeverances: boolean; - export let opacity: number; - let scoreGj: FeatureCollection = JSON.parse( $model!.makeHeatmap(), ); @@ -119,8 +115,6 @@
- -