react-map4d-map 1.3.6 → 1.3.8

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.
@@ -1010,11 +1010,13 @@ var MFMap = function MFMap(props) {
1010
1010
  poi: true
1011
1011
  });
1012
1012
  events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline, eventMouseOutDirection, eventMouseOverDirection, eventMouseMoveDirection, eventMouseOutPolyline, eventMouseOverPolyline, eventMouseMovePolyline, eventMouseOutMarker, eventMouseOverMarker, eventMouseMoveMarker, eventClickPoi, eventHoverPoi, (_mapRef$current21 = mapRef.current) === null || _mapRef$current21 === void 0 ? void 0 : _mapRef$current21.addListener("click", function (args) {
1013
- var _args$circle, _args$circle2;
1013
+ var _args$circle, _args$circle2, _args$polygon3, _args$polygon3$onClic;
1014
1014
 
1015
1015
  ((_args$circle = args.circle) === null || _args$circle === void 0 ? void 0 : _args$circle.onClick) && ((_args$circle2 = args.circle) === null || _args$circle2 === void 0 ? void 0 : _args$circle2.onClick(args));
1016
+ (_args$polygon3 = args.polygon) === null || _args$polygon3 === void 0 ? void 0 : (_args$polygon3$onClic = _args$polygon3.onClick) === null || _args$polygon3$onClic === void 0 ? void 0 : _args$polygon3$onClic.call(_args$polygon3, args);
1016
1017
  }, {
1017
- circle: true
1018
+ circle: true,
1019
+ polygon: true
1018
1020
  })]);
1019
1021
 
1020
1022
  if (props.onClickLocation) {
@@ -1354,7 +1356,7 @@ var MFMarkerCluster = function MFMarkerCluster(props) {
1354
1356
  (_markerClusterRef$cur = markerClusterRef.current) === null || _markerClusterRef$cur === void 0 ? void 0 : _markerClusterRef$cur.setMap(null);
1355
1357
 
1356
1358
  if (theMap) {
1357
- var _markerClusterRef$cur2;
1359
+ var _markerRefs$current;
1358
1360
 
1359
1361
  var option = {
1360
1362
  minZoom: minZoom,
@@ -1367,9 +1369,14 @@ var MFMarkerCluster = function MFMarkerCluster(props) {
1367
1369
  delete option[key];
1368
1370
  }
1369
1371
  });
1370
- markerClusterRef.current = new map4d.MarkerClusterer(markerRefs.current, option);
1371
- (_markerClusterRef$cur2 = markerClusterRef.current) === null || _markerClusterRef$cur2 === void 0 ? void 0 : _markerClusterRef$cur2.setMap(theMap);
1372
- onCreated && onCreated(markerClusterRef.current);
1372
+
1373
+ if (markerRefs.current && ((_markerRefs$current = markerRefs.current) === null || _markerRefs$current === void 0 ? void 0 : _markerRefs$current.length) > 0) {
1374
+ var _markerClusterRef$cur2;
1375
+
1376
+ markerClusterRef.current = new map4d.MarkerClusterer(markerRefs.current, option);
1377
+ (_markerClusterRef$cur2 = markerClusterRef.current) === null || _markerClusterRef$cur2 === void 0 ? void 0 : _markerClusterRef$cur2.setMap(theMap);
1378
+ onCreated && onCreated(markerClusterRef.current);
1379
+ }
1373
1380
  }
1374
1381
  };
1375
1382
 
@@ -1647,6 +1654,7 @@ var MFPolygon = function MFPolygon(props) {
1647
1654
  userInteractionEnabled = props.userInteractionEnabled,
1648
1655
  map = props.map,
1649
1656
  onHover = props.onHover,
1657
+ onClick = props.onClick,
1650
1658
  onCreated = props.onCreated;
1651
1659
  var map4dContext = useContext(Map4dContext);
1652
1660
  var theMap = map || map4dContext.map;
@@ -1675,6 +1683,7 @@ var MFPolygon = function MFPolygon(props) {
1675
1683
  polygonRef.current = new map4d.Polygon(option);
1676
1684
  (_polygonRef$current = polygonRef.current) === null || _polygonRef$current === void 0 ? void 0 : _polygonRef$current.setMap(theMap);
1677
1685
  polygonRef.current.onHover = props.onHover;
1686
+ polygonRef.current.onClick = onClick;
1678
1687
  onCreated && onCreated(polygonRef.current);
1679
1688
  }
1680
1689
  }, [theMap]);
@@ -1703,6 +1712,11 @@ var MFPolygon = function MFPolygon(props) {
1703
1712
  polygonRef.current.onHover = onHover;
1704
1713
  }
1705
1714
  }, [onHover]);
1715
+ useEffect(function () {
1716
+ if (polygonRef.current) {
1717
+ polygonRef.current.onClick = onClick;
1718
+ }
1719
+ }, [onClick]);
1706
1720
  useEffect(function () {
1707
1721
  var _polygonRef$current5;
1708
1722