@swr-data-lab/components 2.35.0 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { createMapContext, MapContext } from '../context.svelte.js';
4
4
  import {} from '../types';
5
5
  import FallbackStyle from './FallbackStyle';
6
6
  import { de } from './locale';
7
- let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowRotation = false, allowZoom = true, showDebug = false, cursor, initialBounds, maxBounds, initialLocation: receivedInitialLocation,
7
+ let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowPan = true, allowRotation = false, allowZoom = true, showDebug = false, cursor, initialBounds, maxBounds, initialLocation: receivedInitialLocation,
8
8
  // Future: This should become bindable.readonly when that becomes
9
9
  // available, see: https://github.com/sveltejs/svelte/issues/7712
10
10
  mapContext = $bindable(), cooperativeGestures = false, onmoveend, onmovestart } = $props();
@@ -84,7 +84,15 @@ $effect(() => {
84
84
  mapContext.map?.scrollZoom.enable();
85
85
  }
86
86
  });
87
- const debugValues = $derived(Object.entries({ zoom, pitch, allowZoom, allowRotation }));
87
+ $effect(() => {
88
+ if (allowPan === false) {
89
+ mapContext.map?.dragPan.disable();
90
+ }
91
+ else {
92
+ mapContext.map?.dragPan.enable();
93
+ }
94
+ });
95
+ const debugValues = $derived(Object.entries({ zoom, pitch, allowZoom, allowPan, allowRotation }));
88
96
  const handleDebugValueClick = (e) => {
89
97
  if (e.target) {
90
98
  const t = e.target;
@@ -177,16 +185,16 @@ const handleDebugCopyLocationClick = (e) => {
177
185
  height: 100%;
178
186
  width: 100%;
179
187
  }
180
- :global(.maplibregl-canvas-container.maplibregl-interactive) {
188
+ :global(.maplibregl-canvas-container.maplibregl-touch-drag-pan) {
181
189
  cursor: grab;
182
190
  user-select: none;
183
191
  }
192
+ :global(.maplibregl-canvas-container.maplibregl-touch-drag-pan:active) {
193
+ cursor: grabbing;
194
+ }
184
195
  :global(.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer) {
185
196
  cursor: pointer;
186
197
  }
187
- :global(.maplibregl-canvas-container.maplibregl-interactive:active) {
188
- cursor: grabbing;
189
- }
190
198
  :global(.maplibregl-canvas-container.maplibregl-touch-zoom-rotate),
191
199
  :global(.maplibregl-canvas-container.maplibregl-touch-zoom-rotate) :global(.maplibregl-canvas) {
192
200
  touch-action: pan-x pan-y;
@@ -10,6 +10,7 @@ interface MapProps {
10
10
  initialBounds?: LngLatBoundsLike;
11
11
  maxBounds?: LngLatBoundsLike;
12
12
  initialLocation?: Location;
13
+ allowPan?: boolean;
13
14
  allowRotation?: boolean;
14
15
  allowZoom?: boolean;
15
16
  minZoom?: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swr-data-lab/components",
3
3
  "description": "SWR Data Lab component library",
4
- "version": "2.35.0",
4
+ "version": "2.36.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  "@storybook/test-runner": "^0.24.2",
50
50
  "@sveltejs/adapter-auto": "7.0.0",
51
51
  "@sveltejs/enhanced-img": "0.9.2",
52
- "@sveltejs/kit": "2.49.2",
52
+ "@sveltejs/kit": "2.49.5",
53
53
  "@sveltejs/package": "2.5.7",
54
54
  "@sveltejs/vite-plugin-svelte": "6.2.1",
55
55
  "@types/geojson": "7946.0.16",