Skip to content

Commit

Permalink
Toggle basemap (though it seems to lose the rendered thing before
Browse files Browse the repository at this point in the history
clicking another button)
  • Loading branch information
dabreegster committed Dec 24, 2023
1 parent c810a62 commit 12ac548
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions web/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import { mapContents, sidebarContents } from "./stores";
import ViewShortcutsMode from "./ViewShortcutsMode.svelte";
let offlineMode = true;
let mapStyle = offlineMode
? {
let showBasemap = false;
$: mapStyle = showBasemap
? "https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo"
: {
version: 8,
sources: {},
layers: [],
}
: "https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo";
};
type Mode =
| {
Expand Down Expand Up @@ -85,6 +85,12 @@
<MapLoader {map} bind:app />
{/if}
<div><button on:click={zoomToFit}>Zoom to fit</button></div>
<div>
<label
><input type="checkbox" bind:checked={showBasemap} />Show basemap</label
>
</div>
<hr />

<div bind:this={sidebarDiv} />
</div>
Expand All @@ -101,7 +107,7 @@
{map}
{app}
boundary={mode.boundary}
{offlineMode}
{showBasemap}
bind:mode
/>
{:else if mode.mode == "view-shortcuts"}
Expand Down
4 changes: 2 additions & 2 deletions web/src/NeighbourhoodMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
export let map: Map;
export let app: LTN;
export let boundary: Feature<Polygon>;
export let offlineMode: boolean;
export let showBasemap: boolean;
let addingFilter = false;
let undoLength = 0;
Expand Down Expand Up @@ -166,7 +166,7 @@
<div slot="map">
<GeoJSON data={details} generateId>
<FillLayer
beforeId={offlineMode ? undefined : "Building"}
beforeId={showBasemap ? "Building" : undefined}
filter={isPolygon}
manageHoverState
paint={{
Expand Down

0 comments on commit 12ac548

Please sign in to comment.