react-map4d-map 1.1.8 → 1.2.0

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.
@@ -22,6 +22,7 @@ interface DirectionsRendererProps {
22
22
  onMarkerDragEnd?: Function;
23
23
  map?: map4d.Map;
24
24
  onCreated?: (directionsRenderer?: map4d.DirectionsRenderer) => void;
25
+ onHover?: (directions: any) => void;
25
26
  }
26
27
  declare const MFDirectionsRenderer: (props: DirectionsRendererProps) => null;
27
28
  export default MFDirectionsRenderer;
@@ -22,6 +22,7 @@ interface MapProps {
22
22
  version: string;
23
23
  accessKey: string;
24
24
  environment?: "dev" | "test" | undefined | null;
25
+ sdkDomain?: string | null;
25
26
  onMapReady?: (map: any, key?: string) => void;
26
27
  onClickLocation?: (args: any) => void;
27
28
  onRightClickLocation?: (args: any) => void;
@@ -27,6 +27,7 @@ interface MarkerProps {
27
27
  onCreated?: (marker: any) => void;
28
28
  onRightClick?: (marker: any) => void;
29
29
  onDragEnd?: (marker: any) => void;
30
+ onHover?: (marker: any) => void;
30
31
  }
31
32
  declare const MFMarker: (props: MarkerProps) => null;
32
33
  export default MFMarker;
@@ -11,6 +11,7 @@ interface PolygonProps {
11
11
  userInteractionEnabled?: boolean;
12
12
  map?: map4d.Map;
13
13
  onCreated?: (polygon: map4d.Polygon) => void;
14
+ onHover?: (polygon: any) => void;
14
15
  }
15
16
  declare const MFPolygon: (props: PolygonProps) => null;
16
17
  export default MFPolygon;
@@ -12,6 +12,7 @@ interface PolylineProps {
12
12
  userInteractionEnabled?: boolean;
13
13
  map?: map4d.Map;
14
14
  onCreated?: (polyline: map4d.Polyline) => void;
15
+ onHover?: (polyline: any) => void;
15
16
  }
16
17
  declare const MFPolyline: (props: PolylineProps) => null;
17
18
  export default MFPolyline;
@@ -1,4 +1,8 @@
1
- interface TileOverlayProps extends map4d.TileOverlayOptions {
1
+ interface TileOverlayProps {
2
+ getUrl: Function;
3
+ visible?: boolean;
4
+ zIndex?: number;
5
+ opacity?: number;
2
6
  map?: map4d.Map;
3
7
  onCreated?: (tileOverlay: map4d.TileOverlay) => void;
4
8
  }
@@ -3,5 +3,6 @@ export declare const enum MapEventEnum {
3
3
  rightClick = "rightClick",
4
4
  dragEnd = "dragEnd",
5
5
  cameraChanging = "cameraChanging",
6
- tilesLoaded = "tilesLoaded"
6
+ tilesLoaded = "tilesLoaded",
7
+ hover = "hover"
7
8
  }
package/dist/index.js CHANGED
@@ -476,6 +476,7 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
476
476
  });
477
477
  directionRef.current = new map4d.DirectionsRenderer(option);
478
478
  (_directionRef$current = directionRef.current) === null || _directionRef$current === void 0 ? void 0 : _directionRef$current.setMap(theMap);
479
+ directionRef.current.onHover = props.onHover;
479
480
  onCreated && onCreated(directionRef.current);
480
481
  }
481
482
  }, [theMap]);
@@ -769,7 +770,13 @@ var MFMap = function MFMap(props) {
769
770
  };
770
771
  };
771
772
 
772
- var urlNew = "https://api" + (props.environment ? "-" + props.environment : "") + ".map4d.vn/sdk/map/js?version=" + props.version + "&key=" + props.accessKey + "&callback=" + callback.current;
773
+ var domain = "https://api" + (props.environment ? "-" + props.environment : "") + ".map4d.vn";
774
+
775
+ if (props.sdkDomain) {
776
+ domain = props.sdkDomain;
777
+ }
778
+
779
+ var urlNew = domain + "/sdk/map/js?version=" + props.version + "&key=" + props.accessKey + "&callback=" + callback.current;
773
780
 
774
781
  if (props.mapid) {
775
782
  urlNew += "&mapId=" + props.mapid;
@@ -805,7 +812,7 @@ var MFMap = function MFMap(props) {
805
812
  }, [props.environment, props.version, props.accessKey]);
806
813
 
