@classic-homes/maps-svelte 0.2.6 → 0.2.7
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.
|
@@ -159,8 +159,13 @@
|
|
|
159
159
|
map = newMap;
|
|
160
160
|
|
|
161
161
|
// Track style changes for layer re-initialization
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
// Note: Using 'data' event with dataType check instead of 'style.load'
|
|
163
|
+
// because style.load doesn't reliably fire after setStyle() in newer MapLibre versions
|
|
164
|
+
// See: https://github.com/maplibre/maplibre-gl-js/discussions/2716
|
|
165
|
+
newMap.on('data', (e) => {
|
|
166
|
+
if (e.dataType === 'style') {
|
|
167
|
+
styleVersion++;
|
|
168
|
+
}
|
|
164
169
|
});
|
|
165
170
|
|
|
166
171
|
// Add controls and register with positioning coordinator
|
|
@@ -15,7 +15,7 @@ export interface MapContextValue {
|
|
|
15
15
|
readonly map: maplibregl.Map | null;
|
|
16
16
|
/** Whether the map has finished loading */
|
|
17
17
|
readonly loaded: boolean;
|
|
18
|
-
/** Counter incremented on each style
|
|
18
|
+
/** Counter incremented on each style change (via data event), used to re-initialize sources/layers */
|
|
19
19
|
readonly styleVersion: number;
|
|
20
20
|
/** Set the map style programmatically (e.g. basemap switching) */
|
|
21
21
|
setMapStyle?: (style: string | maplibregl.StyleSpecification) => void;
|