Skip to content

Commit 9a3fcce

Browse files
committed
Fix min and max zoom and updates to geoSource
1 parent c1e5e89 commit 9a3fcce

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/lib/components/data-vis/map/Map.svelte

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
setMaxBounds = false,
8282
onload,
8383
onidle,
84-
geoSouce,
84+
geoSource = "file",
8585
}: {
8686
data: object[];
8787
customPalette?: object[];
@@ -125,7 +125,7 @@
125125
interactive?: boolean;
126126
onload?: (map: maplibregl.Map) => void;
127127
onidle?: (e: maplibregl.MapLibreEvent) => void;
128-
geosouce: String;
128+
geoSource: "file" | "tiles" | "none";
129129
} = $props();
130130
131131
let styleLookup = {
@@ -245,6 +245,9 @@
245245
}
246246
247247
map?.setMaxBounds(bounds);
248+
249+
map?.setMaxZoom(maxZoom);
250+
map?.setMinZoom(minZoom);
248251
});
249252
250253
let vals = $derived(
@@ -340,8 +343,6 @@
340343
{style}
341344
{center}
342345
{zoom}
343-
{maxZoom}
344-
{minZoom}
345346
standardControls={interactive && standardControls}
346347
{hash}
347348
{updateHash}
@@ -379,7 +380,7 @@
379380
{:else if !interactive}
380381
<ScaleControl position={scaleControlPosition} unit={scaleControlUnit} />
381382
{/if}
382-
{#if geoSouce == "file"}
383+
{#if geoSource == "file"}
383384
<GeoJSON id="areas" data={merged} promoteId="areanm">
384385
<FillLayer
385386
paint={{
@@ -416,13 +417,11 @@
416417
/>
417418
{/if}
418419
</GeoJSON>
419-
{:else if geoSouce == "tiles"}
420+
{:else if geoSource == "tiles"}
420421
<VectorTileSource
421422
id={"lsoas"}
422423
promoteId={"LSOA21NM"}
423424
tiles={["http://localhost:8080/{z}/{x}/{y}.pbf"]}
424-
minzoom={6}
425-
maxzoom={14}
426425
>
427426
<FillLayer
428427
paint={{

src/wrappers/components/data-vis/map/MapWrapper.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@
434434
options: ["cauth", "ctry", "cty", "ltla", "mcty", "rgn", "uk", "utla"],
435435
},
436436
{
437-
name: "geoSouce",
437+
name: "geoSource",
438438
isProp: true,
439439
description: "Tiles or maps",
440440
category: "Data",

0 commit comments

Comments
 (0)