807
814
  var registerEvent = function registerEvent() {
808
- var _mapRef$current2, _mapRef$current3, _mapRef$current4;
815
+ var _mapRef$current2, _mapRef$current3, _mapRef$current4, _mapRef$current5, _mapRef$current6, _mapRef$current7, _mapRef$current8;
809
816
 
810
817
  var eventClickMarker = (_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.addListener("click", function (args) {
811
818
  var _args$marker, _args$marker2;
@@ -828,12 +835,40 @@ var MFMap = function MFMap(props) {
828
835
  }, {
829
836
  marker: true
830
837
  });
831
- events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker]);
838
+ var eventHoverMarker = (_mapRef$current5 = mapRef.current) === null || _mapRef$current5 === void 0 ? void 0 : _mapRef$current5.addListener("hover", function (args) {
839
+ var _args$marker7, _args$marker8;
840
+
841
+ ((_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());
842
+ }, {
843
+ marker: true
844
+ });
845
+ var eventHoverPolygon = (_mapRef$current6 = mapRef.current) === null || _mapRef$current6 === void 0 ? void 0 : _mapRef$current6.addListener("hover", function (args) {
846
+ var _args$polygon, _args$polygon2;
847
+
848
+ ((_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());
849
+ }, {
850
+ polygon: true
851
+ });
852
+ var eventHoverPolyline = (_mapRef$current7 = mapRef.current) === null || _mapRef$current7 === void 0 ? void 0 : _mapRef$current7.addListener("hover", function (args) {
853
+ var _args$polyline, _args$polyline2;
854
+
855
+ ((_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());
856
+ }, {
857
+ polyline: true
858
+ });
859
+ var eventHoverDirection = (_mapRef$current8 = mapRef.current) === null || _mapRef$current8 === void 0 ? void 0 : _mapRef$current8.addListener("hover", function (args) {
860
+ var _args$renderer, _args$renderer2;
861
+
862
+ ((_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());
863
+ }, {
864
+ directions: true
865
+ });
866
+ events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection]);
832
867
 
833
868
  if (props.onClickLocation) {
834
- var _mapRef$current5;
869
+ var _mapRef$current9;
835
870
 
836
- var onClickLocation = (_mapRef$current5 = mapRef.current) === null || _mapRef$current5 === void 0 ? void 0 : _mapRef$current5.addListener("click", function (args) {
871
+ var onClickLocation = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("click", function (args) {
837
872
  props.onClickLocation && props.onClickLocation(args);
838
873
  }, {
839
874
  location: true
@@ -842,9 +877,9 @@ var MFMap = function MFMap(props) {
842
877
  }
843
878
 
844
879
  if (props.onRightClickLocation) {
845
- var _mapRef$current6;
880
+ var _mapRef$current10;
846
881
 
847
- var onRightClickLocation = (_mapRef$current6 = mapRef.current) === null || _mapRef$current6 === void 0 ? void 0 : _mapRef$current6.addListener("rightClick", function (args) {
882
+ var onRightClickLocation = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("rightClick", function (args) {
848
883
  props.onRightClickLocation && props.onRightClickLocation(args);
849
884
  }, {
850
885
  location: true
@@ -853,9 +888,9 @@ var MFMap = function MFMap(props) {
853
888
  }
854
889
 
855
890
  if (props.onTilesLoaded) {
856
- var _mapRef$current7;
891
+ var _mapRef$current11;
857
892
 
858
- var onTilesLoaded = (_mapRef$current7 = mapRef.current) === null || _mapRef$current7 === void 0 ? void 0 : _mapRef$current7.addListener("tilesLoaded", function (args) {
893
+ var onTilesLoaded = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("tilesLoaded", function (args) {
859
894
  props.onTilesLoaded && props.onTilesLoaded(args);
860
895
  }, {
861
896
  location: true
@@ -864,9 +899,9 @@ var MFMap = function MFMap(props) {
864
899
  }
865
900
 
866
901
  if (props.onCameraChanging) {
867
- var _mapRef$current8;
902
+ var _mapRef$current12;
868
903
 
869
- var onCameraChanging = (_mapRef$current8 = mapRef.current) === null || _mapRef$current8 === void 0 ? void 0 : _mapRef$current8.addListener("cameraChanging", function (args) {
904
+ var onCameraChanging = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("cameraChanging", function (args) {
870
905
  props.onCameraChanging && props.onCameraChanging(args);
871
906
  }, {
872
907
  location: true
@@ -972,6 +1007,7 @@ var MFMarker = function MFMarker(props) {
972
1007
  markerRef.current.onClick = onClick;
973
1008
  markerRef.current.onRightClick = props.onRightClick;
974
1009
  markerRef.current.onDragEnd = props.onDragEnd;
1010
+ markerRef.current.onHover = props.onHover;
975
1011
  onCreated && onCreated(markerRef.current);
976
1012
  (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.addMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.addMarker(markerRef.current));
977
1013
  }
@@ -1428,6 +1464,7 @@ var MFPolygon = function MFPolygon(props) {
1428
1464
  });
1429
1465
  polygonRef.current = new map4d.Polygon(option);
1430
1466
  (_polygonRef$current = polygonRef.current) === null || _polygonRef$current === void 0 ? void 0 : _polygonRef$current.setMap(theMap);
1467
+ polygonRef.current.onHover = props.onHover;
1431
1468
  onCreated && onCreated(polygonRef.current);
1432
1469
  }
1433
1470
  }, [theMap]);
@@ -1549,6 +1586,7 @@ var MFPolyline = function MFPolyline(props) {
1549
1586
  });
1550
1587
  polylineRef.current = new map4d.Polyline(option);
1551
1588
  (_polylineRef$current = polylineRef.current) === null || _polylineRef$current === void 0 ? void 0 : _polylineRef$current.setMap(theMap);
1589
+ polylineRef.current.onHover = props.onHover;
1552
1590
  onCreated && onCreated(polylineRef.current);
1553
1591
  }
1554
1592
  }, [theMap]);