react-map4d-map 1.2.1 → 1.2.3

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;
@@ -953,7 +959,10 @@ var MFMarker = function MFMarker(props) {
953
959
  userInteractionEnabled = props.userInteractionEnabled,
954
960
  map = props.map,
955
961
  onCreated = props.onCreated,
956
- onClick = props.onClick;
962
+ onClick = props.onClick,
963
+ onRightClick = props.onRightClick,
964
+ onDragEnd = props.onDragEnd,
965
+ onHover = props.onHover;
957
966
  var map4dContext = useContext(Map4dContext);
958
967
  var markerClusterContext = useContext(MarkerClusterContext);
959
968
  var theMap = map || map4dContext.map;
@@ -1005,7 +1014,9 @@ var MFMarker = function MFMarker(props) {
1005
1014
  }
1006
1015
 
1007
1016
  if (props.showInfoWindow != undefined) {
1008
- props.showInfoWindow ? markerRef.current.showInfoWindow() : markerRef.current.hideInfoWindow();
1017
+ var _markerRef$current, _markerRef$current2;
1018
+
1019
+ props.showInfoWindow ? (_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.showInfoWindow() : (_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : _markerRef$current2.hideInfoWindow();
1009
1020
  }
1010
1021
 
1011
1022
  markerRef.current.onClick = onClick;
@@ -1019,124 +1030,146 @@ var MFMarker = function MFMarker(props) {
1019
1030
  useEffect(function () {
1020
1031
  if (theMap) {
1021
1032
  if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
1022
- var _markerRef$current;
1033
+ var _markerRef$current3;
1023
1034
 
1024
- (_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.setMap(theMap);
1035
+ (_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : _markerRef$current3.setMap(theMap);
1025
1036
  }
1026
1037
  }
1027
1038
 
1028
1039
  return function () {
1029
1040
  if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
1030
- var _markerRef$current2;
1041
+ var _markerRef$current4;
1031
1042
 
1032
- (_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : _markerRef$current2.setMap(null);
1043
+ (_markerRef$current4 = markerRef.current) === null || _markerRef$current4 === void 0 ? void 0 : _markerRef$current4.setMap(null);
1033
1044
  }
1034
1045
  };
1035
1046
  }, [theMap]);
1036
1047
  useEffect(function () {
1037
1048
  return function () {
1038
1049
  if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
1039
- var _markerRef$current3;
1050
+ var _markerRef$current5;
1040
1051
 
1041
- (_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : _markerRef$current3.setMap(null);
1052
+ (_markerRef$current5 = markerRef.current) === null || _markerRef$current5 === void 0 ? void 0 : _markerRef$current5.setMap(null);
1042
1053
  }
1043
1054
 
1044
1055
  markerRef.current && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker(markerRef.current));
1045
1056
  };
1046
1057
  }, []);
1047
1058
  useEffect(function () {
1048
- var _markerRef$current4;
1059
+ if (markerRef.current) {
1060
+ markerRef.current.onHover = onHover;
1061
+ }
1062
+ }, [onHover]);
1063
+ useEffect(function () {
1064
+ if (markerRef.current) {
1065
+ markerRef.current.onClick = onClick;
1066
+ }
1067
+ }, [onClick]);
1068
+ useEffect(function () {
1069
+ if (markerRef.current) {
1070
+ markerRef.current.onRightClick = onRightClick;
1071
+ }
1072
+ }, [onRightClick]);
1073
+ useEffect(function () {
1074
+ if (markerRef.current) {
1075
+ markerRef.current.onHover = onDragEnd;
1076
+ }
1077
+ }, [onDragEnd]);
1078
+ useEffect(function () {
1079
+ var _markerRef$current6;
1049
1080
 
1050
- (_markerRef$current4 = markerRef.current) === null || _markerRef$current4 === void 0 ? void 0 : _markerRef$current4.setPosition(position);
1081
+ (_markerRef$current6 = markerRef.current) === null || _markerRef$current6 === void 0 ? void 0 : _markerRef$current6.setPosition(position);
1051
1082
  }, [position]);
1052
1083
  useEffect(function () {
1053
- var _markerRef$current5;
1084
+ var _markerRef$current7;
1054
1085
 
1055
- (_markerRef$current5 = markerRef.current) === null || _markerRef$current5 === void 0 ? void 0 : _markerRef$current5.setVisible(visible);
1086
+ (_markerRef$current7 = markerRef.current) === null || _markerRef$current7 === void 0 ? void 0 : _markerRef$current7.setVisible(visible);
1056
1087
  }, [visible]);
1057
1088
  useEffect(function () {
1058
- var _markerRef$current6;
1089
+ var _markerRef$current8;
1059
1090
 
1060
- anchor != undefined && ((_markerRef$current6 = markerRef.current) === null || _markerRef$current6 === void 0 ? void 0 : _markerRef$current6.setAnchor(anchor));
1091
+ anchor != undefined && ((_markerRef$current8 = markerRef.current) === null || _markerRef$current8 === void 0 ? void 0 : _markerRef$current8.setAnchor(anchor));
1061
1092
  }, [anchor]);
1062
1093
  useEffect(function () {
1063
- var _markerRef$current7;
1094
+ var _markerRef$current9;
1064
1095
 
1065
- labelAnchor != undefined && ((_markerRef$current7 = markerRef.current) === null || _markerRef$current7 === void 0 ? void 0 : _markerRef$current7.setLabelAnchor(labelAnchor));
1096
+ labelAnchor != undefined && ((_markerRef$current9 = markerRef.current) === null || _markerRef$current9 === void 0 ? void 0 : _markerRef$current9.setLabelAnchor(labelAnchor));
1066
1097
  }, [labelAnchor]);
1067
1098
  useEffect(function () {
1068
- var _markerRef$current8;
1099
+ var _markerRef$current10;
1069
1100
 
1070
- icon != undefined && ((_markerRef$current8 = markerRef.current) === null || _markerRef$current8 === void 0 ? void 0 : _markerRef$current8.setIcon(icon));
1101
+ icon != undefined && ((_markerRef$current10 = markerRef.current) === null || _markerRef$current10 === void 0 ? void 0 : _markerRef$current10.setIcon(icon));
1071
1102
  }, [icon]);
1072
1103
  useEffect(function () {
1073
- var _markerRef$current9;
1104
+ var _markerRef$current11;
1074
1105
 
1075
- elevation != undefined && ((_markerRef$current9 = markerRef.current) === null || _markerRef$current9 === void 0 ? void 0 : _markerRef$current9.setElevation(elevation));
1106
+ elevation != undefined && ((_markerRef$current11 = markerRef.current) === null || _markerRef$current11 === void 0 ? void 0 : _markerRef$current11.setElevation(elevation));
1076
1107
  }, [elevation]);
1077
1108
  useEffect(function () {
1078
- var _markerRef$current10;
1109
+ var _markerRef$current12;
1079
1110
 
1080
- rotation != undefined && ((_markerRef$current10 = markerRef.current) === null || _markerRef$current10 === void 0 ? void 0 : _markerRef$current10.setRotation(rotation));
1111
+ rotation != undefined && ((_markerRef$current12 = markerRef.current) === null || _markerRef$current12 === void 0 ? void 0 : _markerRef$current12.setRotation(rotation));
1081
1112
  }, [rotation]);
1082
1113
  useEffect(function () {
1083
- var _markerRef$current11;
1114
+ var _markerRef$current13;
1084
1115
 
1085
- title != undefined && ((_markerRef$current11 = markerRef.current) === null || _markerRef$current11 === void 0 ? void 0 : _markerRef$current11.setTitle(title));
1116
+ title != undefined && ((_markerRef$current13 = markerRef.current) === null || _markerRef$current13 === void 0 ? void 0 : _markerRef$current13.setTitle(title));
1086
1117
  }, [title]);
1087
1118
  useEffect(function () {
1088
- var _markerRef$current12;
1119
+ var _markerRef$current14;
1089
1120
 
1090
- snippet != undefined && ((_markerRef$current12 = markerRef.current) === null || _markerRef$current12 === void 0 ? void 0 : _markerRef$current12.setSnippet(snippet));
1121
+ snippet != undefined && ((_markerRef$current14 = markerRef.current) === null || _markerRef$current14 === void 0 ? void 0 : _markerRef$current14.setSnippet(snippet));
1091
1122
  }, [snippet]);
1092
1123
  useEffect(function () {
1093
- var _markerRef$current13;
1124
+ var _markerRef$current15;
1094
1125
 
1095
- windowAnchor != undefined && ((_markerRef$current13 = markerRef.current) === null || _markerRef$current13 === void 0 ? void 0 : _markerRef$current13.setWindowAnchor(windowAnchor));
1126
+ windowAnchor != undefined && ((_markerRef$current15 = markerRef.current) === null || _markerRef$current15 === void 0 ? void 0 : _markerRef$current15.setWindowAnchor(windowAnchor));
1096
1127
  }, [windowAnchor]);
1097
1128
  useEffect(function () {
1098
- var _markerRef$current14;
1129
+ var _markerRef$current16;
1099
1130
 
1100
- zIndex != undefined && ((_markerRef$current14 = markerRef.current) === null || _markerRef$current14 === void 0 ? void 0 : _markerRef$current14.setZIndex(zIndex));
1131
+ zIndex != undefined && ((_markerRef$current16 = markerRef.current) === null || _markerRef$current16 === void 0 ? void 0 : _markerRef$current16.setZIndex(zIndex));
1101
1132
  }, [zIndex]);
1102
1133
  useEffect(function () {
1103
- var _markerRef$current15;
1134
+ var _markerRef$current17;
1104
1135
 
1105
- label != undefined && ((_markerRef$current15 = markerRef.current) === null || _markerRef$current15 === void 0 ? void 0 : _markerRef$current15.setLabel(label));
1136
+ label != undefined && ((_markerRef$current17 = markerRef.current) === null || _markerRef$current17 === void 0 ? void 0 : _markerRef$current17.setLabel(label));
1106
1137
  }, [label]);
1107
1138
  useEffect(function () {
1108
- var _markerRef$current16;
1139
+ var _markerRef$current18;
1109
1140
 
1110
- draggable != undefined && ((_markerRef$current16 = markerRef.current) === null || _markerRef$current16 === void 0 ? void 0 : _markerRef$current16.setDraggable(draggable));
1141
+ draggable != undefined && ((_markerRef$current18 = markerRef.current) === null || _markerRef$current18 === void 0 ? void 0 : _markerRef$current18.setDraggable(draggable));
1111
1142
  }, [draggable]);
1112
1143
  useEffect(function () {
1113
- var _markerRef$current17;
1144
+ var _markerRef$current19;
1114
1145
 
1115
- iconView != undefined && ((_markerRef$current17 = markerRef.current) === null || _markerRef$current17 === void 0 ? void 0 : _markerRef$current17.setIconView(iconView));
1146
+ iconView != undefined && ((_markerRef$current19 = markerRef.current) === null || _markerRef$current19 === void 0 ? void 0 : _markerRef$current19.setIconView(iconView));
1116
1147
  }, [iconView]);
1117
1148
  useEffect(function () {
1118
- var _markerRef$current18;
1149
+ var _markerRef$current20;
1119
1150
 
1120
- userInteractionEnabled != undefined && ((_markerRef$current18 = markerRef.current) === null || _markerRef$current18 === void 0 ? void 0 : _markerRef$current18.setUserInteraction(userInteractionEnabled));
1151
+ userInteractionEnabled != undefined && ((_markerRef$current20 = markerRef.current) === null || _markerRef$current20 === void 0 ? void 0 : _markerRef$current20.setUserInteraction(userInteractionEnabled));
1121
1152
  }, [userInteractionEnabled]);
1122
1153
  useEffect(function () {
1123
- var _markerRef$current19;
1154
+ var _markerRef$current21;
1124
1155
 
1125
- icon != undefined && ((_markerRef$current19 = markerRef.current) === null || _markerRef$current19 === void 0 ? void 0 : _markerRef$current19.setIcon(new map4d.Icon(icon.width, icon.height, icon.url)));
1156
+ icon != undefined && ((_markerRef$current21 = markerRef.current) === null || _markerRef$current21 === void 0 ? void 0 : _markerRef$current21.setIcon(new map4d.Icon(icon.width, icon.height, icon.url)));
1126
1157
  }, [icon]);
1127
1158
  useEffect(function () {
1128
- var _markerRef$current20;
1159
+ var _markerRef$current22;
1129
1160
 
1130
- props.infoWindow != undefined && ((_markerRef$current20 = markerRef.current) === null || _markerRef$current20 === void 0 ? void 0 : _markerRef$current20.setInfoWindow(props.infoWindow));
1161
+ props.infoWindow != undefined && ((_markerRef$current22 = markerRef.current) === null || _markerRef$current22 === void 0 ? void 0 : _markerRef$current22.setInfoWindow(props.infoWindow));
1131
1162
  }, [props.infoWindow]);
1132
1163
  useEffect(function () {
1133
- var _markerRef$current21;
1164
+ var _markerRef$current23;
1134
1165
 
1135
- props.infoContents != undefined && ((_markerRef$current21 = markerRef.current) === null || _markerRef$current21 === void 0 ? void 0 : _markerRef$current21.setInfoContents(props.infoContents));
1166
+ props.infoContents != undefined && ((_markerRef$current23 = markerRef.current) === null || _markerRef$current23 === void 0 ? void 0 : _markerRef$current23.setInfoContents(props.infoContents));
1136
1167
  }, [props.infoContents]);
1137
1168
  useEffect(function () {
1138
1169
  if (props.showInfoWindow != undefined) {
1139
- props.showInfoWindow ? markerRef.current.showInfoWindow() : markerRef.current.hideInfoWindow();
1170
+ var _markerRef$current24, _markerRef$current25;
1171
+
1172
+ props.showInfoWindow ? (_markerRef$current24 = markerRef.current) === null || _markerRef$current24 === void 0 ? void 0 : _markerRef$current24.showInfoWindow() : (_markerRef$current25 = markerRef.current) === null || _markerRef$current25 === void 0 ? void 0 : _markerRef$current25.hideInfoWindow();
1140
1173
  }
1141
1174
  }, [props.showInfoWindow]);
1142
1175
  return null;
@@ -1441,6 +1474,7 @@ var MFPolygon = function MFPolygon(props) {
1441
1474
  zIndex = props.zIndex,
1442
1475
  userInteractionEnabled = props.userInteractionEnabled,
1443
1476
  map = props.map,
1477
+ onHover = props.onHover,
1444
1478
  onCreated = props.onCreated;
1445
1479
  var map4dContext = useContext(Map4dContext);
1446
1480
  var theMap = map || map4dContext.map;
@@ -1492,6 +1526,11 @@ var MFPolygon = function MFPolygon(props) {
1492
1526
  (_polygonRef$current4 = polygonRef.current) === null || _polygonRef$current4 === void 0 ? void 0 : _polygonRef$current4.setMap(null);
1493
1527
  };
1494
1528
  }, []);
1529
+ useEffect(function () {
1530
+ if (polygonRef.current) {
1531
+ polygonRef.current.onHover = onHover;
1532
+ }
1533
+ }, [onHover]);
1495
1534
  useEffect(function () {
1496
1535
  var _polygonRef$current5;
1497
1536
 
@@ -1559,6 +1598,8 @@ var MFPolyline = function MFPolyline(props) {
1559
1598
  strokePattern = props.strokePattern,
1560
1599
  userInteractionEnabled = props.userInteractionEnabled,
1561
1600
  map = props.map,
1601
+ onClick = props.onClick,
1602
+ onHover = props.onHover,
1562
1603
  onCreated = props.onCreated;
1563
1604
  var map4dContext = useContext(Map4dContext);
1564
1605
  var theMap = map || map4dContext.map;
@@ -1615,6 +1656,16 @@ var MFPolyline = function MFPolyline(props) {
1615
1656
  (_polylineRef$current4 = polylineRef.current) === null || _polylineRef$current4 === void 0 ? void 0 : _polylineRef$current4.setMap(null);
1616
1657
  };
1617
1658
  }, []);
1659
+ useEffect(function () {
1660
+ if (polylineRef.current) {
1661
+ polylineRef.current.onHover = onHover;
1662
+ }
1663
+ }, [onHover]);
1664
+ useEffect(function () {
1665
+ if (polylineRef.current) {
1666
+ polylineRef.current.onClick = onClick;
1667
+ }
1668
+ }, [onClick]);
1618
1669
  useEffect(function () {
1619
1670
  var _polylineRef$current5;
1620
1671