react-map4d-map 1.2.8 → 1.2.9

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.
@@ -761,7 +761,7 @@ var createId = function createId() {
761
761
  };
762
762
 
763
763
  var MFMap = function MFMap(props) {
764
- var _props$options3;
764
+ var _props$options3, _props$options8;
765
765
 
766
766
  var callback = useRef("callback");
767
767
  var mapDomRef = useRef();
@@ -831,143 +831,156 @@ var MFMap = function MFMap(props) {
831
831
 
832
832
  destroy();
833
833
  };
834
- }, [props.environment, props.version, props.accessKey, props.options]);
834
+ }, [props.environment, props.version, props.accessKey]);
835
835
  useEffect(function () {
836
836
  var _props$options, _mapRef$current2, _props$options2;
837
837
 
838
838
  ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.mapType) != undefined && ((_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.setMapType((_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _props$options2.mapType));
839
839
  }, [(_props$options3 = props.options) === null || _props$options3 === void 0 ? void 0 : _props$options3.mapType]);
840
+ useEffect(function () {
841
+ var _props$options4, _props$options6, _mapRef$current4, _props$options7;
842
+
843
+ if (((_props$options4 = props.options) === null || _props$options4 === void 0 ? void 0 : _props$options4.center) != undefined) {
844
+ var _props$options5, _mapRef$current3;
845
+
846
+ var camera = mapRef.current.getCamera();
847
+ camera.setTarget((_props$options5 = props.options) === null || _props$options5 === void 0 ? void 0 : _props$options5.center);
848
+ (_mapRef$current3 = mapRef.current) === null || _mapRef$current3 === void 0 ? void 0 : _mapRef$current3.moveCamera(camera);
849
+ }
850
+
851
+ ((_props$options6 = props.options) === null || _props$options6 === void 0 ? void 0 : _props$options6.mapType) != undefined && ((_mapRef$current4 = mapRef.current) === null || _mapRef$current4 === void 0 ? void 0 : _mapRef$current4.setMapType((_props$options7 = props.options) === null || _props$options7 === void 0 ? void 0 : _props$options7.mapType));
852
+ }, [(_props$options8 = props.options) === null || _props$options8 === void 0 ? void 0 : _props$options8.center]);
840
853
 
841
854
  var registerEvent = function registerEvent() {
842
- var _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8, _mapRef$current9, _mapRef$current10, _mapRef$current11, _mapRef$current12, _mapRef$current13, _mapRef$current14, _mapRef$current15, _mapRef$current16, _mapRef$current17, _mapRef$current18, _mapRef$current19, _mapRef$current20, _mapRef$current21;
855
+ var _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8, _mapRef$current9, _mapRef$current10, _mapRef$current11, _mapRef$current12, _mapRef$current13, _mapRef$current14, _mapRef$current15, _mapRef$current16, _mapRef$current17, _mapRef$current18, _mapRef$current19, _mapRef$current20, _mapRef$current21, _mapRef$current22, _mapRef$current23;
843
856
 
844
- var eventClickMarker = (_mapRef$current3 = mapRef.current) === null || _mapRef$current3 === void 0 ? void 0 : _mapRef$current3.addListener("click", function (args) {
857
+ var eventClickMarker = (_mapRef$current5 = mapRef.current) === null || _mapRef$current5 === void 0 ? void 0 : _mapRef$current5.addListener("click", function (args) {
845
858
  var _args$marker, _args$marker2;
846
859
 
847
860
  ((_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(args));
848
861
  }, {
849
862
  marker: true
850
863
  });
851
- var eventRightClickMarker = (_mapRef$current4 = mapRef.current) === null || _mapRef$current4 === void 0 ? void 0 : _mapRef$current4.addListener("rightClick", function (args) {
864
+ var eventRightClickMarker = (_mapRef$current6 = mapRef.current) === null || _mapRef$current6 === void 0 ? void 0 : _mapRef$current6.addListener("rightClick", function (args) {
852
865
  var _args$marker3, _args$marker4;
853
866
 
854
867
  ((_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(args));
855
868
  }, {
856
869
  marker: true
857
870
  });
858
- var eventDragEndMarker = (_mapRef$current5 = mapRef.current) === null || _mapRef$current5 === void 0 ? void 0 : _mapRef$current5.addListener("dragEnd", function (args) {
871
+ var eventDragEndMarker = (_mapRef$current7 = mapRef.current) === null || _mapRef$current7 === void 0 ? void 0 : _mapRef$current7.addListener("dragEnd", function (args) {
859
872
  var _args$marker5, _args$marker6;
860
873
 
861
874
  ((_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(args));
862
875
  }, {
863
876
  marker: true
864
877
  });
865
- var eventHoverMarker = (_mapRef$current6 = mapRef.current) === null || _mapRef$current6 === void 0 ? void 0 : _mapRef$current6.addListener("hover", function (args) {
878
+ var eventHoverMarker = (_mapRef$current8 = mapRef.current) === null || _mapRef$current8 === void 0 ? void 0 : _mapRef$current8.addListener("hover", function (args) {
866
879
  var _args$marker7, _args$marker8;
867
880
 
868
881
  ((_args$marker7 = args.marker) === null || _args$marker7 === void 0 ? void 0 : _args$marker7.onHover) && ((_args$marker8 = args.marker) === null || _args$marker8 === void 0 ? void 0 : _args$marker8.onHover(args));
869
882
  }, {
870
883
  marker: true
871
884
  });
872
- var eventHoverPolygon = (_mapRef$current7 = mapRef.current) === null || _mapRef$current7 === void 0 ? void 0 : _mapRef$current7.addListener("hover", function (args) {
885
+ var eventHoverPolygon = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("hover", function (args) {
873
886
  var _args$polygon, _args$polygon2;
874
887
 
875
888
  ((_args$polygon = args.polygon) === null || _args$polygon === void 0 ? void 0 : _args$polygon.onHover) && ((_args$polygon2 = args.polygon) === null || _args$polygon2 === void 0 ? void 0 : _args$polygon2.onHover(args));
876
889
  }, {
877
890
  polygon: true
878
891
  });
879
- var eventHoverPolyline = (_mapRef$current8 = mapRef.current) === null || _mapRef$current8 === void 0 ? void 0 : _mapRef$current8.addListener("hover", function (args) {
892
+ var eventHoverPolyline = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("hover", function (args) {
880
893
  var _args$polyline, _args$polyline2;
881
894
 
882
895
  ((_args$polyline = args.polyline) === null || _args$polyline === void 0 ? void 0 : _args$polyline.onHover) && ((_args$polyline2 = args.polyline) === null || _args$polyline2 === void 0 ? void 0 : _args$polyline2.onHover(args));
883
896
  }, {
884
897
  polyline: true
885
898
  });
886
- var eventHoverDirection = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("hover", function (args) {
899
+ var eventHoverDirection = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("hover", function (args) {
887
900
  var _args$renderer, _args$renderer2;
888
901
 
889
902
  ((_args$renderer = args.renderer) === null || _args$renderer === void 0 ? void 0 : _args$renderer.onHover) && ((_args$renderer2 = args.renderer) === null || _args$renderer2 === void 0 ? void 0 : _args$renderer2.onHover(args));
890
903
  }, {
891
904
  directions: true
892
905
  });
893
- var eventClickPolyline = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("click", function (args) {
906
+ var eventClickPolyline = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("click", function (args) {
894
907
  var _args$polyline3, _args$polyline4;
895
908
 
896
909
  ((_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(args));
897
910
  }, {
898
911
  polyline: true
899
912
  });
900
- var eventMouseOutDirection = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("mouseOut", function (args) {
913
+ var eventMouseOutDirection = (_mapRef$current13 = mapRef.current) === null || _mapRef$current13 === void 0 ? void 0 : _mapRef$current13.addListener("mouseOut", function (args) {
901
914
  var _args$renderer3, _args$renderer4;
902
915
 
903
916
  ((_args$renderer3 = args.renderer) === null || _args$renderer3 === void 0 ? void 0 : _args$renderer3.onMouseOut) && ((_args$renderer4 = args.renderer) === null || _args$renderer4 === void 0 ? void 0 : _args$renderer4.onMouseOut(args));
904
917
  }, {
905
918
  directions: true
906
919
  });
907
- var eventMouseOverDirection = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("mouseOver", function (args) {
920
+ var eventMouseOverDirection = (_mapRef$current14 = mapRef.current) === null || _mapRef$current14 === void 0 ? void 0 : _mapRef$current14.addListener("mouseOver", function (args) {
908
921
  var _args$renderer5, _args$renderer6;
909
922
 
910
923
  ((_args$renderer5 = args.renderer) === null || _args$renderer5 === void 0 ? void 0 : _args$renderer5.onMouseOver) && ((_args$renderer6 = args.renderer) === null || _args$renderer6 === void 0 ? void 0 : _args$renderer6.onMouseOver(args));
911
924
  }, {
912
925
  directions: true
913
926
  });
914
- var eventMouseMoveDirection = (_mapRef$current13 = mapRef.current) === null || _mapRef$current13 === void 0 ? void 0 : _mapRef$current13.addListener("mouseMove", function (args) {
927
+ var eventMouseMoveDirection = (_mapRef$current15 = mapRef.current) === null || _mapRef$current15 === void 0 ? void 0 : _mapRef$current15.addListener("mouseMove", function (args) {
915
928
  var _args$renderer7, _args$renderer8;
916
929
 
917
930
  ((_args$renderer7 = args.renderer) === null || _args$renderer7 === void 0 ? void 0 : _args$renderer7.onMouseMove) && ((_args$renderer8 = args.renderer) === null || _args$renderer8 === void 0 ? void 0 : _args$renderer8.onMouseMove(args));
918
931
  }, {
919
932
  directions: true
920
933
  });
921
- var eventMouseOutPolyline = (_mapRef$current14 = mapRef.current) === null || _mapRef$current14 === void 0 ? void 0 : _mapRef$current14.addListener("mouseOut", function (args) {
934
+ var eventMouseOutPolyline = (_mapRef$current16 = mapRef.current) === null || _mapRef$current16 === void 0 ? void 0 : _mapRef$current16.addListener("mouseOut", function (args) {
922
935
  var _args$polyline5, _args$polyline6;
923
936
 
924
937
  ((_args$polyline5 = args.polyline) === null || _args$polyline5 === void 0 ? void 0 : _args$polyline5.onMouseOut) && ((_args$polyline6 = args.polyline) === null || _args$polyline6 === void 0 ? void 0 : _args$polyline6.onMouseOut(args));
925
938
  }, {
926
939
  polyline: true
927
940
  });
928
- var eventMouseOverPolyline = (_mapRef$current15 = mapRef.current) === null || _mapRef$current15 === void 0 ? void 0 : _mapRef$current15.addListener("mouseOver", function (args) {
941
+ var eventMouseOverPolyline = (_mapRef$current17 = mapRef.current) === null || _mapRef$current17 === void 0 ? void 0 : _mapRef$current17.addListener("mouseOver", function (args) {
929
942
  var _args$polyline7, _args$polyline8;
930
943
 
931
944
  ((_args$polyline7 = args.polyline) === null || _args$polyline7 === void 0 ? void 0 : _args$polyline7.onMouseOver) && ((_args$polyline8 = args.polyline) === null || _args$polyline8 === void 0 ? void 0 : _args$polyline8.onMouseOver(args));
932
945
  }, {
933
946
  polyline: true
934
947
  });
935
- var eventMouseMovePolyline = (_mapRef$current16 = mapRef.current) === null || _mapRef$current16 === void 0 ? void 0 : _mapRef$current16.addListener("mouseMove", function (args) {
948
+ var eventMouseMovePolyline = (_mapRef$current18 = mapRef.current) === null || _mapRef$current18 === void 0 ? void 0 : _mapRef$current18.addListener("mouseMove", function (args) {
936
949
  var _args$polyline9, _args$polyline10;
937
950
 
938
951
  ((_args$polyline9 = args.polyline) === null || _args$polyline9 === void 0 ? void 0 : _args$polyline9.onMouseMove) && ((_args$polyline10 = args.polyline) === null || _args$polyline10 === void 0 ? void 0 : _args$polyline10.onMouseMove(args));
939
952
  }, {
940
953
  polyline: true
941
954
  });
942
- var eventMouseOutMarker = (_mapRef$current17 = mapRef.current) === null || _mapRef$current17 === void 0 ? void 0 : _mapRef$current17.addListener("mouseOut", function (args) {
955
+ var eventMouseOutMarker = (_mapRef$current19 = mapRef.current) === null || _mapRef$current19 === void 0 ? void 0 : _mapRef$current19.addListener("mouseOut", function (args) {
943
956
  var _args$marker9, _args$marker10;
944
957
 
945
958
  ((_args$marker9 = args.marker) === null || _args$marker9 === void 0 ? void 0 : _args$marker9.onMouseOut) && ((_args$marker10 = args.marker) === null || _args$marker10 === void 0 ? void 0 : _args$marker10.onMouseOut(args));
946
959
  }, {
947
960
  marker: true
948
961
  });
949
- var eventMouseOverMarker = (_mapRef$current18 = mapRef.current) === null || _mapRef$current18 === void 0 ? void 0 : _mapRef$current18.addListener("mouseOver", function (args) {
962
+ var eventMouseOverMarker = (_mapRef$current20 = mapRef.current) === null || _mapRef$current20 === void 0 ? void 0 : _mapRef$current20.addListener("mouseOver", function (args) {
950
963
  var _args$marker11, _args$marker12;
951
964
 
952
965
  ((_args$marker11 = args.marker) === null || _args$marker11 === void 0 ? void 0 : _args$marker11.onMouseOver) && ((_args$marker12 = args.marker) === null || _args$marker12 === void 0 ? void 0 : _args$marker12.onMouseOver(args));
953
966
  }, {
954
967
  marker: true
955
968
  });
956
- var eventMouseMoveMarker = (_mapRef$current19 = mapRef.current) === null || _mapRef$current19 === void 0 ? void 0 : _mapRef$current19.addListener("mouseMove", function (args) {
969
+ var eventMouseMoveMarker = (_mapRef$current21 = mapRef.current) === null || _mapRef$current21 === void 0 ? void 0 : _mapRef$current21.addListener("mouseMove", function (args) {
957
970
  var _args$marker13, _args$marker14;
958
971
 
959
972
  ((_args$marker13 = args.marker) === null || _args$marker13 === void 0 ? void 0 : _args$marker13.onMouseMove) && ((_args$marker14 = args.marker) === null || _args$marker14 === void 0 ? void 0 : _args$marker14.onMouseMove(args));
960
973
  }, {
961
974
  marker: true
962
975
  });
963
- var eventClickPoi = (_mapRef$current20 = mapRef.current) === null || _mapRef$current20 === void 0 ? void 0 : _mapRef$current20.addListener("click", function (args) {
976
+ var eventClickPoi = (_mapRef$current22 = mapRef.current) === null || _mapRef$current22 === void 0 ? void 0 : _mapRef$current22.addListener("click", function (args) {
964
977
  var _args$poi, _args$poi2;
965
978
 
966
979
  ((_args$poi = args.poi) === null || _args$poi === void 0 ? void 0 : _args$poi.onClick) && ((_args$poi2 = args.poi) === null || _args$poi2 === void 0 ? void 0 : _args$poi2.onClick(args));
967
980
  }, {
968
981
  poi: true
969
982
  });
970
- var eventHoverPoi = (_mapRef$current21 = mapRef.current) === null || _mapRef$current21 === void 0 ? void 0 : _mapRef$current21.addListener("hover", function (args) {
983
+ var eventHoverPoi = (_mapRef$current23 = mapRef.current) === null || _mapRef$current23 === void 0 ? void 0 : _mapRef$current23.addListener("hover", function (args) {
971
984
  var _args$poi3, _args$poi4;
972
985
 
973
986
  ((_args$poi3 = args.poi) === null || _args$poi3 === void 0 ? void 0 : _args$poi3.onHover) && ((_args$poi4 = args.poi) === null || _args$poi4 === void 0 ? void 0 : _args$poi4.onHover(args));
@@ -977,9 +990,9 @@ var MFMap = function MFMap(props) {
977
990
  events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline, eventMouseOutDirection, eventMouseOverDirection, eventMouseMoveDirection, eventMouseOutPolyline, eventMouseOverPolyline, eventMouseMovePolyline, eventMouseOutMarker, eventMouseOverMarker, eventMouseMoveMarker, eventClickPoi, eventHoverPoi]);
978
991
 
979
992
  if (props.onClickLocation) {
980
- var _mapRef$current22;
993
+ var _mapRef$current24;
981
994
 
982
- var onClickLocation = (_mapRef$current22 = mapRef.current) === null || _mapRef$current22 === void 0 ? void 0 : _mapRef$current22.addListener("click", function (args) {
995
+ var onClickLocation = (_mapRef$current24 = mapRef.current) === null || _mapRef$current24 === void 0 ? void 0 : _mapRef$current24.addListener("click", function (args) {
983
996
  props.onClickLocation && props.onClickLocation(args);
984
997
  }, {
985
998
  location: true
@@ -988,9 +1001,9 @@ var MFMap = function MFMap(props) {
988
1001
  }
989
1002
 
990
1003
  if (props.onRightClickLocation) {
991
- var _mapRef$current23;
1004
+ var _mapRef$current25;
992
1005
 
993
- var onRightClickLocation = (_mapRef$current23 = mapRef.current) === null || _mapRef$current23 === void 0 ? void 0 : _mapRef$current23.addListener("rightClick", function (args) {
1006
+ var onRightClickLocation = (_mapRef$current25 = mapRef.current) === null || _mapRef$current25 === void 0 ? void 0 : _mapRef$current25.addListener("rightClick", function (args) {
994
1007
  props.onRightClickLocation && props.onRightClickLocation(args);
995
1008
  }, {
996
1009
  location: true
@@ -999,9 +1012,9 @@ var MFMap = function MFMap(props) {
999
1012
  }
1000
1013
 
1001
1014
  if (props.onTilesLoaded) {
1002
- var _mapRef$current24;
1015
+ var _mapRef$current26;
1003
1016
 
1004
- var onTilesLoaded = (_mapRef$current24 = mapRef.current) === null || _mapRef$current24 === void 0 ? void 0 : _mapRef$current24.addListener("tilesLoaded", function (args) {
1017
+ var onTilesLoaded = (_mapRef$current26 = mapRef.current) === null || _mapRef$current26 === void 0 ? void 0 : _mapRef$current26.addListener("tilesLoaded", function (args) {
1005
1018
  props.onTilesLoaded && props.onTilesLoaded(args);
1006
1019
  }, {
1007
1020
  location: true
@@ -1010,9 +1023,9 @@ var MFMap = function MFMap(props) {
1010
1023
  }
1011
1024
 
1012
1025
  if (props.onCameraChanging) {
1013
- var _mapRef$current25;
1026
+ var _mapRef$current27;
1014
1027
 
1015
- var onCameraChanging = (_mapRef$current25 = mapRef.current) === null || _mapRef$current25 === void 0 ? void 0 : _mapRef$current25.addListener("cameraChanging", function (args) {
1028
+ var onCameraChanging = (_mapRef$current27 = mapRef.current) === null || _mapRef$current27 === void 0 ? void 0 : _mapRef$current27.addListener("cameraChanging", function (args) {
1016
1029
  props.onCameraChanging && props.onCameraChanging(args);
1017
1030
  }, {
1018
1031
  location: true