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.
package/dist/index.js CHANGED
@@ -443,6 +443,7 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
443
443
  waypointMarkerOptions = props.waypointMarkerOptions,
444
444
  onMarkerDragEnd = props.onMarkerDragEnd,
445
445
  map = props.map,
446
+ onHover = props.onHover,
446
447
  onCreated = props.onCreated;
447
448
  var map4dContext = React.useContext(Map4dContext);
448
449
  var theMap = map || map4dContext.map;
@@ -480,6 +481,11 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
480
481
  onCreated && onCreated(directionRef.current);
481
482
  }
482
483
  }, [theMap]);
484
+ React.useEffect(function () {
485
+ if (directionRef.current) {
486
+ directionRef.current.onHover = onHover;
487
+ }
488
+ }, [onHover]);
483
489
  React.useEffect(function () {
484
490
  if (theMap) {
485
491
  var _directionRef$current2;
@@ -956,7 +962,10 @@ var MFMarker = function MFMarker(props) {
956
962
  userInteractionEnabled = props.userInteractionEnabled,
957
963
  map = props.map,
958
964
  onCreated = props.onCreated,
959
- onClick = props.onClick;
965
+ onClick = props.onClick,
966
+ onRightClick = props.onRightClick,
967
+ onDragEnd = props.onDragEnd,
968
+ onHover = props.onHover;
960
969
  var map4dContext = React.useContext(Map4dContext);
961
970
  var markerClusterContext = React.useContext(MarkerClusterContext);
962
971
  var theMap = map || map4dContext.map;
@@ -1008,7 +1017,9 @@ var MFMarker = function MFMarker(props) {
1008
1017
  }
1009
1018
 
1010
1019
  if (props.showInfoWindow != undefined) {
1011
- props.showInfoWindow ? markerRef.current.showInfoWindow() : markerRef.current.hideInfoWindow();
1020
+ var _markerRef$current, _markerRef$current2;
1021
+
1022
+ 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();
1012
1023
  }
1013
1024
 
1014
1025
  markerRef.current.onClick = onClick;
@@ -1022,124 +1033,146 @@ var MFMarker = function MFMarker(props) {
1022
1033
  React.useEffect(function () {
1023
1034
  if (theMap) {
1024
1035
  if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
1025
- var _markerRef$current;
1036
+ var _markerRef$current3;
1026
1037
 
1027
- (_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.setMap(theMap);
1038
+ (_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : _markerRef$current3.setMap(theMap);
1028
1039
  }
1029
1040
  }
1030
1041
 
1031
1042
  return function () {
1032
1043
  if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
1033
- var _markerRef$current2;
1044
+ var _markerRef$current4;
1034
1045
 
1035
- (_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : _markerRef$current2.setMap(null);
1046
+ (_markerRef$current4 = markerRef.current) === null || _markerRef$current4 === void 0 ? void 0 : _markerRef$current4.setMap(null);
1036
1047
  }
1037
1048
  };
1038
1049
  }, [theMap]);
1039
1050
  React.useEffect(function () {
1040
1051
  return function () {
1041
1052
  if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
1042
- var _markerRef$current3;
1053
+ var _markerRef$current5;
1043
1054
 
1044
- (_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : _markerRef$current3.setMap(null);
1055
+ (_markerRef$current5 = markerRef.current) === null || _markerRef$current5 === void 0 ? void 0 : _markerRef$current5.setMap(null);
1045
1056
  }
1046
1057
 
1047
1058
  markerRef.current && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker(markerRef.current));
1048
1059
  };
1049
1060
  }, []);
1050
1061
  React.useEffect(function () {
1051
- var _markerRef$current4;
1062
+ if (markerRef.current) {
1063
+ markerRef.current.onHover = onHover;
1064
+ }
1065
+ }, [onHover]);
1066
+ React.useEffect(function () {
1067
+ if (markerRef.current) {
1068
+ markerRef.current.onClick = onClick;
1069
+ }
1070
+ }, [onClick]);
1071
+ React.useEffect(function () {
1072
+ if (markerRef.current) {
1073
+ markerRef.current.onRightClick = onRightClick;
1074
+ }
1075
+ }, [onRightClick]);
1076
+ React.useEffect(function () {
1077
+ if (markerRef.current) {
1078
+ markerRef.current.onHover = onDragEnd;
1079
+ }
1080
+ }, [onDragEnd]);
1081
+ React.useEffect(function () {
1082
+ var _markerRef$current6;
1052
1083
 
1053
- (_markerRef$current4 = markerRef.current) === null || _markerRef$current4 === void 0 ? void 0 : _markerRef$current4.setPosition(position);
1084
+ (_markerRef$current6 = markerRef.current) === null || _markerRef$current6 === void 0 ? void 0 : _markerRef$current6.setPosition(position);
1054
1085
  }, [position]);
1055
1086
  React.useEffect(function () {
1056
- var _markerRef$current5;
1087
+ var _markerRef$current7;
1057
1088
 
1058
- (_markerRef$current5 = markerRef.current) === null || _markerRef$current5 === void 0 ? void 0 : _markerRef$current5.setVisible(visible);
1089
+ (_markerRef$current7 = markerRef.current) === null || _markerRef$current7 === void 0 ? void 0 : _markerRef$current7.setVisible(visible);
1059
1090
  }, [visible]);
1060
1091
  React.useEffect(function () {
1061
- var _markerRef$current6;
1092
+ var _markerRef$current8;
1062
1093
 
1063
- anchor != undefined && ((_markerRef$current6 = markerRef.current) === null || _markerRef$current6 === void 0 ? void 0 : _markerRef$current6.setAnchor(anchor));
1094
+ anchor != undefined && ((_markerRef$current8 = markerRef.current) === null || _markerRef$current8 === void 0 ? void 0 : _markerRef$current8.setAnchor(anchor));
1064
1095
  }, [anchor]);
1065
1096
  React.useEffect(function () {
1066
- var _markerRef$current7;
1097
+ var _markerRef$current9;
1067
1098
 
1068
- labelAnchor != undefined && ((_markerRef$current7 = markerRef.current) === null || _markerRef$current7 === void 0 ? void 0 : _markerRef$current7.setLabelAnchor(labelAnchor));
1099
+ labelAnchor != undefined && ((_markerRef$current9 = markerRef.current) === null || _markerRef$current9 === void 0 ? void 0 : _markerRef$current9.setLabelAnchor(labelAnchor));
1069
1100
  }, [labelAnchor]);
1070
1101
  React.useEffect(function () {
1071
- var _markerRef$current8;
1102
+ var _markerRef$current10;
1072
1103
 
1073
- icon != undefined && ((_markerRef$current8 = markerRef.current) === null || _markerRef$current8 === void 0 ? void 0 : _markerRef$current8.setIcon(icon));
1104
+ icon != undefined && ((_markerRef$current10 = markerRef.current) === null || _markerRef$current10 === void 0 ? void 0 : _markerRef$current10.setIcon(icon));
1074
1105
  }, [icon]);
1075
1106
  React.useEffect(function () {
1076
- var _markerRef$current9;
1107
+ var _markerRef$current11;
1077
1108
 
1078
- elevation != undefined && ((_markerRef$current9 = markerRef.current) === null || _markerRef$current9 === void 0 ? void 0 : _markerRef$current9.setElevation(elevation));
1109
+ elevation != undefined && ((_markerRef$current11 = markerRef.current) === null || _markerRef$current11 === void 0 ? void 0 : _markerRef$current11.setElevation(elevation));
1079
1110
  }, [elevation]);
1080
1111
  React.useEffect(function () {
1081
- var _markerRef$current10;
1112
+ var _markerRef$current12;
1082
1113
 
1083
- rotation != undefined && ((_markerRef$current10 = markerRef.current) === null || _markerRef$current10 === void 0 ? void 0 : _markerRef$current10.setRotation(rotation));
1114
+ rotation != undefined && ((_markerRef$current12 = markerRef.current) === null || _markerRef$current12 === void 0 ? void 0 : _markerRef$current12.setRotation(rotation));
1084
1115
  }, [rotation]);
1085
1116
  React.useEffect(function () {
1086
- var _markerRef$current11;
1117
+ var _markerRef$current13;
1087
1118
 
1088
- title != undefined && ((_markerRef$current11 = markerRef.current) === null || _markerRef$current11 === void 0 ? void 0 : _markerRef$current11.setTitle(title));
1119
+ title != undefined && ((_markerRef$current13 = markerRef.current) === null || _markerRef$current13 === void 0 ? void 0 : _markerRef$current13.setTitle(title));
1089
1120
  }, [title]);
1090
1121
  React.useEffect(function () {
1091
- var _markerRef$current12;
1122
+ var _markerRef$current14;
1092
1123
 
1093
- snippet != undefined && ((_markerRef$current12 = markerRef.current) === null || _markerRef$current12 === void 0 ? void 0 : _markerRef$current12.setSnippet(snippet));
1124
+ snippet != undefined && ((_markerRef$current14 = markerRef.current) === null || _markerRef$current14 === void 0 ? void 0 : _markerRef$current14.setSnippet(snippet));
1094
1125
  }, [snippet]);
1095
1126
  React.useEffect(function () {
1096
- var _markerRef$current13;
1127
+ var _markerRef$current15;
1097
1128
 
1098
- windowAnchor != undefined && ((_markerRef$current13 = markerRef.current) === null || _markerRef$current13 === void 0 ? void 0 : _markerRef$current13.setWindowAnchor(windowAnchor));
1129
+ windowAnchor != undefined && ((_markerRef$current15 = markerRef.current) === null || _markerRef$current15 === void 0 ? void 0 : _markerRef$current15.setWindowAnchor(windowAnchor));
1099
1130
  }, [windowAnchor]);
1100
1131
  React.useEffect(function () {
1101
- var _markerRef$current14;
1132
+ var _markerRef$current16;
1102
1133
 
1103
- zIndex != undefined && ((_markerRef$current14 = markerRef.current) === null || _markerRef$current14 === void 0 ? void 0 : _markerRef$current14.setZIndex(zIndex));
1134
+ zIndex != undefined && ((_markerRef$current16 = markerRef.current) === null || _markerRef$current16 === void 0 ? void 0 : _markerRef$current16.setZIndex(zIndex));
1104
1135
  }, [zIndex]);
1105
1136
  React.useEffect(function () {
1106
- var _markerRef$current15;
1137
+ var _markerRef$current17;
1107
1138
 
1108
- label != undefined && ((_markerRef$current15 = markerRef.current) === null || _markerRef$current15 === void 0 ? void 0 : _markerRef$current15.setLabel(label));
1139
+ label != undefined && ((_markerRef$current17 = markerRef.current) === null || _markerRef$current17 === void 0 ? void 0 : _markerRef$current17.setLabel(label));
1109
1140
  }, [label]);
1110
1141
  React.useEffect(function () {
1111
- var _markerRef$current16;
1142
+ var _markerRef$current18;
1112
1143
 
1113
- draggable != undefined && ((_markerRef$current16 = markerRef.current) === null || _markerRef$current16 === void 0 ? void 0 : _markerRef$current16.setDraggable(draggable));
1144
+ draggable != undefined && ((_markerRef$current18 = markerRef.current) === null || _markerRef$current18 === void 0 ? void 0 : _markerRef$current18.setDraggable(draggable));
1114
1145
  }, [draggable]);
1115
1146
  React.useEffect(function () {
1116
- var _markerRef$current17;
1147
+ var _markerRef$current19;
1117
1148
 
1118
- iconView != undefined && ((_markerRef$current17 = markerRef.current) === null || _markerRef$current17 === void 0 ? void 0 : _markerRef$current17.setIconView(iconView));
1149
+ iconView != undefined && ((_markerRef$current19 = markerRef.current) === null || _markerRef$current19 === void 0 ? void 0 : _markerRef$current19.setIconView(iconView));
1119
1150
  }, [iconView]);
1120
1151
  React.useEffect(function () {
1121
- var _markerRef$current18;
1152
+ var _markerRef$current20;
1122
1153
 
1123
- userInteractionEnabled != undefined && ((_markerRef$current18 = markerRef.current) === null || _markerRef$current18 === void 0 ? void 0 : _markerRef$current18.setUserInteraction(userInteractionEnabled));
1154
+ userInteractionEnabled != undefined && ((_markerRef$current20 = markerRef.current) === null || _markerRef$current20 === void 0 ? void 0 : _markerRef$current20.setUserInteraction(userInteractionEnabled));
1124
1155
  }, [userInteractionEnabled]);
1125
1156
  React.useEffect(function () {
1126
- var _markerRef$current19;
1157
+ var _markerRef$current21;
1127
1158
 
1128
- 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)));
1159
+ 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)));
1129
1160
  }, [icon]);
