diff --git a/components/src/Switcher/Switcher.stories.svelte b/components/src/Switcher/Switcher.stories.svelte
index 64c85962..c7a6a7ae 100644
--- a/components/src/Switcher/Switcher.stories.svelte
+++ b/components/src/Switcher/Switcher.stories.svelte
@@ -62,7 +62,6 @@
asChild
play={async ({ canvasElement, step }) => {
const canvas = within(canvasElement);
- console.log(canvas);
await step('Options are displayed in a row', async () => {
const list = canvas.getByRole('list');
expect(list.classList).toContain('layout-row');
@@ -84,7 +83,6 @@
asChild
play={async ({ canvasElement, step }) => {
const canvas = within(canvasElement);
- console.log(canvas);
await step('Options are displayed in a row', async () => {
const list = canvas.getByRole('list');
expect(list.classList).toContain('layout-column');
diff --git a/components/src/maplibre/Map/Map.svelte b/components/src/maplibre/Map/Map.svelte
index 4b2fbef8..4c1c534b 100644
--- a/components/src/maplibre/Map/Map.svelte
+++ b/components/src/maplibre/Map/Map.svelte
@@ -5,9 +5,12 @@
type ProjectionSpecification,
type StyleSpecification
} from 'maplibre-gl';
+
+ import { type Location } from '../types';
+
import { onMount, onDestroy, type Snippet, getContext, hasContext } from 'svelte';
+
import { createMapContext, MapContext } from '../context.svelte.js';
- import { type Location } from '../types';
import FallbackStyle from './FallbackStyle';
import { de } from './locale';
@@ -33,7 +36,7 @@
showDebug?: boolean;
options?: any;
/**
- * Set the mouse cursor. `""` (empty string) restores Maplibre's default behaviour. See VectorLayer/Default for a common usage example
+ * Set the mouse cursor. `""` (empty string) restores Maplibre's default behaviour. See VectorLayer/Default for a usage example
*/
cursor?: string;
mapContext?: MapContext;
@@ -75,21 +78,23 @@
}: MapProps = $props();
let container: HTMLElement;
+ mapContext = createMapContext();
+
+ // Initial location is determined by (in order of precedence) :
+ // 1. An arbitrary default location
+ // 2. initialLocation prop
+ // 3. initialLocation context (notably set by )
- // Merge initial location with default object so individual
- // properties (like pitch) can be omitted by the caller
- let initialLocation = {
+ let contextLocation = getContext('initialLocation');
+
+ let initialLocation = $derived({
lat: 51.3,
lng: 10.2,
zoom: 5,
pitch: 0,
- ...receivedInitialLocation
- };
-
- mapContext = createMapContext();
- if (getContext('initialLocation') !== undefined && getContext('initialLocation') !== false) {
- initialLocation = getContext('initialLocation');
- }
+ ...receivedInitialLocation,
+ ...contextLocation
+ });
onMount(() => {
mapContext.map = new maplibre.Map({
@@ -151,6 +156,12 @@
}
});
+ $effect(() => {
+ mapContext.map?.jumpTo({
+ center: [initialLocation.lng, initialLocation.lat],
+ zoom: initialLocation.zoom
+ });
+ });
$effect(() => {
if (allowZoom === false) {
mapContext.map?.scrollZoom.disable();
diff --git a/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte b/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte
index 3c7bfa00..1b497f04 100644
--- a/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte
+++ b/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte
@@ -97,7 +97,7 @@
>
@@ -150,7 +150,7 @@
diff --git a/components/src/maplibre/Tooltip/Tooltip.stories.svelte b/components/src/maplibre/Tooltip/Tooltip.stories.svelte
index 106588a6..d53750f8 100644
--- a/components/src/maplibre/Tooltip/Tooltip.stories.svelte
+++ b/components/src/maplibre/Tooltip/Tooltip.stories.svelte
@@ -33,7 +33,9 @@
>
+
+
+
+
+```
+
+- This component includes a workaround to support for [TileJSON data with relative URLs](https://docs.versatiles.org/compendium/specification_extended_tilejson.html#relaxed-rule-for-tiles) as produced by versatiles-rs.
+- TileJSON data can by overridden by passing the relevant props to the component directly.
+
+## Using tile URLs directly
+
+Alternatively, you can point to a tile URL directly using the `tiles` prop:
```jsx
-