react-map4d-map 1.2.0 → 1.2.2

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.
@@ -440,6 +440,7 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
440
440
  waypointMarkerOptions = props.waypointMarkerOptions,
441
441
  onMarkerDragEnd = props.onMarkerDragEnd,
442
442
  map = props.map,
443
+ onHover = props.onHover,
443
444
  onCreated = props.onCreated;
444
445
  var map4dContext = useContext(Map4dContext);
445
446
  var theMap = map || map4dContext.map;
@@ -477,6 +478,11 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
477
478
  onCreated && onCreated(directionRef.current);
478
479
  }
479
480
  }, [theMap]);
481
+ useEffect(function () {
482
+ if (directionRef.current) {
483
+ directionRef.current.onHover = onHover;
484
+ }
485
+ }, [onHover]);
480
486
  useEffect(function () {
481
487
  if (theMap) {
482
488
  var _directionRef$current2;
@@ -809,7 +815,7 @@ var MFMap = function MFMap(props) {
809
815
  }, [props.environment, props.version, props.accessKey]);
810
816
 
811
817
  var registerEvent = function registerEvent() {
812
- var _mapRef$current2, _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8;
818
+ var _mapRef$current2, _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8, _mapRef$current9;
813
819
 
814
820
  var eventClickMarker = (_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.addListener("click", function (args) {
815
821
  var _args$marker, _args$marker2;
@@ -860,12 +866,19 @@ var MFMap = function MFMap(props) {
860
866
  }, {
861
867
  directions: true
862
868
  });
863
- events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection]);
869
+ var eventClickPolyline = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("click", function (args) {
870
+ var _args$polyline3, _args$polyline4;
871
+
872
+ ((_args$polyline3 = args.polyline) === null || _args$polyline3 === void 0 ? void 0 : _args$polyline3.onClick) && ((_args$polyline4 = args.polyline) === null || _args$polyline4 === void 0 ? void 0 : _args$polyline4.onClick());
873
+ }, {
874
+ polyline: true
875
+ });
876
+ events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline]);
864
877
 
865
878
  if (props.onClickLocation) {
866
- var _mapRef$current9;
879
+ var _mapRef$current10;
867
880
 
868
- var onClickLocation = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("click", function (args) {
881
+ var onClickLocation = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("click", function (args) {
869
882
  props.onClickLocation && props.onClickLocation(args);
870
883
  }, {
871
884
  location: true
@@ -874,9 +887,9 @@ var MFMap = function MFMap(props) {
874
887
  }
875
888
 
876
889
  if (props.onRightClickLocation) {
877
- var _mapRef$current10;
890
+ var _mapRef$current11;
878
891
 
879
- var onRightClickLocation = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("rightClick", function (args) {
892
+ var onRightClickLocation = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("rightClick", function (args) {
880
893
  props.onRightClickLocation && props.onRightClickLocation(args);
881
894
  }, {
882
895
  location: true
@@ -885,9 +898,9 @@ var MFMap = function MFMap(props) {
885
898
  }
886
899
 
887
900
  if (props.onTilesLoaded) {
888
- var _mapRef$current11;
901
+ var _mapRef$current12;
889
902
 
890
- var onTilesLoaded = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("tilesLoaded", function (args) {
903
+ var onTilesLoaded = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("tilesLoaded", function (args) {
891
904
  props.onTilesLoaded && props.onTilesLoaded(args);
892
905
  }, {
893
906
  location: true
@@ -896,9 +909,9 @@ var MFMap = function MFMap(props) {
896
909
  }
897
910
 
898
911
  if (props.onCameraChanging) {
899
- var _mapRef$current12;
912
+ var _mapRef$current13;
900
913
 
901
- var onCameraChanging = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("cameraChanging", function (args) {
914
+ var onCameraChanging = (_mapRef$current13 = mapRef.current) === null || _mapRef$current13 === void 0 ? void 0 : _mapRef$current13.addListener("cameraChanging", function (args) {
902
915
  props.onCameraChanging && props.onCameraChanging(args);
903
916
  }, {
904
917
  location: true
@@ -946,7 +959,10 @@ var MFMarker = function MFMarker(props) {
946
959
  userInteractionEnabled = props.userInteractionEnabled,
947
960
  map = props.map,
948
961
  onCreated = props.onCreated,
949
- onClick = props.onClick;
962
+ onClick = props.onClick,
963
+ onRightClick = props.onRightClick,
964
+ onDragEnd = props.onDragEnd,
965
+ onHover = props.onHover;
950
966
  var map4dContext = useContext(Map4dContext);
951
967
  var markerClusterContext = useContext(MarkerClusterContext);
952
968
  var theMap = map || map4dContext.map;
@@ -1037,6 +1053,26 @@ var MFMarker = function MFMarker(props) {
1037
1053
  markerRef.current && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker(markerRef.current));
1038
1054
  };
1039
1055
  }, []);
1056
+ useEffect(function () {
1057
+ if (markerRef.current) {
1058
+ markerRef.current.onHover = onHover;
1059
+ }
1060
+ }, [onHover]);
1061
+ useEffect(function () {
1062
+ if (markerRef.current) {
1063
+ markerRef.current.onClick = onClick;
1064
+ }
1065
+ }, [onClick]);
1066
+ useEffect(function () {
1067
+ if (markerRef.current) {
1068
+ markerRef.current.onRightClick = onRightClick;
1069
+ }
1070
+ }, [onRightClick]);
1071
+ useEffect(function () {
1072
+ if (markerRef.current) {
1073
+ markerRef.current.onHover = onDragEnd;
1074
+ }
1075
+ }, [onDragEnd]);
1040
1076
  useEffect(function () {
1041
1077
  var _markerRef$current4;
1042
1078
 
@@ -1434,6 +1470,7 @@ var MFPolygon = function MFPolygon(props) {
1434
1470
  zIndex = props.zIndex,
1435
1471
  userInteractionEnabled = props.userInteractionEnabled,
1436
1472
  map = props.map,
1473
+ onHover = props.onHover,
1437
1474
  onCreated = props.onCreated;
1438
1475
  var map4dContext = useContext(Map4dContext);
1439
1476
  var theMap = map || map4dContext.map;
@@ -1485,6 +1522,11 @@ var MFPolygon = function MFPolygon(props) {
1485
1522
  (_polygonRef$current4 = polygonRef.current) === null || _polygonRef$current4 === void 0 ? void 0 : _polygonRef$current4.setMap(null);
1486
1523
  };
1487
1524
  }, []);
1525
+ useEffect(function () {
1526
+ if (polygonRef.current) {
1527
+ polygonRef.current.onHover = onHover;
1528
+ }
1529
+ }, [onHover]);
1488
1530
  useEffect(function () {
1489
1531
  var _polygonRef$current5;
1490
1532
 
@@ -1552,6 +1594,8 @@ var MFPolyline = function MFPolyline(props) {
1552
1594
  strokePattern = props.strokePattern,
1553
1595
  userInteractionEnabled = props.userInteractionEnabled,
1554
1596
  map = props.map,
1597
+ onClick = props.onClick,
1598
+ onHover = props.onHover,
1555
1599
  onCreated = props.onCreated;
1556
1600
  var map4dContext = useContext(Map4dContext);
1557
1601
  var theMap = map || map4dContext.map;
@@ -1584,6 +1628,7 @@ var MFPolyline = function MFPolyline(props) {
1584
1628
  polylineRef.current = new map4d.Polyline(option);
1585
1629
  (_polylineRef$current = polylineRef.current) === null || _polylineRef$current === void 0 ? void 0 : _polylineRef$current.setMap(theMap);
1586
1630
  polylineRef.current.onHover = props.onHover;
1631
+ polylineRef.current.onClick = props.onClick;
1587
1632
  onCreated && onCreated(polylineRef.current);
1588
1633
  }
1589
1634
  }, [theMap]);
@@ -1607,6 +1652,16 @@ var MFPolyline = function MFPolyline(props) {
1607
1652
  (_polylineRef$current4 = polylineRef.current) === null || _polylineRef$current4 === void 0 ? void 0 : _polylineRef$current4.setMap(null);
1608
1653
  };
1609
1654
  }, []);
1655
+ useEffect(function () {
1656
+ if (polylineRef.current) {
1657
+ polylineRef.current.onHover = onHover;
1658
+ }
1659
+ }, [onHover]);
1660
+ useEffect(function () {
1661
+ if (polylineRef.current) {
1662
+ polylineRef.current.onClick = onClick;
1663
+ }
1664
+ }, [onClick]);
1610
1665
  useEffect(function () {
1611
1666
  var _polylineRef$current5;
1612
1667