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