react-map4d-map 1.0.1 → 1.0.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/MFMap.d.ts +4 -0
- package/dist/components/MFMarker.d.ts +19 -1
- package/dist/enum/index.d.ts +2 -0
- package/dist/enum/mapEventEnum.d.ts +5 -0
- package/dist/index.js +77 -62
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +77 -62
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,10 +15,14 @@ declare class MFMap extends React.Component<MapProps, any> {
|
|
|
15
15
|
mapRef: map4d.Map;
|
|
16
16
|
scriptElement: any;
|
|
17
17
|
url: string | null;
|
|
18
|
+
eventClickMarker: any;
|
|
19
|
+
eventRightClickMarker: any;
|
|
20
|
+
eventDragEndMarker: any;
|
|
18
21
|
constructor(props: MapProps);
|
|
19
22
|
setMapDomRef(e: any): void;
|
|
20
23
|
componentWillUnmount(): void;
|
|
21
24
|
destroy(): void;
|
|
25
|
+
registerEvent(): void;
|
|
22
26
|
createCallback(): void;
|
|
23
27
|
render(): JSX.Element;
|
|
24
28
|
}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
interface MarkerProps extends map4d.MarkerOptions {
|
|
2
|
+
position: any;
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
anchor?: any;
|
|
5
|
+
labelAnchor?: any;
|
|
6
|
+
icon?: any;
|
|
7
|
+
elevation?: number;
|
|
8
|
+
rotation?: number;
|
|
9
|
+
title?: string;
|
|
10
|
+
snippet?: string;
|
|
11
|
+
windowAnchor?: any;
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
label?: any;
|
|
14
|
+
draggable?: boolean;
|
|
15
|
+
iconView?: string | Node;
|
|
16
|
+
userInteractionEnabled?: boolean;
|
|
2
17
|
map?: map4d.Map;
|
|
3
|
-
|
|
18
|
+
onClick: (marker: any) => void;
|
|
19
|
+
onCreated: (marker: any) => void;
|
|
20
|
+
onRightClick: (marker: any) => void;
|
|
21
|
+
onDragEnd: (marker: any) => void;
|
|
4
22
|
}
|
|
5
23
|
declare const MFMarker: (props: MarkerProps) => null;
|
|
6
24
|
export default MFMarker;
|
package/dist/index.js
CHANGED
|
@@ -709,23 +709,6 @@ var MFImageOverlay = function MFImageOverlay(props) {
|
|
|
709
709
|
return null;
|
|
710
710
|
};
|
|
711
711
|
|
|
712
|
-
function _extends() {
|
|
713
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
714
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
715
|
-
var source = arguments[i];
|
|
716
|
-
|
|
717
|
-
for (var key in source) {
|
|
718
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
719
|
-
target[key] = source[key];
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
return target;
|
|
725
|
-
};
|
|
726
|
-
return _extends.apply(this, arguments);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
712
|
function _inheritsLoose(subClass, superClass) {
|
|
730
713
|
subClass.prototype = Object.create(superClass.prototype);
|
|
731
714
|
subClass.prototype.constructor = subClass;
|
|
@@ -802,7 +785,7 @@ var MFMap = /*#__PURE__*/function (_React$Component) {
|
|
|
802
785
|
};
|
|
803
786
|
|
|
804
787
|
_proto.destroy = function destroy() {
|
|
805
|
-
var _this$mapRef;
|
|
788
|
+
var _this$eventClickMarke, _this$eventRightClick, _this$eventDragEndMar, _this$mapRef;
|
|
806
789
|
|
|
807
790
|
delete window[this.callback];
|
|
808
791
|
|
|
@@ -810,10 +793,39 @@ var MFMap = /*#__PURE__*/function (_React$Component) {
|
|
|
810
793
|
this.scriptElement.remove();
|
|
811
794
|
}
|
|
812
795
|
|
|
796
|
+
(_this$eventClickMarke = this.eventClickMarker) === null || _this$eventClickMarke === void 0 ? void 0 : _this$eventClickMarke.remove();
|
|
797
|
+
(_this$eventRightClick = this.eventRightClickMarker) === null || _this$eventRightClick === void 0 ? void 0 : _this$eventRightClick.remove();
|
|
798
|
+
(_this$eventDragEndMar = this.eventDragEndMarker) === null || _this$eventDragEndMar === void 0 ? void 0 : _this$eventDragEndMar.remove();
|
|
813
799
|
((_this$mapRef = this.mapRef) === null || _this$mapRef === void 0 ? void 0 : _this$mapRef.destroy) && this.mapRef.destroy();
|
|
814
800
|
this.url = null;
|
|
815
801
|
};
|
|
816
802
|
|
|
803
|
+
_proto.registerEvent = function registerEvent() {
|
|
804
|
+
var _this$mapRef2, _this$mapRef3, _this$mapRef4;
|
|
805
|
+
|
|
806
|
+
this.eventClickMarker = (_this$mapRef2 = this.mapRef) === null || _this$mapRef2 === void 0 ? void 0 : _this$mapRef2.addListener("click", function (args) {
|
|
807
|
+
var _args$marker, _args$marker2;
|
|
808
|
+
|
|
809
|
+
((_args$marker = args.marker) === null || _args$marker === void 0 ? void 0 : _args$marker.onClick) && ((_args$marker2 = args.marker) === null || _args$marker2 === void 0 ? void 0 : _args$marker2.onClick());
|
|
810
|
+
}, {
|
|
811
|
+
marker: true
|
|
812
|
+
});
|
|
813
|
+
this.eventRightClickMarker = (_this$mapRef3 = this.mapRef) === null || _this$mapRef3 === void 0 ? void 0 : _this$mapRef3.addListener("rightClick", function (args) {
|
|
814
|
+
var _args$marker3, _args$marker4;
|
|
815
|
+
|
|
816
|
+
((_args$marker3 = args.marker) === null || _args$marker3 === void 0 ? void 0 : _args$marker3.onRightClick) && ((_args$marker4 = args.marker) === null || _args$marker4 === void 0 ? void 0 : _args$marker4.onRightClick());
|
|
817
|
+
}, {
|
|
818
|
+
marker: true
|
|
819
|
+
});
|
|
820
|
+
this.eventDragEndMarker = (_this$mapRef4 = this.mapRef) === null || _this$mapRef4 === void 0 ? void 0 : _this$mapRef4.addListener("dragEnd", function (args) {
|
|
821
|
+
var _args$marker5, _args$marker6;
|
|
822
|
+
|
|
823
|
+
((_args$marker5 = args.marker) === null || _args$marker5 === void 0 ? void 0 : _args$marker5.onDragEnd) && ((_args$marker6 = args.marker) === null || _args$marker6 === void 0 ? void 0 : _args$marker6.onDragEnd());
|
|
824
|
+
}, {
|
|
825
|
+
marker: true
|
|
826
|
+
});
|
|
827
|
+
};
|
|
828
|
+
|
|
817
829
|
_proto.createCallback = function createCallback() {
|
|
818
830
|
var _this2 = this;
|
|
819
831
|
|
|
@@ -826,6 +838,8 @@ var MFMap = /*#__PURE__*/function (_React$Component) {
|
|
|
826
838
|
_this2.props.onMapReady(_this2.mapRef, _this2.mapKey);
|
|
827
839
|
}
|
|
828
840
|
|
|
841
|
+
_this2.registerEvent();
|
|
842
|
+
|
|
829
843
|
_this2.setState({
|
|
830
844
|
map: _this2.mapRef
|
|
831
845
|
});
|
|
@@ -853,10 +867,9 @@ var MFMap = /*#__PURE__*/function (_React$Component) {
|
|
|
853
867
|
}
|
|
854
868
|
|
|
855
869
|
this.url = url;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
newContext.map = this.state.map;
|
|
870
|
+
var newContext = {
|
|
871
|
+
map: this.state.map
|
|
872
|
+
};
|
|
860
873
|
return React__default.createElement(Map4dContext.Provider, {
|
|
861
874
|
value: newContext
|
|
862
875
|
}, React__default.createElement("div", {
|
|
@@ -893,7 +906,8 @@ var MFMarker = function MFMarker(props) {
|
|
|
893
906
|
iconView = props.iconView,
|
|
894
907
|
userInteractionEnabled = props.userInteractionEnabled,
|
|
895
908
|
map = props.map,
|
|
896
|
-
onCreated = props.onCreated
|
|
909
|
+
onCreated = props.onCreated,
|
|
910
|
+
onClick = props.onClick;
|
|
897
911
|
var map4dContext = React.useContext(Map4dContext);
|
|
898
912
|
var markerClusterContext = React.useContext(MarkerClusterContext);
|
|
899
913
|
var theMap = map || map4dContext.map;
|
|
@@ -928,11 +942,12 @@ var MFMarker = function MFMarker(props) {
|
|
|
928
942
|
markerRef.current = new map4d.Marker(option);
|
|
929
943
|
|
|
930
944
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
(_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.setMap(theMap);
|
|
945
|
+
markerRef.current.setMap(theMap);
|
|
934
946
|
}
|
|
935
947
|
|
|
948
|
+
markerRef.current.onClick = onClick;
|
|
949
|
+
markerRef.current.onRightClick = props.onRightClick;
|
|
950
|
+
markerRef.current.onDragEnd = props.onDragEnd;
|
|
936
951
|
onCreated && onCreated(markerRef.current);
|
|
937
952
|
(markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.addMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.addMarker(markerRef.current));
|
|
938
953
|
}
|
|
@@ -940,105 +955,105 @@ var MFMarker = function MFMarker(props) {
|
|
|
940
955
|
React.useEffect(function () {
|
|
941
956
|
if (theMap) {
|
|
942
957
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
943
|
-
var _markerRef$
|
|
958
|
+
var _markerRef$current;
|
|
944
959
|
|
|
945
|
-
(_markerRef$
|
|
960
|
+
(_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.setMap(theMap);
|
|
946
961
|
}
|
|
947
962
|
}
|
|
948
963
|
|
|
949
964
|
return function () {
|
|
950
965
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
951
|
-
var _markerRef$
|
|
966
|
+
var _markerRef$current2;
|
|
952
967
|
|
|
953
|
-
(_markerRef$
|
|
968
|
+
(_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : _markerRef$current2.setMap(null);
|
|
954
969
|
}
|
|
955
970
|
};
|
|
956
971
|
}, [theMap]);
|
|
957
972
|
React.useEffect(function () {
|
|
958
973
|
return function () {
|
|
959
974
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
960
|
-
var _markerRef$
|
|
975
|
+
var _markerRef$current3;
|
|
961
976
|
|
|
962
|
-
(_markerRef$
|
|
977
|
+
(_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : _markerRef$current3.setMap(null);
|
|
963
978
|
}
|
|
964
979
|
|
|
965
980
|
markerRef.current && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker(markerRef.current));
|
|
966
981
|
};
|
|
967
982
|
}, []);
|
|
968
983
|
React.useEffect(function () {
|
|
969
|
-
var _markerRef$
|
|
984
|
+
var _markerRef$current4;
|
|
970
985
|
|
|
971
|
-
(_markerRef$
|
|
986
|
+
(_markerRef$current4 = markerRef.current) === null || _markerRef$current4 === void 0 ? void 0 : _markerRef$current4.setPosition(position);
|
|
972
987
|
}, [position]);
|
|
973
988
|
React.useEffect(function () {
|
|
974
|
-
var _markerRef$
|
|
989
|
+
var _markerRef$current5;
|
|
975
990
|
|
|
976
|
-
(_markerRef$
|
|
991
|
+
(_markerRef$current5 = markerRef.current) === null || _markerRef$current5 === void 0 ? void 0 : _markerRef$current5.setVisible(visible);
|
|
977
992
|
}, [visible]);
|
|
978
993
|
React.useEffect(function () {
|
|
979
|
-
var _markerRef$
|
|
994
|
+
var _markerRef$current6;
|
|
980
995
|
|
|
981
|
-
anchor != undefined && ((_markerRef$
|
|
996
|
+
anchor != undefined && ((_markerRef$current6 = markerRef.current) === null || _markerRef$current6 === void 0 ? void 0 : _markerRef$current6.setAnchor(anchor));
|
|
982
997
|
}, [anchor]);
|
|
983
998
|
React.useEffect(function () {
|
|
984
|
-
var _markerRef$
|
|
999
|
+
var _markerRef$current7;
|
|
985
1000
|
|
|
986
|
-
labelAnchor != undefined && ((_markerRef$
|
|
1001
|
+
labelAnchor != undefined && ((_markerRef$current7 = markerRef.current) === null || _markerRef$current7 === void 0 ? void 0 : _markerRef$current7.setLabelAnchor(labelAnchor));
|
|
987
1002
|
}, [labelAnchor]);
|
|
988
1003
|
React.useEffect(function () {
|
|
989
|
-
var _markerRef$
|
|
1004
|
+
var _markerRef$current8;
|
|
990
1005
|
|
|
991
|
-
icon != undefined && ((_markerRef$
|
|
1006
|
+
icon != undefined && ((_markerRef$current8 = markerRef.current) === null || _markerRef$current8 === void 0 ? void 0 : _markerRef$current8.setIcon(icon));
|
|
992
1007
|
}, [icon]);
|
|
993
1008
|
React.useEffect(function () {
|
|
994
|
-
var _markerRef$
|
|
1009
|
+
var _markerRef$current9;
|
|
995
1010
|
|
|
996
|
-
elevation != undefined && ((_markerRef$
|
|
1011
|
+
elevation != undefined && ((_markerRef$current9 = markerRef.current) === null || _markerRef$current9 === void 0 ? void 0 : _markerRef$current9.setElevation(elevation));
|
|
997
1012
|
}, [elevation]);
|
|
998
1013
|
React.useEffect(function () {
|
|
999
|
-
var _markerRef$
|
|
1014
|
+
var _markerRef$current10;
|
|
1000
1015
|
|
|
1001
|
-
rotation != undefined && ((_markerRef$
|
|
1016
|
+
rotation != undefined && ((_markerRef$current10 = markerRef.current) === null || _markerRef$current10 === void 0 ? void 0 : _markerRef$current10.setRotation(rotation));
|
|
1002
1017
|
}, [rotation]);
|
|
1003
1018
|
React.useEffect(function () {
|
|
1004
|
-
var _markerRef$
|
|
1019
|
+
var _markerRef$current11;
|
|
1005
1020
|
|
|
1006
|
-
title != undefined && ((_markerRef$
|
|
1021
|
+
title != undefined && ((_markerRef$current11 = markerRef.current) === null || _markerRef$current11 === void 0 ? void 0 : _markerRef$current11.setTitle(title));
|
|
1007
1022
|
}, [title]);
|
|
1008
1023
|
React.useEffect(function () {
|
|
1009
|
-
var _markerRef$
|
|
1024
|
+
var _markerRef$current12;
|
|
1010
1025
|
|
|
1011
|
-
snippet != undefined && ((_markerRef$
|
|
1026
|
+
snippet != undefined && ((_markerRef$current12 = markerRef.current) === null || _markerRef$current12 === void 0 ? void 0 : _markerRef$current12.setSnippet(snippet));
|
|
1012
1027
|
}, [snippet]);
|
|
1013
1028
|
React.useEffect(function () {
|
|
1014
|
-
var _markerRef$
|
|
1029
|
+
var _markerRef$current13;
|
|
1015
1030
|
|
|
1016
|
-
windowAnchor != undefined && ((_markerRef$
|
|
1031
|
+
windowAnchor != undefined && ((_markerRef$current13 = markerRef.current) === null || _markerRef$current13 === void 0 ? void 0 : _markerRef$current13.setWindowAnchor(windowAnchor));
|
|
1017
1032
|
}, [windowAnchor]);
|
|
1018
1033
|
React.useEffect(function () {
|
|
1019
|
-
var _markerRef$
|
|
1034
|
+
var _markerRef$current14;
|
|
1020
1035
|
|
|
1021
|
-
zIndex != undefined && ((_markerRef$
|
|
1036
|
+
zIndex != undefined && ((_markerRef$current14 = markerRef.current) === null || _markerRef$current14 === void 0 ? void 0 : _markerRef$current14.setZIndex(zIndex));
|
|
1022
1037
|
}, [zIndex]);
|
|
1023
1038
|
React.useEffect(function () {
|
|
1024
|
-
var _markerRef$
|
|
1039
|
+
var _markerRef$current15;
|
|
1025
1040
|
|
|
1026
|
-
label != undefined && ((_markerRef$
|
|
1041
|
+
label != undefined && ((_markerRef$current15 = markerRef.current) === null || _markerRef$current15 === void 0 ? void 0 : _markerRef$current15.setLabel(label));
|
|
1027
1042
|
}, [label]);
|
|
1028
1043
|
React.useEffect(function () {
|
|
1029
|
-
var _markerRef$
|
|
1044
|
+
var _markerRef$current16;
|
|
1030
1045
|
|
|
1031
|
-
draggable != undefined && ((_markerRef$
|
|
1046
|
+
draggable != undefined && ((_markerRef$current16 = markerRef.current) === null || _markerRef$current16 === void 0 ? void 0 : _markerRef$current16.setDraggable(draggable));
|
|
1032
1047
|
}, [draggable]);
|
|
1033
1048
|
React.useEffect(function () {
|
|
1034
|
-
var _markerRef$
|
|
1049
|
+
var _markerRef$current17;
|
|
1035
1050
|
|
|
1036
|
-
iconView != undefined && ((_markerRef$
|
|
1051
|
+
iconView != undefined && ((_markerRef$current17 = markerRef.current) === null || _markerRef$current17 === void 0 ? void 0 : _markerRef$current17.setIconView(iconView));
|
|
1037
1052
|
}, [iconView]);
|
|
1038
1053
|
React.useEffect(function () {
|
|
1039
|
-
var _markerRef$
|
|
1054
|
+
var _markerRef$current18;
|
|
1040
1055
|
|
|
1041
|
-
userInteractionEnabled != undefined && ((_markerRef$
|
|
1056
|
+
userInteractionEnabled != undefined && ((_markerRef$current18 = markerRef.current) === null || _markerRef$current18 === void 0 ? void 0 : _markerRef$current18.setUserInteraction(userInteractionEnabled));
|
|
1042
1057
|
}, [userInteractionEnabled]);
|
|
1043
1058
|
return null;
|
|
1044
1059
|
};
|