@vinctus/react-maplibre 1.3.3 → 1.3.4
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/Popup.js +8 -1
- package/package.json +1 -1
package/dist/Popup.js
CHANGED
|
@@ -23,7 +23,14 @@ export const Popup = ({ children, longitude, latitude, className, closeOnClick,
|
|
|
23
23
|
.setLngLat(coordinates)
|
|
24
24
|
.setHTML(initialHtml)
|
|
25
25
|
.addTo(map);
|
|
26
|
-
|
|
26
|
+
// A popup also closes itself when its map is removed, such as when the map is rebuilt for a new
|
|
27
|
+
// style, and that is not a user closing it.
|
|
28
|
+
const handleClose = () => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (!map._removed) {
|
|
31
|
+
(_a = onCloseRef.current) === null || _a === void 0 ? void 0 : _a.call(onCloseRef);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
27
34
|
popup.on('close', handleClose);
|
|
28
35
|
popupInstance.current = popup;
|
|
29
36
|
return () => {
|