@vinctus/react-maplibre 0.2.15 → 0.2.17
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.
- package/dist/GeolocateControl.js +3 -1
- package/dist/Layer.js +9 -5
- package/dist/NavigationControl.js +3 -1
- package/dist/ScaleControl.js +3 -1
- package/package.json +1 -1
package/dist/GeolocateControl.js
CHANGED
|
@@ -9,7 +9,9 @@ export const GeolocateControl = ({ position = 'bottom-right', options = { showUs
|
|
|
9
9
|
map.addControl(control, position);
|
|
10
10
|
}
|
|
11
11
|
return () => {
|
|
12
|
-
map
|
|
12
|
+
if (map && map.hasControl && map.hasControl(control)) {
|
|
13
|
+
map.removeControl(control);
|
|
14
|
+
}
|
|
13
15
|
};
|
|
14
16
|
}, [position, options, map]);
|
|
15
17
|
return null;
|
package/dist/Layer.js
CHANGED
|
@@ -17,17 +17,21 @@ export const Layer = ({ layer, source }) => {
|
|
|
17
17
|
if (added && map) {
|
|
18
18
|
try {
|
|
19
19
|
// Check if layer exists before removing
|
|
20
|
-
if (map.getLayer(parsedLayer.id)) {
|
|
20
|
+
if (map.getLayer && map.getLayer(parsedLayer.id)) {
|
|
21
21
|
map.removeLayer(parsedLayer.id); // when removing, the layer must be removed first, and then the source
|
|
22
22
|
}
|
|
23
|
+
}
|
|
24
|
+
catch (_a) {
|
|
25
|
+
// Layer might not exist or map might be destroyed
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
23
28
|
// Check if source exists before removing
|
|
24
|
-
if (map.getSource(parsedLayer.id)) {
|
|
29
|
+
if (map.getSource && map.getSource(parsedLayer.id)) {
|
|
25
30
|
map.removeSource(parsedLayer.id);
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
|
-
catch (
|
|
29
|
-
//
|
|
30
|
-
console.warn('Layer cleanup error:', error);
|
|
33
|
+
catch (_b) {
|
|
34
|
+
// Source might not exist or map might be destroyed
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
};
|
|
@@ -12,7 +12,9 @@ export const NavigationControl = ({ position = 'bottom-right', options = {
|
|
|
12
12
|
map.addControl(control, position);
|
|
13
13
|
}
|
|
14
14
|
return () => {
|
|
15
|
-
map
|
|
15
|
+
if (map && map.hasControl && map.hasControl(control)) {
|
|
16
|
+
map.removeControl(control);
|
|
17
|
+
}
|
|
16
18
|
};
|
|
17
19
|
}, [position, options, map]);
|
|
18
20
|
return null;
|
package/dist/ScaleControl.js
CHANGED
|
@@ -9,7 +9,9 @@ export const ScaleControl = ({ position = 'bottom-right', options, }) => {
|
|
|
9
9
|
map.addControl(control, position);
|
|
10
10
|
}
|
|
11
11
|
return () => {
|
|
12
|
-
map
|
|
12
|
+
if (map && map.hasControl && map.hasControl(control)) {
|
|
13
|
+
map.removeControl(control);
|
|
14
|
+
}
|
|
13
15
|
};
|
|
14
16
|
}, [position, options, map]);
|
|
15
17
|
return null;
|