1130
1161
  React.useEffect(function () {
1131
- var _markerRef$current20;
1162
+ var _markerRef$current22;
1132
1163
 
1133
- props.infoWindow != undefined && ((_markerRef$current20 = markerRef.current) === null || _markerRef$current20 === void 0 ? void 0 : _markerRef$current20.setInfoWindow(props.infoWindow));
1164
+ props.infoWindow != undefined && ((_markerRef$current22 = markerRef.current) === null || _markerRef$current22 === void 0 ? void 0 : _markerRef$current22.setInfoWindow(props.infoWindow));
1134
1165
  }, [props.infoWindow]);
1135
1166
  React.useEffect(function () {
1136
- var _markerRef$current21;
1167
+ var _markerRef$current23;
1137
1168
 
1138
- props.infoContents != undefined && ((_markerRef$current21 = markerRef.current) === null || _markerRef$current21 === void 0 ? void 0 : _markerRef$current21.setInfoContents(props.infoContents));
1169
+ props.infoContents != undefined && ((_markerRef$current23 = markerRef.current) === null || _markerRef$current23 === void 0 ? void 0 : _markerRef$current23.setInfoContents(props.infoContents));
1139
1170
  }, [props.infoContents]);
1140
1171
  React.useEffect(function () {
1141
1172
  if (props.showInfoWindow != undefined) {
1142
- props.showInfoWindow ? markerRef.current.showInfoWindow() : markerRef.current.hideInfoWindow();
1173
+ var _markerRef$current24, _markerRef$current25;
1174
+
1175
+ 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();
1143
1176
  }
1144
1177
  }, [props.showInfoWindow]);
