|
8 | 8 | Control,
|
9 | 9 | ControlButton,
|
10 | 10 | ControlGroup,
|
| 11 | + ScaleControl, |
11 | 12 | } from "svelte-maplibre";
|
12 | 13 | import { contrastingColor } from "./colors.js";
|
13 | 14 | import { colorbrewer } from "./colorbrewer.js";
|
|
85 | 86 | cooperativeGestures?: boolean;
|
86 | 87 | standardControls?: boolean;
|
87 | 88 | navigationControl?: boolean;
|
88 |
| - navigationControlPosition?: string; |
| 89 | + navigationControlPosition?: maplibregl.ControlPosition; |
89 | 90 | geolocateControl?: boolean;
|
90 |
| - geolocateControlPosition?: string; |
| 91 | + geolocateControlPosition?: maplibregl.ControlPosition; |
91 | 92 | fullscreenControl?: boolean;
|
92 |
| - fullscreenControlPosition?: string; |
| 93 | + fullscreenControlPosition?: maplibregl.ControlPosition; |
93 | 94 | scaleControl?: boolean;
|
94 |
| - scaleControlPosition?: string; |
95 |
| - scaleControlUnit?: string; |
| 95 | + scaleControlPosition?: maplibregl.ControlPosition; |
| 96 | + scaleControlUnit?: "imperial" | "metric" | "nautical"; |
96 | 97 | styleSheet?: string | URL | object;
|
97 | 98 | colorPalette?: string;
|
98 | 99 | showBorder?: boolean;
|
|
214 | 215 | $inspect(cooperativeGestures);
|
215 | 216 | }
|
216 | 217 |
|
| 218 | + if (interactive) { |
| 219 | + map?.scrollZoom.enable(); |
| 220 | + map?.boxZoom.enable(); |
| 221 | + map?.dragRotate.enable(); |
| 222 | + map?.dragPan.enable(); |
| 223 | + map?.keyboard.enable(); |
| 224 | + map?.doubleClickZoom.enable(); |
| 225 | + map?.touchZoomRotate.enable(); |
| 226 | + } else { |
| 227 | + map?.scrollZoom.disable(); |
| 228 | + map?.boxZoom.disable(); |
| 229 | + map?.dragRotate.disable(); |
| 230 | + map?.dragPan.disable(); |
| 231 | + map?.keyboard.disable(); |
| 232 | + map?.doubleClickZoom.disable(); |
| 233 | + map?.touchZoomRotate.disable(); |
| 234 | + } |
| 235 | +
|
217 | 236 | map?.setMaxBounds(bounds);
|
218 | 237 | });
|
219 | 238 |
|
|
315 | 334 | standardControls={interactive && standardControls}
|
316 | 335 | {hash}
|
317 | 336 | {updateHash}
|
318 |
| - {interactive} |
319 | 337 | class="map"
|
320 | 338 | {onload}
|
321 | 339 | {onidle}
|
|
347 | 365 | </button>
|
348 | 366 | </ControlGroup>
|
349 | 367 | </Control>
|
| 368 | + {:else if !interactive} |
| 369 | + <ScaleControl position={scaleControlPosition} unit={scaleControlUnit} /> |
350 | 370 | {/if}
|
351 | 371 |
|
352 | 372 | <GeoJSON id="areas" data={merged} promoteId="areanm">
|
|
0 commit comments