Skip to content

Commit

Permalink
Consolidate 3 layer-like controls
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Jul 25, 2023
1 parent 62dccac commit 5b45162
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 61 deletions.
90 changes: 39 additions & 51 deletions src/lib/Legend.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,42 @@
export let schema: Schema;
</script>

<div>
<CollapsibleCard label="Objects" open>
<ul>
{#if schema == "planning"}
<li>
<ColorLegend color={colors.preapp} />
Preapp
</li>
<li>
<ColorLegend color={colors.outline} />
Outline
</li>
<li>
<ColorLegend color={colors["reserved matters"]} />
Reserved matters
</li>
<li>
<ColorLegend color={colors["local plan"]} />
Local plan
</li>
{:else}
<li>
<ColorLegend color={colors.area} />
Areas
</li>
<li>
<ColorLegend color={colors.route} />
Routes
</li>
<li>
<ColorLegend color={colors.crossing} />
Crossings
</li>
<li>
<ColorLegend color={colors.other} />
Other
</li>
{/if}
</ul>
</CollapsibleCard>
</div>

<style>
div {
position: absolute;
left: 10px;
top: 60px;
background-color: white;
padding: 16px;
}
</style>
<CollapsibleCard label="Legend">
<ul>
{#if schema == "planning"}
<li>
<ColorLegend color={colors.preapp} />
Preapp
</li>
<li>
<ColorLegend color={colors.outline} />
Outline
</li>
<li>
<ColorLegend color={colors["reserved matters"]} />
Reserved matters
</li>
<li>
<ColorLegend color={colors["local plan"]} />
Local plan
</li>
{:else}
<li>
<ColorLegend color={colors.area} />
Areas
</li>
<li>
<ColorLegend color={colors.route} />
Routes
</li>
<li>
<ColorLegend color={colors.crossing} />
Crossings
</li>
<li>
<ColorLegend color={colors.other} />
Other
</li>
{/if}
</ul>
</CollapsibleCard>
22 changes: 14 additions & 8 deletions src/pages/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import { onMount } from "svelte";
import authoritiesUrl from "../../assets/authorities.geojson?url";
import BoundaryLayer from "../lib/BoundaryLayer.svelte";
import { BaselayerSwitcher, Layout, ZoomOutMap } from "../lib/common";
import {
BaselayerSwitcher,
CollapsibleCard,
Layout,
ZoomOutMap,
} from "../lib/common";
import HoverLayer from "../lib/draw/HoverLayer.svelte";
import InterventionLayer from "../lib/draw/InterventionLayer.svelte";
import Toolbox from "../lib/draw/Toolbox.svelte";
Expand Down Expand Up @@ -111,19 +116,20 @@
<EntireScheme {authorityName} {schema} />
<hr />
<InterventionList {schema} />
<hr />
<ContextualLayers />
</div>
<div slot="main">
<Map {style}>
<BoundaryLayer {boundaryGeojson} />
<InterventionLayer {schema} />
<HoverLayer />
<Toolbox {routeSnapperUrl} {schema} />
<div class="bottom-left">
<BaselayerSwitcher {style} />
<div class="top-left">
<CollapsibleCard label="Layers">
<Legend {schema} />
<BaselayerSwitcher {style} />
<ContextualLayers />
</CollapsibleCard>
</div>
<Legend {schema} />
</Map>
</div>
</Layout>
Expand All @@ -132,10 +138,10 @@
<Instructions bind:open={showInstructions} {schema} />

<style>
.bottom-left {
.top-left {
position: absolute;
left: 10px;
bottom: 50px;
top: 60px;
background-color: white;
padding: 16px;
}
Expand Down
2 changes: 0 additions & 2 deletions src/pages/BrowseSchemes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import PmTiles from "../lib/common/PmTiles.svelte";
import InterventionLayer from "../lib/draw/InterventionLayer.svelte";
import { CheckboxGroup, ErrorMessage, SecondaryButton } from "../lib/govuk";
import Legend from "../lib/Legend.svelte";
import MapLibreMap from "../lib/Map.svelte";
import { bbox, emptyGeojson, prettyPrintMeters } from "../maplibre_helpers";
import { gjScheme, map } from "../stores";
Expand Down Expand Up @@ -100,7 +99,6 @@
<PmTiles />
<MapLibreMap {style}>
<InterventionLayer {schema} />
<Legend {schema} />
<MapTooltips
layers={[
"interventions-points",
Expand Down

0 comments on commit 5b45162

Please sign in to comment.