1145
1178
  return null;
@@ -1444,6 +1477,7 @@ var MFPolygon = function MFPolygon(props) {
1444
1477
  zIndex = props.zIndex,
1445
1478
  userInteractionEnabled = props.userInteractionEnabled,
1446
1479
  map = props.map,
1480
+ onHover = props.onHover,
1447
1481
  onCreated = props.onCreated;
1448
1482
  var map4dContext = React.useContext(Map4dContext);
1449
1483
  var theMap = map || map4dContext.map;
@@ -1495,6 +1529,11 @@ var MFPolygon = function MFPolygon(props) {
1495
1529
  (_polygonRef$current4 = polygonRef.current) === null || _polygonRef$current4 === void 0 ? void 0 : _polygonRef$current4.setMap(null);
1496
1530
  };
1497
1531
  }, []);
1532
+ React.useEffect(function () {
1533
+ if (polygonRef.current) {
1534
+ polygonRef.current.onHover = onHover;
1535
+ }
1536
+ }, [onHover]);
1498
1537
  React.useEffect(function () {
1499
1538
  var _polygonRef$current5;
1500
1539
 
@@ -1562,6 +1601,8 @@ var MFPolyline = function MFPolyline(props) {
1562
1601
  strokePattern = props.strokePattern,
1563
1602
  userInteractionEnabled = props.userInteractionEnabled,
1564
1603
  map = props.map,
1604
+ onClick = props.onClick,
1605
+ onHover = props.onHover,
1565
1606
  onCreated = props.onCreated;
1566
1607
  var map4dContext = React.useContext(Map4dContext);
1567
1608
  var theMap = map || map4dContext.map;
@@ -1618,6 +1659,16 @@ var MFPolyline = function MFPolyline(props) {
1618
1659
  (_polylineRef$current4 = polylineRef.current) === null || _polylineRef$current4 === void 0 ? void 0 : _polylineRef$current4.setMap(null);
1619
1660
  };
1620
1661
  }, []);
1662
+ React.useEffect(function () {
1663
+ if (polylineRef.current) {
1664
+ polylineRef.current.onHover = onHover;
1665
+ }
1666
+ }, [onHover]);
1667
+ React.useEffect(function () {
1668
+ if (polylineRef.current) {
1669
+ polylineRef.current.onClick = onClick;
1670
+ }
1671
+ }, [onClick]);
1621
1672
  React.useEffect(function () {
1622
1673
  var _polylineRef$current5;
1623
1674