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.
- package/dist/components/MFPolyline.d.ts +1 -0
- package/dist/index.js +66 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +66 -11
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ interface PolylineProps {
|
|
|
13
13
|
map?: map4d.Map;
|
|
14
14
|
onCreated?: (polyline: map4d.Polyline) => void;
|
|
15
15
|
onHover?: (polyline: any) => void;
|
|
16
|
+
onClick?: (polyline: any) => void;
|
|
16
17
|
}
|
|
17
18
|
declare const MFPolyline: (props: PolylineProps) => null;
|
|
18
19
|
export default MFPolyline;
|
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;
|
|
@@ -812,7 +818,7 @@ var MFMap = function MFMap(props) {
|
|
|
812
818
|
}, [props.environment, props.version, props.accessKey]);
|
|
813
819
|
|
|
814
820
|
var registerEvent = function registerEvent() {
|
|
815
|
-
var _mapRef$current2, _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8;
|
|
821
|
+
var _mapRef$current2, _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8, _mapRef$current9;
|
|
816
822
|
|
|
817
823
|
var eventClickMarker = (_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.addListener("click", function (args) {
|
|
818
824
|
var _args$marker, _args$marker2;
|
|
@@ -863,12 +869,19 @@ var MFMap = function MFMap(props) {
|
|
|
863
869
|
}, {
|
|
864
870
|
directions: true
|
|
865
871
|
});
|
|
866
|
-
|
|
872
|
+
var eventClickPolyline = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("click", function (args) {
|
|
873
|
+
var _args$polyline3, _args$polyline4;
|
|
874
|
+
|
|
875
|
+
((_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());
|
|
876
|
+
}, {
|
|
877
|
+
polyline: true
|
|
878
|
+
});
|
|
879
|
+
events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline]);
|
|
867
880
|
|
|
868
881
|
if (props.onClickLocation) {
|
|
869
|
-
var _mapRef$
|
|
882
|
+
var _mapRef$current10;
|
|
870
883
|
|
|
871
|
-
var onClickLocation = (_mapRef$
|
|
884
|
+
var onClickLocation = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("click", function (args) {
|
|
872
885
|
props.onClickLocation && props.onClickLocation(args);
|
|
873
886
|
}, {
|
|
874
887
|
location: true
|
|
@@ -877,9 +890,9 @@ var MFMap = function MFMap(props) {
|
|
|
877
890
|
}
|
|
878
891
|
|
|
879
892
|
if (props.onRightClickLocation) {
|
|
880
|
-
var _mapRef$
|
|
893
|
+
var _mapRef$current11;
|
|
881
894
|
|
|
882
|
-
var onRightClickLocation = (_mapRef$
|
|
895
|
+
var onRightClickLocation = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("rightClick", function (args) {
|
|
883
896
|
props.onRightClickLocation && props.onRightClickLocation(args);
|
|
884
897
|
}, {
|
|
885
898
|
location: true
|
|
@@ -888,9 +901,9 @@ var MFMap = function MFMap(props) {
|
|
|
888
901
|
}
|
|
889
902
|
|
|
890
903
|
if (props.onTilesLoaded) {
|
|
891
|
-
var _mapRef$
|
|
904
|
+
var _mapRef$current12;
|
|
892
905
|
|
|
893
|
-
var onTilesLoaded = (_mapRef$
|
|
906
|
+
var onTilesLoaded = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("tilesLoaded", function (args) {
|
|
894
907
|
props.onTilesLoaded && props.onTilesLoaded(args);
|
|
895
908
|
}, {
|
|
896
909
|
location: true
|
|
@@ -899,9 +912,9 @@ var MFMap = function MFMap(props) {
|
|
|
899
912
|
}
|
|
900
913
|
|
|
901
914
|
if (props.onCameraChanging) {
|
|
902
|
-
var _mapRef$
|
|
915
|
+
var _mapRef$current13;
|
|
903
916
|
|
|
904
|
-
var onCameraChanging = (_mapRef$
|
|
917
|
+
var onCameraChanging = (_mapRef$current13 = mapRef.current) === null || _mapRef$current13 === void 0 ? void 0 : _mapRef$current13.addListener("cameraChanging", function (args) {
|
|
905
918
|
props.onCameraChanging && props.onCameraChanging(args);
|
|
906
919
|
}, {
|
|
907
920
|
location: true
|
|
@@ -949,7 +962,10 @@ var MFMarker = function MFMarker(props) {
|
|
|
949
962
|
userInteractionEnabled = props.userInteractionEnabled,
|
|
950
963
|
map = props.map,
|
|
951
964
|
onCreated = props.onCreated,
|
|
952
|
-
onClick = props.onClick
|
|
965
|
+
onClick = props.onClick,
|
|
966
|
+
onRightClick = props.onRightClick,
|
|
967
|
+
onDragEnd = props.onDragEnd,
|
|
968
|
+
onHover = props.onHover;
|
|
953
969
|
var map4dContext = React.useContext(Map4dContext);
|
|
954
970
|
var markerClusterContext = React.useContext(MarkerClusterContext);
|
|
955
971
|
var theMap = map || map4dContext.map;
|
|
@@ -1040,6 +1056,26 @@ var MFMarker = function MFMarker(props) {
|
|
|
1040
1056
|
markerRef.current && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker(markerRef.current));
|
|
1041
1057
|
};
|
|
1042
1058
|
}, []);
|
|
1059
|
+
React.useEffect(function () {
|
|
1060
|
+
if (markerRef.current) {
|
|
1061
|
+
markerRef.current.onHover = onHover;
|
|
1062
|
+
}
|
|
1063
|
+
}, [onHover]);
|
|
1064
|
+
React.useEffect(function () {
|
|
1065
|
+
if (markerRef.current) {
|
|
1066
|
+
markerRef.current.onClick = onClick;
|
|
1067
|
+
}
|
|
1068
|
+
}, [onClick]);
|
|
1069
|
+
React.useEffect(function () {
|
|
1070
|
+
if (markerRef.current) {
|
|
1071
|
+
markerRef.current.onRightClick = onRightClick;
|
|
1072
|
+
}
|
|
1073
|
+
}, [onRightClick]);
|
|
1074
|
+
React.useEffect(function () {
|
|
1075
|
+
if (markerRef.current) {
|
|
1076
|
+
markerRef.current.onHover = onDragEnd;
|
|
1077
|
+
}
|
|
1078
|
+
}, [onDragEnd]);
|
|
1043
1079
|
React.useEffect(function () {
|
|
1044
1080
|
var _markerRef$current4;
|
|
1045
1081
|
|
|
@@ -1437,6 +1473,7 @@ var MFPolygon = function MFPolygon(props) {
|
|
|
1437
1473
|
zIndex = props.zIndex,
|
|
1438
1474
|
userInteractionEnabled = props.userInteractionEnabled,
|
|
1439
1475
|
map = props.map,
|
|
1476
|
+
onHover = props.onHover,
|
|
1440
1477
|
onCreated = props.onCreated;
|
|
1441
1478
|
var map4dContext = React.useContext(Map4dContext);
|
|
1442
1479
|
var theMap = map || map4dContext.map;
|
|
@@ -1488,6 +1525,11 @@ var MFPolygon = function MFPolygon(props) {
|
|
|
1488
1525
|
(_polygonRef$current4 = polygonRef.current) === null || _polygonRef$current4 === void 0 ? void 0 : _polygonRef$current4.setMap(null);
|
|
1489
1526
|
};
|
|
1490
1527
|
}, []);
|
|
1528
|
+
React.useEffect(function () {
|
|
1529
|
+
if (polygonRef.current) {
|
|
1530
|
+
polygonRef.current.onHover = onHover;
|
|
1531
|
+
}
|
|
1532
|
+
}, [onHover]);
|
|
1491
1533
|
React.useEffect(function () {
|
|
1492
1534
|
var _polygonRef$current5;
|
|
1493
1535
|
|
|
@@ -1555,6 +1597,8 @@ var MFPolyline = function MFPolyline(props) {
|
|
|
1555
1597
|
strokePattern = props.strokePattern,
|
|
1556
1598
|
userInteractionEnabled = props.userInteractionEnabled,
|
|
1557
1599
|
map = props.map,
|
|
1600
|
+
onClick = props.onClick,
|
|
1601
|
+
onHover = props.onHover,
|
|
1558
1602
|
onCreated = props.onCreated;
|
|
1559
1603
|
var map4dContext = React.useContext(Map4dContext);
|
|
1560
1604
|
var theMap = map || map4dContext.map;
|
|
@@ -1587,6 +1631,7 @@ var MFPolyline = function MFPolyline(props) {
|
|
|
1587
1631
|
polylineRef.current = new map4d.Polyline(option);
|
|
1588
1632
|
(_polylineRef$current = polylineRef.current) === null || _polylineRef$current === void 0 ? void 0 : _polylineRef$current.setMap(theMap);
|
|
1589
1633
|
polylineRef.current.onHover = props.onHover;
|
|
1634
|
+
polylineRef.current.onClick = props.onClick;
|
|
1590
1635
|
onCreated && onCreated(polylineRef.current);
|
|
1591
1636
|
}
|
|
1592
1637
|
}, [theMap]);
|
|
@@ -1610,6 +1655,16 @@ var MFPolyline = function MFPolyline(props) {
|
|
|
1610
1655
|
(_polylineRef$current4 = polylineRef.current) === null || _polylineRef$current4 === void 0 ? void 0 : _polylineRef$current4.setMap(null);
|
|
1611
1656
|
};
|
|
1612
1657
|
}, []);
|
|
1658
|
+
React.useEffect(function () {
|
|
1659
|
+
if (polylineRef.current) {
|
|
1660
|
+
polylineRef.current.onHover = onHover;
|
|
1661
|
+
}
|
|
1662
|
+
}, [onHover]);
|
|
1663
|
+
React.useEffect(function () {
|
|
1664
|
+
if (polylineRef.current) {
|
|
1665
|
+
polylineRef.current.onClick = onClick;
|
|
1666
|
+
}
|
|
1667
|
+
}, [onClick]);
|
|
1613
1668
|
React.useEffect(function () {
|
|
1614
1669
|
var _polylineRef$current5;
|
|
1615
1670
|
|