react-map4d-map 1.2.4 → 1.2.6

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.
@@ -836,133 +836,147 @@ var MFMap = function MFMap(props) {
836
836
  }, [props.environment, props.version, props.accessKey]);
837
837
 
838
838
  var registerEvent = function registerEvent() {
839
- var _mapRef$current2, _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;
839
+ var _mapRef$current2, _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;
840
840
 
841
841
  var eventClickMarker = (_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.addListener("click", function (args) {
842
842
  var _args$marker, _args$marker2;
843
843
 
844
- ((_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());
844
+ ((_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));
845
845
  }, {
846
846
  marker: true
847
847
  });
848
848
  var eventRightClickMarker = (_mapRef$current3 = mapRef.current) === null || _mapRef$current3 === void 0 ? void 0 : _mapRef$current3.addListener("rightClick", function (args) {
849
849
  var _args$marker3, _args$marker4;
850
850
 
851
- ((_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());
851
+ ((_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));
852
852
  }, {
853
853
  marker: true
854
854
  });
855
855
  var eventDragEndMarker = (_mapRef$current4 = mapRef.current) === null || _mapRef$current4 === void 0 ? void 0 : _mapRef$current4.addListener("dragEnd", function (args) {
856
856
  var _args$marker5, _args$marker6;
857
857
 
858
- ((_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());
858
+ ((_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));
859
859
  }, {
860
860
  marker: true
861
861
  });
862
862
  var eventHoverMarker = (_mapRef$current5 = mapRef.current) === null || _mapRef$current5 === void 0 ? void 0 : _mapRef$current5.addListener("hover", function (args) {
863
863
  var _args$marker7, _args$marker8;
864
864
 
865
- ((_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());
865
+ ((_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));
866
866
  }, {
867
867
  marker: true
868
868
  });
869
869
  var eventHoverPolygon = (_mapRef$current6 = mapRef.current) === null || _mapRef$current6 === void 0 ? void 0 : _mapRef$current6.addListener("hover", function (args) {
870
870
  var _args$polygon, _args$polygon2;
871
871
 
872
- ((_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());
872
+ ((_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));
873
873
  }, {
874
874
  polygon: true
875
875
  });
876
876
  var eventHoverPolyline = (_mapRef$current7 = mapRef.current) === null || _mapRef$current7 === void 0 ? void 0 : _mapRef$current7.addListener("hover", function (args) {
877
877
  var _args$polyline, _args$polyline2;
878
878
 
879
- ((_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());
879
+ ((_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));
880
880
  }, {
881
881
  polyline: true
882
882
  });
883
883
  var eventHoverDirection = (_mapRef$current8 = mapRef.current) === null || _mapRef$current8 === void 0 ? void 0 : _mapRef$current8.addListener("hover", function (args) {
884
884
  var _args$renderer, _args$renderer2;
885
885
 
886
- ((_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());
886
+ ((_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));
887
887
  }, {
888
888
  directions: true
889
889
  });
890
890
  var eventClickPolyline = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("click", function (args) {
891
891
  var _args$polyline3, _args$polyline4;
892
892
 
893
- ((_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());
893
+ ((_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));
894
894
  }, {
895
895
  polyline: true
896
896
  });
897
897
  var eventMouseOutDirection = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("mouseOut", function (args) {
898
898
  var _args$renderer3, _args$renderer4;
899
899
 
900
- ((_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());
900
+ ((_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));
901
901
  }, {
902
902
  directions: true
903
903
  });
904
904
  var eventMouseOverDirection = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("mouseOver", function (args) {
905
905
  var _args$renderer5, _args$renderer6;
906
906
 
907
- ((_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());
907
+ ((_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));
908
908
  }, {
909
909
  directions: true
910
910
  });
911
911
  var eventMouseMoveDirection = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("mouseMove", function (args) {
912
912
  var _args$renderer7, _args$renderer8;
913
913
 
914
- ((_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());
914
+ ((_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));
915
915
  }, {
916
916
  directions: true
917
917
  });
918
918
  var eventMouseOutPolyline = (_mapRef$current13 = mapRef.current) === null || _mapRef$current13 === void 0 ? void 0 : _mapRef$current13.addListener("mouseOut", function (args) {
919
919
  var _args$polyline5, _args$polyline6;
920
920
 
921
- ((_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());
921
+ ((_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));
922
922
  }, {
923
923
  polyline: true
924
924
  });
925
925
  var eventMouseOverPolyline = (_mapRef$current14 = mapRef.current) === null || _mapRef$current14 === void 0 ? void 0 : _mapRef$current14.addListener("mouseOver", function (args) {
926
926
  var _args$polyline7, _args$polyline8;
927
927
 
928
- ((_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());
928
+ ((_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));
929
929
  }, {
930
930
  polyline: true
931
931
  });
932
932
  var eventMouseMovePolyline = (_mapRef$current15 = mapRef.current) === null || _mapRef$current15 === void 0 ? void 0 : _mapRef$current15.addListener("mouseMove", function (args) {
933
933
  var _args$polyline9, _args$polyline10;
934
934
 
935
- ((_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());
935
+ ((_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));
936
936
  }, {
937
937
  polyline: true
938
938
  });
939
939
  var eventMouseOutMarker = (_mapRef$current16 = mapRef.current) === null || _mapRef$current16 === void 0 ? void 0 : _mapRef$current16.addListener("mouseOut", function (args) {
940
940
  var _args$marker9, _args$marker10;
941
941
 
942
- ((_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());
942
+ ((_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));
943
943
  }, {
944
944
  marker: true
945
945
  });
946
946
  var eventMouseOverMarker = (_mapRef$current17 = mapRef.current) === null || _mapRef$current17 === void 0 ? void 0 : _mapRef$current17.addListener("mouseOver", function (args) {
947
947
  var _args$marker11, _args$marker12;
948
948
 
949
- ((_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());
949
+ ((_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));
950
950
  }, {
951
951
  marker: true
952
952
  });
953
953
  var eventMouseMoveMarker = (_mapRef$current18 = mapRef.current) === null || _mapRef$current18 === void 0 ? void 0 : _mapRef$current18.addListener("mouseMove", function (args) {
954
954
  var _args$marker13, _args$marker14;
955
955
 
956
- ((_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());
956
+ ((_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));
957
957
  }, {
958
958
  marker: true
959
959
  });
960
- events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline, eventMouseOutDirection, eventMouseOverDirection, eventMouseMoveDirection, eventMouseOutPolyline, eventMouseOverPolyline, eventMouseMovePolyline, eventMouseOutMarker, eventMouseOverMarker, eventMouseMoveMarker]);
960
+ var eventClickPoi = (_mapRef$current19 = mapRef.current) === null || _mapRef$current19 === void 0 ? void 0 : _mapRef$current19.addListener("click", function (args) {
961
+ var _args$poi, _args$poi2;
962
+
963
+ ((_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));
964
+ }, {
965
+ poi: true
966
+ });
967
+ var eventHoverPoi = (_mapRef$current20 = mapRef.current) === null || _mapRef$current20 === void 0 ? void 0 : _mapRef$current20.addListener("hover", function (args) {
968
+ var _args$poi3, _args$poi4;
969
+
970
+ ((_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));
971
+ }, {
972
+ poi: true
973
+ });
974
+ events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline, eventMouseOutDirection, eventMouseOverDirection, eventMouseMoveDirection, eventMouseOutPolyline, eventMouseOverPolyline, eventMouseMovePolyline, eventMouseOutMarker, eventMouseOverMarker, eventMouseMoveMarker, eventClickPoi, eventHoverPoi]);
961
975
 
962
976
  if (props.onClickLocation) {
963
- var _mapRef$current19;
977
+ var _mapRef$current21;
964
978
 
965
- var onClickLocation = (_mapRef$current19 = mapRef.current) === null || _mapRef$current19 === void 0 ? void 0 : _mapRef$current19.addListener("click", function (args) {
979
+ var onClickLocation = (_mapRef$current21 = mapRef.current) === null || _mapRef$current21 === void 0 ? void 0 : _mapRef$current21.addListener("click", function (args) {
966
980
  props.onClickLocation && props.onClickLocation(args);
967
981
  }, {
968
982
  location: true
@@ -971,9 +985,9 @@ var MFMap = function MFMap(props) {
971
985
  }
972
986
 
973
987
  if (props.onRightClickLocation) {
974
- var _mapRef$current20;
988
+ var _mapRef$current22;
975
989
 
976
- var onRightClickLocation = (_mapRef$current20 = mapRef.current) === null || _mapRef$current20 === void 0 ? void 0 : _mapRef$current20.addListener("rightClick", function (args) {
990
+ var onRightClickLocation = (_mapRef$current22 = mapRef.current) === null || _mapRef$current22 === void 0 ? void 0 : _mapRef$current22.addListener("rightClick", function (args) {
977
991
  props.onRightClickLocation && props.onRightClickLocation(args);
978
992
  }, {
979
993
  location: true
@@ -982,9 +996,9 @@ var MFMap = function MFMap(props) {
982
996
  }
983
997
 
984
998
  if (props.onTilesLoaded) {
985
- var _mapRef$current21;
999
+ var _mapRef$current23;
986
1000
 
987
- var onTilesLoaded = (_mapRef$current21 = mapRef.current) === null || _mapRef$current21 === void 0 ? void 0 : _mapRef$current21.addListener("tilesLoaded", function (args) {
1001
+ var onTilesLoaded = (_mapRef$current23 = mapRef.current) === null || _mapRef$current23 === void 0 ? void 0 : _mapRef$current23.addListener("tilesLoaded", function (args) {
988
1002
  props.onTilesLoaded && props.onTilesLoaded(args);
989
1003
  }, {
990
1004
  location: true
@@ -993,9 +1007,9 @@ var MFMap = function MFMap(props) {
993
1007
  }
994
1008
 
995
1009
  if (props.onCameraChanging) {
996
- var _mapRef$current22;
1010
+ var _mapRef$current24;
997
1011
 
998
- var onCameraChanging = (_mapRef$current22 = mapRef.current) === null || _mapRef$current22 === void 0 ? void 0 : _mapRef$current22.addListener("cameraChanging", function (args) {
1012
+ var onCameraChanging = (_mapRef$current24 = mapRef.current) === null || _mapRef$current24 === void 0 ? void 0 : _mapRef$current24.addListener("cameraChanging", function (args) {
999
1013
  props.onCameraChanging && props.onCameraChanging(args);
1000
1014
  }, {
1001
1015
  location: true
@@ -1386,7 +1400,9 @@ var MFPOI = function MFPOI(props) {
1386
1400
  draggable = props.draggable,
1387
1401
  userInteractionEnabled = props.userInteractionEnabled,
1388
1402
  map = props.map,
1389
- onCreated = props.onCreated;
1403
+ onCreated = props.onCreated,
1404
+ onClick = props.onClick,
1405
+ onHover = props.onHover;
1390
1406
  var map4dContext = useContext(Map4dContext);
1391
1407
  var theMap = map || map4dContext.map;
1392
1408
  var poiRef = useRef();
@@ -1416,6 +1432,8 @@ var MFPOI = function MFPOI(props) {
1416
1432
  }
1417
1433
  });
1418
1434
  poiRef.current = new map4d.POI(option);
1435
+ poiRef.current.onClick = onClick;
1436
+ poiRef.current.onHover = onHover;
1419
1437
  (_poiRef$current = poiRef.current) === null || _poiRef$current === void 0 ? void 0 : _poiRef$current.setMap(theMap);
1420
1438
  onCreated && onCreated(poiRef.current);
1421
1439
  }
@@ -1495,6 +1513,16 @@ var MFPOI = function MFPOI(props) {
1495
1513
 
1496
1514
  userInteractionEnabled != undefined && ((_poiRef$current15 = poiRef.current) === null || _poiRef$current15 === void 0 ? void 0 : _poiRef$current15.setUserInteraction(userInteractionEnabled));
1497
1515
  }, [userInteractionEnabled]);
1516
+ useEffect(function () {
1517
+ if (poiRef.current) {
1518
+ poiRef.current.onClick = onClick;
1519
+ }
1520
+ }, [onClick]);
1521
+ useEffect(function () {
1522
+ if (poiRef.current) {
1523
+ poiRef.current.onHover = onHover;
1524
+ }
1525
+ }, [onHover]);
1498
1526
  return null;
1499
1527
  };
1500
1528
 
@@ -1933,5 +1961,1247 @@ var MFTileOverlay = function MFTileOverlay(props) {
1933
1961
  return null;
1934
1962
  };
1935
1963
 
1936
- export { MFBuilding, MFBuildingOverlay, MFCircle, MFDataLayer, MFDirectionsRenderer, MFGroundOverlay, MFImageOverlay, MFMap, MFMarker, MFMarkerCluster, MFPOI, MFPOIOverlay, MFPolygon, MFPolyline, MFTileOverlay };
1964
+ function _defineProperties(target, props) {
1965
+ for (var i = 0; i < props.length; i++) {
1966
+ var descriptor = props[i];
1967
+ descriptor.enumerable = descriptor.enumerable || false;
1968
+ descriptor.configurable = true;
1969
+ if ("value" in descriptor) descriptor.writable = true;
1970
+ Object.defineProperty(target, descriptor.key, descriptor);
1971
+ }
1972
+ }
1973
+
1974
+ function _createClass(Constructor, protoProps, staticProps) {
1975
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1976
+ if (staticProps) _defineProperties(Constructor, staticProps);
1977
+ Object.defineProperty(Constructor, "prototype", {
1978
+ writable: false
1979
+ });
1980
+ return Constructor;
1981
+ }
1982
+
1983
+ function _inheritsLoose(subClass, superClass) {
1984
+ subClass.prototype = Object.create(superClass.prototype);
1985
+ subClass.prototype.constructor = subClass;
1986
+
1987
+ _setPrototypeOf(subClass, superClass);
1988
+ }
1989
+
1990
+ function _setPrototypeOf(o, p) {
1991
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
1992
+ o.__proto__ = p;
1993
+ return o;
1994
+ };
1995
+ return _setPrototypeOf(o, p);
1996
+ }
1997
+
1998
+ var Vector2 = /*#__PURE__*/function () {
1999
+ function Vector2(x, y) {
2000
+ if (x === void 0) {
2001
+ x = 0.0;
2002
+ }
2003
+
2004
+ if (y === void 0) {
2005
+ y = 0.0;
2006
+ }
2007
+
2008
+ this.x = x;
2009
+ this.y = y;
2010
+ }
2011
+
2012
+ var _proto = Vector2.prototype;
2013
+
2014
+ _proto.clone = function clone() {
2015
+ return new Vector2(this.x, this.y);
2016
+ };
2017
+
2018
+ _proto.normalize = function normalize() {
2019
+ var length = this.length;
2020
+ var x = 0.0;
2021
+ var y = 0.0;
2022
+
2023
+ if (length > 0) {
2024
+ x = this.x / length;
2025
+ y = this.y / length;
2026
+ }
2027
+
2028
+ return new Vector2(x, y);
2029
+ };
2030
+
2031
+ _proto.set = function set(a) {
2032
+ this.x = a.x;
2033
+ this.y = a.y;
2034
+ };
2035
+
2036
+ _proto.invert = function invert() {
2037
+ return new Vector2(-this.x, -this.y);
2038
+ };
2039
+
2040
+ _proto.rotate90 = function rotate90() {
2041
+ return new Vector2(this.y, -this.x);
2042
+ };
2043
+
2044
+ _proto.add = function add(a) {
2045
+ return new Vector2(a.x + this.x, a.y + this.y);
2046
+ };
2047
+
2048
+ _proto.subtract = function subtract(a) {
2049
+ if (!a) {
2050
+ return this.clone();
2051
+ }
2052
+
2053
+ return new Vector2(this.x - a.x, this.y - a.y);
2054
+ };
2055
+
2056
+ _proto.multiply = function multiply(a) {
2057
+ return new Vector2(a * this.x, a * this.y);
2058
+ };
2059
+
2060
+ _proto.rotateBy = function rotateBy(a) {
2061
+ var cos = Math.cos(a * Math.PI / 180);
2062
+ var sin = Math.sin(a * Math.PI / 180);
2063
+ return new Vector2(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
2064
+ };
2065
+
2066
+ _proto.rotateByRadian = function rotateByRadian(a) {
2067
+ var cos = Math.cos(a);
2068
+ var sin = Math.sin(a);
2069
+ return new Vector2(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
2070
+ };
2071
+
2072
+ _proto.cross = function cross(a) {
2073
+ return this.x * a.y - this.y * a.x;
2074
+ };
2075
+
2076
+ _proto.dot = function dot(a) {
2077
+ return a.x * this.x + a.y * this.y;
2078
+ };
2079
+
2080
+ Vector2.perp = function perp(v1, v2) {
2081
+ return new Vector2(v2[1] - v1[1], v1[0] - v2[0]);
2082
+ };
2083
+
2084
+ Vector2.neg = function neg(v) {
2085
+ return new Vector2(-v.x, -v.y);
2086
+ };
2087
+
2088
+ _createClass(Vector2, [{
2089
+ key: "length",
2090
+ get: function get() {
2091
+ return Math.sqrt(this.x * this.x + this.y * this.y);
2092
+ }
2093
+ }, {
2094
+ key: "lengthSq",
2095
+ get: function get() {
2096
+ return this.x * this.x + this.y * this.y;
2097
+ }
2098
+ }]);
2099
+
2100
+ return Vector2;
2101
+ }();
2102
+
2103
+ var MathUtils = /*#__PURE__*/function () {
2104
+ function MathUtils() {}
2105
+
2106
+ MathUtils.clamp = function clamp(value, min, max) {
2107
+ return value < min ? min : value > max ? max : value;
2108
+ };
2109
+
2110
+ MathUtils.toRadians = function toRadians(angleDegrees) {
2111
+ return angleDegrees * Math.PI / 180.0;
2112
+ };
2113
+
2114
+ MathUtils.distance = function distance(p1, p2) {
2115
+ return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
2116
+ };
2117
+
2118
+ MathUtils.findNextPowerOf2 = function findNextPowerOf2(n) {
2119
+ n = n - 1;
2120
+ var lg = Math.log2(n);
2121
+ return 1 << lg + 1;
2122
+ };
2123
+
2124
+ MathUtils.findPreviousPowerOf2 = function findPreviousPowerOf2(n) {
2125
+ return 1 << 31 - Math.clz32(n);
2126
+ };
2127
+
2128
+ return MathUtils;
2129
+ }();
2130
+
2131
+ var Vector3 = /*#__PURE__*/function () {
2132
+ function Vector3(x, y, z) {
2133
+ if (x === void 0) {
2134
+ x = 0.0;
2135
+ }
2136
+
2137
+ if (y === void 0) {
2138
+ y = 0.0;
2139
+ }
2140
+
2141
+ if (z === void 0) {
2142
+ z = 0.0;
2143
+ }
2144
+
2145
+ this.x = x;
2146
+ this.y = y;
2147
+ this.z = z;
2148
+ }
2149
+
2150
+ var _proto = Vector3.prototype;
2151
+
2152
+ _proto.clone = function clone() {
2153
+ return new Vector3(this.x, this.y, this.z);
2154
+ };
2155
+
2156
+ _proto.buffer = function buffer() {
2157
+ return new Float32Array([this.x, this.y, this.z]);
2158
+ };
2159
+
2160
+ _proto.normalize = function normalize() {
2161
+ var length = this.length;
2162
+ var x = 0.0;
2163
+ var y = 0.0;
2164
+ var z = 0.0;
2165
+
2166
+ if (length > 0) {
2167
+ x = this.x / length;
2168
+ y = this.y / length;
2169
+ z = this.z / length;
2170
+ }
2171
+
2172
+ return new Vector3(x, y, z);
2173
+ };
2174
+
2175
+ _proto.set = function set(a) {
2176
+ this.x = a.x;
2177
+ this.y = a.y;
2178
+ this.z = a.z;
2179
+ };
2180
+
2181
+ _proto.invert = function invert() {
2182
+ return new Vector3(-this.x, -this.y, -this.z);
2183
+ };
2184
+
2185
+ _proto.rotate90 = function rotate90() {
2186
+ return new Vector3(this.y, -this.x, this.z);
2187
+ };
2188
+
2189
+ _proto.add = function add(a) {
2190
+ return new Vector3(a.x + this.x, a.y + this.y, a.z + this.z);
2191
+ };
2192
+
2193
+ _proto.subtract = function subtract(a) {
2194
+ if (!a) {
2195
+ return this.clone();
2196
+ }
2197
+
2198
+ return new Vector3(this.x - a.x, this.y - a.y, this.z - a.z);
2199
+ };
2200
+
2201
+ _proto.multiply = function multiply(a) {
2202
+ return new Vector3(a * this.x, a * this.y, a * this.z);
2203
+ };
2204
+
2205
+ _proto.rotateBy = function rotateBy(a) {
2206
+ var cos = Math.cos(a * Math.PI / 180);
2207
+ var sin = Math.sin(a * Math.PI / 180);
2208
+ return new Vector3(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
2209
+ };
2210
+
2211
+ _proto.cross = function cross(a) {
2212
+ return new Vector3(this.y * a.z - this.z * a.y, this.z * a.x - this.x * a.z, this.x * a.y - this.y * a.x);
2213
+ };
2214
+
2215
+ _proto.dot = function dot(a) {
2216
+ return a.x * this.x + a.y * this.y + a.z * this.z;
2217
+ };
2218
+
2219
+ Vector3.perp = function perp(v1, v2) {
2220
+ return new Vector3(v2[1] - v1[1], v1[0] - v2[0]);
2221
+ };
2222
+
2223
+ Vector3.neg = function neg(v) {
2224
+ return new Vector3(-v.x, -v.y, -v.z);
2225
+ };
2226
+
2227
+ _createClass(Vector3, [{
2228
+ key: "length",
2229
+ get: function get() {
2230
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
2231
+ }
2232
+ }, {
2233
+ key: "lengthSq",
2234
+ get: function get() {
2235
+ return this.x * this.x + this.y * this.y + this.z * this.z;
2236
+ }
2237
+ }]);
2238
+
2239
+ return Vector3;
2240
+ }();
2241
+
2242
+ var Matrix4 = /*#__PURE__*/function () {
2243
+ function Matrix4(data) {
2244
+ if (data === void 0) {
2245
+ data = new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
2246
+ }
2247
+
2248
+ this.data = data;
2249
+ }
2250
+
2251
+ var _proto = Matrix4.prototype;
2252
+
2253
+ _proto.setIdentity = function setIdentity(x, y, z) {
2254
+ if (x === void 0) {
2255
+ x = 1.0;
2256
+ }
2257
+
2258
+ if (y === void 0) {
2259
+ y = 1.0;
2260
+ }
2261
+
2262
+ if (z === void 0) {
2263
+ z = 1.0;
2264
+ }
2265
+
2266
+ this.data[0] = x;
2267
+ this.data[1] = 0;
2268
+ this.data[2] = 0;
2269
+ this.data[3] = 0;
2270
+ this.data[4] = 0;
2271
+ this.data[5] = y;
2272
+ this.data[6] = 0;
2273
+ this.data[7] = 0;
2274
+ this.data[8] = 0;
2275
+ this.data[9] = 0;
2276
+ this.data[10] = z;
2277
+ this.data[11] = 0;
2278
+ this.data[12] = 0;
2279
+ this.data[13] = 0;
2280
+ this.data[14] = 0;
2281
+ this.data[15] = 1.0;
2282
+ return this;
2283
+ };
2284
+
2285
+ _proto.copy = function copy(other) {
2286
+ this.data[0] = other.data[0];
2287
+ this.data[1] = other.data[1];
2288
+ this.data[2] = other.data[2];
2289
+ this.data[3] = other.data[3];
2290
+ this.data[4] = other.data[4];
2291
+ this.data[5] = other.data[5];
2292
+ this.data[6] = other.data[6];
2293
+ this.data[7] = other.data[7];
2294
+ this.data[8] = other.data[8];
2295
+ this.data[9] = other.data[9];
2296
+ this.data[10] = other.data[10];
2297
+ this.data[11] = other.data[11];
2298
+ this.data[12] = other.data[12];
2299
+ this.data[13] = other.data[13];
2300
+ this.data[14] = other.data[14];
2301
+ this.data[15] = other.data[15];
2302
+ return this;
2303
+ };
2304
+
2305
+ Matrix4.translate = function translate(x, y, z) {
2306
+ if (z === void 0) {
2307
+ z = 0.0;
2308
+ }
2309
+
2310
+ return new Matrix4(new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0., 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0]));
2311
+ };
2312
+
2313
+ _proto.translate = function translate(x, y, z) {
2314
+ if (z === void 0) {
2315
+ z = 0.0;
2316
+ }
2317
+
2318
+ this.data[12] += x;
2319
+ this.data[13] += y;
2320
+ this.data[14] += z;
2321
+ return this;
2322
+ };
2323
+
2324
+ Matrix4.rotateX = function rotateX(alpha) {
2325
+ alpha *= Math.PI / 180.0;
2326
+ var sinA = Math.sin(alpha);
2327
+ var cosA = Math.cos(alpha);
2328
+ return new Matrix4(new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, cosA, sinA, 0.0, 0.0, -sinA, cosA, 0.0, 0.0, 0.0, 0.0, 1.0]));
2329
+ };
2330
+
2331
+ _proto.setRotationX = function setRotationX(alpha) {
2332
+ alpha *= Math.PI / 180.0;
2333
+ var sinA = Math.sin(alpha);
2334
+ var cosA = Math.cos(alpha);
2335
+ this.setIdentity();
2336
+ this.data[5] = cosA;
2337
+ this.data[6] = sinA;
2338
+ this.data[9] = -sinA;
2339
+ this.data[10] = cosA;
2340
+ return this;
2341
+ };
2342
+
2343
+ _proto.rotateX = function rotateX(alpha) {
2344
+ alpha *= Math.PI / 180.0;
2345
+ var sinA = Math.sin(alpha);
2346
+ var cosA = Math.cos(alpha);
2347
+ var r1 = this.data[1];
2348
+ var r2 = this.data[2];
2349
+ this.data[1] = r1 * cosA - r2 * sinA;
2350
+ this.data[2] = r1 * sinA + r2 * cosA;
2351
+ r1 = this.data[5];
2352
+ r2 = this.data[6];
2353
+ this.data[5] = r1 * cosA - r2 * sinA;
2354
+ this.data[6] = r1 * sinA + r2 * cosA;
2355
+ r1 = this.data[9];
2356
+ r2 = this.data[10];
2357
+ this.data[9] = r1 * cosA - r2 * sinA;
2358
+ this.data[10] = r1 * sinA + r2 * cosA;
2359
+ r1 = this.data[13];
2360
+ r2 = this.data[14];
2361
+ this.data[13] = r1 * cosA - r2 * sinA;
2362
+ this.data[14] = r1 * sinA + r2 * cosA;
2363
+ return this;
2364
+ };
2365
+
2366
+ Matrix4.rotateY = function rotateY(alpha) {
2367
+ alpha *= Math.PI / 180.0;
2368
+ var sinA = Math.sin(alpha);
2369
+ var cosA = Math.cos(alpha);
2370
+ return new Matrix4(new Float32Array([cosA, 0.0, sinA, 0.0, 0.0, 1.0, 0.0, 0.0, -sinA, 0.0, cosA, 0.0, 0.0, 0.0, 0.0, 1.0]));
2371
+ };
2372
+
2373
+ _proto.setRotationY = function setRotationY(alpha) {
2374
+ alpha *= Math.PI / 180.0;
2375
+ var sinA = Math.sin(alpha);
2376
+ var cosA = Math.cos(alpha);
2377
+ this.setIdentity();
2378
+ this.data[0] = cosA;
2379
+ this.data[2] = sinA;
2380
+ this.data[8] = -sinA;
2381
+ this.data[10] = cosA;
2382
+ return this;
2383
+ };
2384
+
2385
+ _proto.rotateY = function rotateY(alpha) {
2386
+ alpha *= Math.PI / 180.0;
2387
+ var sinA = Math.sin(alpha);
2388
+ var cosA = Math.cos(alpha);
2389
+ var r0 = this.data[0];
2390
+ var r2 = this.data[2];
2391
+ this.data[0] = r0 * cosA - r2 * sinA;
2392
+ this.data[2] = r0 * sinA + r2 * cosA;
2393
+ r0 = this.data[4];
2394
+ r2 = this.data[6];
2395
+ this.data[4] = r0 * cosA - r2 * sinA;
2396
+ this.data[6] = r0 * sinA + r2 * cosA;
2397
+ r0 = this.data[8];
2398
+ r2 = this.data[10];
2399
+ this.data[8] = r0 * cosA - r2 * sinA;
2400
+ this.data[10] = r0 * sinA + r2 * cosA;
2401
+ r0 = this.data[12];
2402
+ r2 = this.data[14];
2403
+ this.data[12] = r0 * cosA - r2 * sinA;
2404
+ this.data[14] = r0 * sinA + r2 * cosA;
2405
+ return this;
2406
+ };
2407
+
2408
+ Matrix4.rotateZ = function rotateZ(alpha) {
2409
+ alpha *= Math.PI / 180.0;
2410
+ var sinA = Math.sin(alpha);
2411
+ var cosA = Math.cos(alpha);
2412
+ return new Matrix4(new Float32Array([cosA, sinA, 0.0, 0.0, -sinA, cosA, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]));
2413
+ };
2414
+
2415
+ _proto.setRotationZ = function setRotationZ(alpha) {
2416
+ alpha *= Math.PI / 180.0;
2417
+ var sinA = Math.sin(alpha);
2418
+ var cosA = Math.cos(alpha);
2419
+ this.setIdentity();
2420
+ this.data[0] = cosA;
2421
+ this.data[1] = sinA;
2422
+ this.data[4] = -sinA;
2423
+ this.data[5] = cosA;
2424
+ return this;
2425
+ };
2426
+
2427
+ _proto.rotateZ = function rotateZ(alpha) {
2428
+ alpha *= Math.PI / 180.0;
2429
+ var sinA = Math.sin(alpha);
2430
+ var cosA = Math.cos(alpha);
2431
+ var r0 = this.data[0];
2432
+ var r1 = this.data[1];
2433
+ this.data[0] = r0 * cosA - r1 * sinA;
2434
+ this.data[1] = r0 * sinA + r1 * cosA;
2435
+ r0 = this.data[4];
2436
+ r1 = this.data[5];
2437
+ this.data[4] = r0 * cosA - r1 * sinA;
2438
+ this.data[5] = r0 * sinA + r1 * cosA;
2439
+ r0 = this.data[8];
2440
+ r1 = this.data[9];
2441
+ this.data[8] = r0 * cosA - r1 * sinA;
2442
+ this.data[9] = r0 * sinA + r1 * cosA;
2443
+ r0 = this.data[12];
2444
+ r1 = this.data[13];
2445
+ this.data[12] = r0 * cosA - r1 * sinA;
2446
+ this.data[13] = r0 * sinA + r1 * cosA;
2447
+ return this;
2448
+ };
2449
+
2450
+ _proto.multiply = function multiply(matrix) {
2451
+ var result = new Matrix4(new Float32Array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]));
2452
+
2453
+ if (matrix == null) {
2454
+ return result;
2455
+ }
2456
+
2457
+ for (var i = 0; i < 4; ++i) {
2458
+ for (var j = 0; j < 4; ++j) {
2459
+ for (var k = 0; k < 4; ++k) {
2460
+ result.data[i * 4 + k] += this.data[i * 4 + j] * matrix.data[j * 4 + k];
2461
+ }
2462
+ }
2463
+ }
2464
+
2465
+ return result;
2466
+ };
2467
+
2468
+ Matrix4.ortho = function ortho(left, right, bottom, top, near, far) {
2469
+ if (near === void 0) {
2470
+ near = -100.0;
2471
+ }
2472
+
2473
+ if (far === void 0) {
2474
+ far = 100.0;
2475
+ }
2476
+
2477
+ return new Matrix4(new Float32Array([2.0 / (right - left), 0.0, 0.0, 0.0, 0.0, 2.0 / (top - bottom), 0.0, 0.0, 0.0, 0.0, -2.0 / (far - near), 0.0, -(left + right) / (right - left), -(top + bottom) / (top - bottom), -(near + far) / (near - far), 1.0]));
2478
+ };
2479
+
2480
+ _proto.setOrtho = function setOrtho(left, right, bottom, top, near, far) {
2481
+ if (near === void 0) {
2482
+ near = -100.0;
2483
+ }
2484
+
2485
+ if (far === void 0) {
2486
+ far = 100.0;
2487
+ }
2488
+
2489
+ this.data[0] = 2.0 / (right - left);
2490
+ this.data[1] = 0;
2491
+ this.data[2] = 0;
2492
+ this.data[3] = 0;
2493
+ this.data[4] = 0;
2494
+ this.data[5] = 2.0 / (top - bottom);
2495
+ this.data[6] = 0;
2496
+ this.data[7] = 0;
2497
+ this.data[8] = 0;
2498
+ this.data[9] = 0;
2499
+ this.data[10] = -2.0 / (far - near);
2500
+ this.data[11] = -1;
2501
+ this.data[12] = -(left + right) / (right - left);
2502
+ this.data[13] = -(top + bottom) / (top - bottom);
2503
+ this.data[14] = -(near + far) / (near - far);
2504
+ this.data[15] = 1.0;
2505
+ return this;
2506
+ };
2507
+
2508
+ Matrix4.perspective = function perspective(fov, aspect, near, far) {
2509
+ var y = Math.tan(fov / 2.0) * near;
2510
+ var x = y * aspect;
2511
+ return Matrix4.frustum(-x, x, -y, y, near, far);
2512
+ };
2513
+
2514
+ _proto.setPerspective = function setPerspective(fov, aspect, near, far) {
2515
+ var y = Math.tan(fov / 2.0) * near;
2516
+ var x = y * aspect;
2517
+ return this.setFrustum(-x, x, -y, y, near, far);
2518
+ };
2519
+
2520
+ Matrix4.frustum = function frustum(left, right, bottom, top, near, far) {
2521
+ if (near === void 0) {
2522
+ near = -100.0;
2523
+ }
2524
+
2525
+ if (far === void 0) {
2526
+ far = 100.0;
2527
+ }
2528
+
2529
+ return new Matrix4(new Float32Array([2 * near / (right - left), 0, 0, 0, 0, 2 * near / (top - bottom), 0, 0, (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, 0, 0, -2 * near * far / (far - near), 0]));
2530
+ };
2531
+
2532
+ _proto.setFrustum = function setFrustum(left, right, bottom, top, near, far) {
2533
+ if (near === void 0) {
2534
+ near = -100.0;
2535
+ }
2536
+
2537
+ if (far === void 0) {
2538
+ far = 100.0;
2539
+ }
2540
+
2541
+ this.data[0] = 2 * near / (right - left);
2542
+ this.data[1] = 0;
2543
+ this.data[2] = 0;
2544
+ this.data[3] = 0;
2545
+ this.data[4] = 0;
2546
+ this.data[5] = 2 * near / (top - bottom);
2547
+ this.data[6] = 0;
2548
+ this.data[7] = 0;
2549
+ this.data[8] = (right + left) / (right - left);
2550
+ this.data[9] = (top + bottom) / (top - bottom);
2551
+ this.data[10] = -(far + near) / (far - near);
2552
+ this.data[11] = -1;
2553
+ this.data[12] = 0;
2554
+ this.data[13] = 0;
2555
+ this.data[14] = -2 * near * far / (far - near);
2556
+ this.data[15] = 0;
2557
+ };
2558
+
2559
+ _proto.transform = function transform(vector, w) {
2560
+ if (w === void 0) {
2561
+ w = 0.0;
2562
+ }
2563
+
2564
+ var x = this.data[0 * 4 + 0] * vector.x + this.data[1 * 4 + 0] * vector.y + this.data[2 * 4 + 0] * vector.z + this.data[3 * 4 + 0] * w;
2565
+ var y = this.data[0 * 4 + 1] * vector.x + this.data[1 * 4 + 1] * vector.y + this.data[2 * 4 + 1] * vector.z + this.data[3 * 4 + 1] * w;
2566
+ var z = this.data[0 * 4 + 2] * vector.x + this.data[1 * 4 + 2] * vector.y + this.data[2 * 4 + 2] * vector.z + this.data[3 * 4 + 2] * w;
2567
+ w = this.data[0 * 4 + 3] * vector.x + this.data[1 * 4 + 3] * vector.y + this.data[2 * 4 + 3] * vector.z + this.data[3 * 4 + 3] * w;
2568
+
2569
+ if (w == 0) {
2570
+ w = 1;
2571
+ }
2572
+
2573
+ return new Vector3(x / w, y / w, z / w);
2574
+ };
2575
+
2576
+ _proto.buffer = function buffer() {
2577
+ return this.data;
2578
+ };
2579
+
2580
+ _proto.inverse = function inverse() {
2581
+ var rows = 4;
2582
+ var cols = 4;
2583
+ var A = this.data.slice();
2584
+ var B = new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
2585
+
2586
+ for (var c = 0; c < cols; ++c) {
2587
+ var r = c;
2588
+
2589
+ while (r < rows && A[r * 4 + c] == 0) {
2590
+ ++r;
2591
+ }
2592
+
2593
+ if (r == rows || A[r * 4 + c] == 0) {
2594
+ console.log("Cannot calculate inverse, determinant is zero");
2595
+ return this;
2596
+ }
2597
+
2598
+ if (r != c) {
2599
+ var _Ac = A.slice(c * rows, (c + 1) * rows);
2600
+
2601
+ var Ar = A.slice(r * rows, (r + 1) * rows);
2602
+ A.set(Ar, c * rows);
2603
+ A.set(_Ac, r * rows);
2604
+
2605
+ var _Bc = B.slice(c * rows, (c + 1) * rows);
2606
+
2607
+ var Br = B.slice(r * rows, (r + 1) * rows);
2608
+ B.set(Br, c * rows);
2609
+ B.set(_Bc, r * rows);
2610
+ }
2611
+
2612
+ var Ac = A.slice(c * rows, (c + 1) * rows);
2613
+ var Bc = B.slice(c * rows, (c + 1) * rows);
2614
+
2615
+ for (r = 0; r < rows; ++r) {
2616
+ var _Ar = A.slice(r * rows, (r + 1) * rows);
2617
+
2618
+ var _Br = B.slice(r * rows, (r + 1) * rows);
2619
+
2620
+ if (r != c) {
2621
+ if (_Ar[c] != 0) {
2622
+ var f = -_Ar[c] / Ac[c];
2623
+
2624
+ for (var s = c; s < cols; ++s) {
2625
+ _Ar[s] = _Ar[s] + f * Ac[s];
2626
+ }
2627
+
2628
+ A.set(_Ar, r * rows);
2629
+
2630
+ for (var _s = 0; _s < cols; ++_s) {
2631
+ _Br[_s] = _Br[_s] + f * Bc[_s];
2632
+ }
2633
+
2634
+ B.set(_Br, r * rows);
2635
+ }
2636
+ } else {
2637
+ var _f = Ac[c];
2638
+
2639
+ if (_f == 0) {
2640
+ console.log("Cannot calculate inverse, determinant is zero");
2641
+ return this;
2642
+ }
2643
+
2644
+ for (var _s2 = c; _s2 < cols; ++_s2) {
2645
+ _Ar[_s2] = _Ar[_s2] / _f;
2646
+ }
2647
+
2648
+ A.set(_Ar, r * rows);
2649
+
2650
+ for (var _s3 = 0; _s3 < cols; ++_s3) {
2651
+ _Br[_s3] = _Br[_s3] / _f;
2652
+ }
2653
+
2654
+ B.set(_Br, r * rows);
2655
+ }
2656
+ }
2657
+ }
2658
+
2659
+ return new Matrix4(B);
2660
+ };
2661
+
2662
+ _createClass(Matrix4, [{
2663
+ key: "position",
2664
+ get: function get() {
2665
+ return new Vector3(this.data[12], this.data[13], this.data[14]);
2666
+ }
2667
+ }]);
2668
+
2669
+ return Matrix4;
2670
+ }();
2671
+
2672
+ var Color = /*#__PURE__*/function () {
2673
+ function Color(red, green, blue, alpha) {
2674
+ if (red === void 0) {
2675
+ red = 0.0;
2676
+ }
2677
+
2678
+ if (green === void 0) {
2679
+ green = 0.0;
2680
+ }
2681
+
2682
+ if (blue === void 0) {
2683
+ blue = 0.0;
2684
+ }
2685
+
2686
+ if (alpha === void 0) {
2687
+ alpha = 1.0;
2688
+ }
2689
+
2690
+ this.alpha = alpha;
2691
+ this._buffer = new Float32Array([red, green, blue]);
2692
+ }
2693
+
2694
+ var _proto = Color.prototype;
2695
+
2696
+ _proto.rgbBuffer = function rgbBuffer() {
2697
+ return this._buffer;
2698
+ };
2699
+
2700
+ _proto.buffer = function buffer() {
2701
+ return new Float32Array([this.red, this.green, this.blue, this.alpha]);
2702
+ };
2703
+
2704
+ Color.fromHex = function fromHex(hexString) {
2705
+ if (hexString === void 0) {
2706
+ hexString = "000000";
2707
+ }
2708
+
2709
+ if (hexString.length == 4 || hexString.length == 7 || hexString.length == 9) {
2710
+ hexString = hexString.substring(1, hexString.length);
2711
+ }
2712
+
2713
+ if (hexString.length == 3) {
2714
+ hexString = hexString.split("").map(function (x) {
2715
+ return x + x;
2716
+ }).join("");
2717
+ }
2718
+
2719
+ var colorCode = parseInt(hexString, 16);
2720
+
2721
+ if (hexString.length == 6) {
2722
+ return new Color((colorCode >> 16) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
2723
+ } else {
2724
+ return new Color((colorCode >> 24 & 255) / 255, (colorCode >> 16 & 255) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
2725
+ }
2726
+ };
2727
+
2728
+ Color.fromInt = function fromInt(colorCode) {
2729
+ if (colorCode === void 0) {
2730
+ colorCode = 0;
2731
+ }
2732
+
2733
+ if (colorCode < 0) {
2734
+ colorCode = 0;
2735
+ }
2736
+
2737
+ return new Color((colorCode >> 16 & 255) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
2738
+ };
2739
+
2740
+ Color.fromVec3 = function fromVec3(color) {
2741
+ return new Color(color.x, color.y, color.z);
2742
+ };
2743
+
2744
+ Color.mix = function mix(a, b, factor) {
2745
+ return new Color(a.red * factor + b.red * (1 - factor), a.green * factor + b.green * (1 - factor), a.blue * factor + b.blue * (1 - factor), a.alpha * factor + b.alpha * (1 - factor));
2746
+ };
2747
+
2748
+ Color.isValid = function isValid(colorString) {
2749
+ return /^#?([0-9A-Fa-f]){6,8}$/i.test(colorString);
2750
+ };
2751
+
2752
+ _createClass(Color, [{
2753
+ key: "red",
2754
+ get: function get() {
2755
+ return this._buffer[0];
2756
+ }
2757
+ }, {
2758
+ key: "green",
2759
+ get: function get() {
2760
+ return this._buffer[1];
2761
+ }
2762
+ }, {
2763
+ key: "blue",
2764
+ get: function get() {
2765
+ return this._buffer[2];
2766
+ }
2767
+ }, {
2768
+ key: "rgba",
2769
+ get: function get() {
2770
+ return "rgba(" + this.red * 255 + "," + this.green * 255 + "," + this.blue * 255 + "," + this.alpha + ")";
2771
+ }
2772
+ }, {
2773
+ key: "code",
2774
+ get: function get() {
2775
+ var float2hex = function float2hex(f) {
2776
+ var hex = Math.floor(f * 255).toString(16);
2777
+ hex = hex.length == 1 ? "0" + hex : hex;
2778
+ hex = hex.length > 2 ? hex.substr(0, 2) : hex;
2779
+ return hex;
2780
+ };
2781
+
2782
+ return "#" + float2hex(this.red) + float2hex(this.green) + float2hex(this.blue) + float2hex(this.alpha);
2783
+ }
2784
+ }]);
2785
+
2786
+ return Color;
2787
+ }();
2788
+
2789
+ var MapConstants = /*#__PURE__*/function () {
2790
+ function MapConstants() {}
2791
+
2792
+ _createClass(MapConstants, null, [{
2793
+ key: "placeFontSize",
2794
+ get: function get() {
2795
+ return 12;
2796
+ }
2797
+ }, {
2798
+ key: "maxTiltIntersectWithScreen",
2799
+ get: function get() {
2800
+ return 90.0 - CameraConstants.fov * MathConstants.rad2Deg;
2801
+ }
2802
+ }]);
2803
+
2804
+ return MapConstants;
2805
+ }();
2806
+ MapConstants.none = -1.0;
2807
+ MapConstants.baseTileSize = 256;
2808
+ MapConstants.minLatitude = -85.051128779806604;
2809
+ MapConstants.maxLatitude = 85.051128779806604;
2810
+ MapConstants.maxLongitude = 180;
2811
+ MapConstants.minLongitude = -180;
2812
+ MapConstants.maxDegrees = 360;
2813
+ MapConstants.radiusEarthMeters = 6378137.0;
2814
+ MapConstants.halfEarthCircumFerenceInMeter = MapConstants.radiusEarthMeters * Math.PI;
2815
+ MapConstants.earthCircumFerenceInMeter = MapConstants.halfEarthCircumFerenceInMeter * 2;
2816
+ MapConstants.tileCacheSize = 512;
2817
+ MapConstants.baseMapLowestOrder = Number.MIN_SAFE_INTEGER;
2818
+ MapConstants.baseMapMiddleOrder = -1.0E6;
2819
+ MapConstants.buildingLayerOrder = 0;
2820
+ MapConstants.userPOILayerOrder = 1.0;
2821
+ MapConstants.pointGeoJsonWidth = 32;
2822
+ MapConstants.pointGeoJsonHeight = 32;
2823
+ MapConstants.placeSelectedIdPrefix = "maplink-selected-place-";
2824
+ MapConstants.placeWidth = 26;
2825
+ MapConstants.placeHeight = 32;
2826
+ MapConstants.spritePadding = 2.;
2827
+ MapConstants.poiFontWeight = "normal";
2828
+ MapConstants.poiMaxWidth = 120;
2829
+ MapConstants.poiNumLine = 2;
2830
+ MapConstants.poiDefaultColor = new Color(0.5, 0.6, 0.7);
2831
+ MapConstants.pointGeoJsonAnchor = [0.5, 1.0];
2832
+ MapConstants.infoWindowPadding = 2;
2833
+ MapConstants.flingMinVelocity = -10000.0;
2834
+ MapConstants.flingMaxVelocity = 10000.0;
2835
+ MapConstants.flingTimeConstant = 150.0;
2836
+ MapConstants.flingSpeedMultiply = 15;
2837
+ MapConstants.zoomSpeedMouseWheel = 15;
2838
+ MapConstants.minDurationFlyTo = 1000;
2839
+ MapConstants.maxDurationFlyTo = 13000;
2840
+ MapConstants.maxBearingAngle = 720;
2841
+ MapConstants.defaultMinZoom = 3;
2842
+ MapConstants.defaultMinZoom3d = 17;
2843
+ MapConstants.defaultMaxZoom = 22;
2844
+ MapConstants.defaultMaxNativeZoom = 19;
2845
+ MapConstants.geoJsonMinNativeZoom = 20;
2846
+ MapConstants.vectorBuildingsMinZoom = 17;
2847
+ MapConstants.tileExtend = 4096.0;
2848
+ MapConstants.defaultAnimationDuration = 300;
2849
+ MapConstants.defaultFlyZoom = 17.0;
2850
+ MapConstants.minTilt = 0.0;
2851
+ MapConstants.maxTilt2D = 40.0;
2852
+ MapConstants.maxTilt3D = 87.0;
2853
+ MapConstants.minTiltReduceFog = 75.0;
2854
+ MapConstants.minTimeMoving = 150.0;
2855
+ MapConstants.minTimeDoubleZoom = 500.0;
2856
+ MapConstants.minTimeSpanTo = 500.0;
2857
+ MapConstants.maxTimeSpanTo = 4000.0;
2858
+ MapConstants.skyboxMapBorderMinimum = 0.001;
2859
+ MapConstants.metersPerPixelAtLatitude = 0.0;
2860
+ MapConstants.mapBackgroundColor2D = Color.fromHex("#f2efe9");
2861
+ MapConstants.mapBackgroundColor3D = Color.fromHex("#e1e1e1");
2862
+ MapConstants.satellitePOIColor = new Color(1.0, 1.0, 1.0);
2863
+ MapConstants.satellitePOIHalo = new Color(0.0, 0.0, 0.0);
2864
+ MapConstants.mapBackgroundScaleRatio = 20000.0;
2865
+ MapConstants.clusterMaxPointCount = 1000000;
2866
+ MapConstants.biasMatrix = new Matrix4(new Float32Array([0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0]));
2867
+ MapConstants.FPS = 1000.0 / 15.0;
2868
+ MapConstants.buildingOverlayIdPrefix = "_overlay";
2869
+ MapConstants.customBuildingType = "custom_building";
2870
+ MapConstants.touchBoxSize = 8.0;
2871
+ MapConstants.zoomStep = 0.25;
2872
+ MapConstants.distanceRatioToForceMoveCamera = 3.0;
2873
+ MapConstants.gridIndexExtent = 4096;
2874
+ MapConstants.gridIndexN = 4;
2875
+ MapConstants.gridIndexPadding = 0;
2876
+ var MathConstants = function MathConstants() {};
2877
+ MathConstants.rad2Deg = 180 / Math.PI;
2878
+ MathConstants.deg2Rad = Math.PI / 180.0;
2879
+ MathConstants.epsilon = 1e-6;
2880
+ var CameraConstants = function CameraConstants() {};
2881
+ CameraConstants.fov = 30 * MathConstants.deg2Rad;
2882
+ CameraConstants.nearPlane = 0.1;
2883
+ CameraConstants.farPlane = 1000;
2884
+ CameraConstants.height = 15.5;
2885
+ var ColorConstants = /*#__PURE__*/function () {
2886
+ function ColorConstants() {}
2887
+
2888
+ ColorConstants.getSkyColor = function getSkyColor(name) {
2889
+ return ColorConstants.skyColors[name];
2890
+ };
2891
+
2892
+ ColorConstants.getFogColor = function getFogColor(name) {
2893
+ return ColorConstants.fogColors[name];
2894
+ };
2895
+
2896
+ ColorConstants.getLightColor = function getLightColor(name) {
2897
+ return ColorConstants.lightColors[name];
2898
+ };
2899
+
2900
+ return ColorConstants;
2901
+ }();
2902
+ ColorConstants.skyColors = {
2903
+ "Morning": Color.fromHex("cdf9ff"),
2904
+ "Noon": Color.fromHex("0783f4"),
2905
+ "AfterNoon": Color.fromHex("243a8b"),
2906
+ "Evening": Color.fromHex("182863")
2907
+ };
2908
+ ColorConstants.fogColors = {
2909
+ "Morning": Color.fromHex("FAD8C4"),
2910
+ "Noon": Color.fromHex("FAFAFA"),
2911
+ "AfterNoon": Color.fromHex("FAA899"),
2912
+ "Evening": Color.fromHex("141c36")
2913
+ };
2914
+ ColorConstants.lightColors = {
2915
+ "Morning": Color.fromHex("#DE8989"),
2916
+ "Noon": Color.fromHex("#F8F8F8"),
2917
+ "AfterNoon": Color.fromHex("#BE321A"),
2918
+ "Evening": Color.fromHex("#1E0032")
2919
+ };
2920
+
2921
+ var ClassType;
2922
+
2923
+ (function (ClassType) {
2924
+ ClassType[ClassType["MARKER"] = 0] = "MARKER";
2925
+ ClassType[ClassType["CIRCLE"] = 1] = "CIRCLE";
2926
+ ClassType[ClassType["POLYLINE"] = 2] = "POLYLINE";
2927
+ ClassType[ClassType["POLYGON"] = 3] = "POLYGON";
2928
+ ClassType[ClassType["POI"] = 4] = "POI";
2929
+ ClassType[ClassType["BUILDING"] = 5] = "BUILDING";
2930
+ ClassType[ClassType["VECTOR_TILE_LAYER"] = 6] = "VECTOR_TILE_LAYER";
2931
+ ClassType[ClassType["BUILDING_QUERY_RESULT"] = 7] = "BUILDING_QUERY_RESULT";
2932
+ ClassType[ClassType["POLYLINE_DATA"] = 8] = "POLYLINE_DATA";
2933
+ ClassType[ClassType["POLYGON_DATA"] = 9] = "POLYGON_DATA";
2934
+ ClassType[ClassType["ICON"] = 10] = "ICON";
2935
+ ClassType[ClassType["LATLNG"] = 11] = "LATLNG";
2936
+ ClassType[ClassType["POINT"] = 12] = "POINT";
2937
+ ClassType[ClassType["CAMERA_POSITION"] = 13] = "CAMERA_POSITION";
2938
+ ClassType[ClassType["LATLNG_BOUNDS"] = 14] = "LATLNG_BOUNDS";
2939
+ ClassType[ClassType["MARKER_LABEL"] = 15] = "MARKER_LABEL";
2940
+ ClassType[ClassType["FEATURE"] = 16] = "FEATURE";
2941
+ ClassType[ClassType["TILE_FEATURE"] = 17] = "TILE_FEATURE";
2942
+ ClassType[ClassType["VECTOR_TILE_FEATURE"] = 18] = "VECTOR_TILE_FEATURE";
2943
+ })(ClassType || (ClassType = {}));
2944
+
2945
+ var Map4dObject = /*#__PURE__*/function () {
2946
+ function Map4dObject(classType) {
2947
+ this.classType = classType;
2948
+ }
2949
+
2950
+ Map4dObject.isClassType = function isClassType(mapObject, classType) {
2951
+ var mfClassType = (mapObject || {}).classType;
2952
+ return mfClassType == classType;
2953
+ };
2954
+
2955
+ return Map4dObject;
2956
+ }();
2957
+
2958
+ var LatLng = /*#__PURE__*/function (_Map4dObject) {
2959
+ _inheritsLoose(LatLng, _Map4dObject);
2960
+
2961
+ function LatLng(lat, lng) {
2962
+ var _this;
2963
+
2964
+ _this = _Map4dObject.call(this, ClassType.LATLNG) || this;
2965
+ _this.lat = lat;
2966
+ _this.lng = lng;
2967
+ return _this;
2968
+ }
2969
+
2970
+ var _proto = LatLng.prototype;
2971
+
2972
+ _proto.equals = function equals(other) {
2973
+ return this.lat == other.lat && this.lng == other.lng;
2974
+ };
2975
+
2976
+ _proto.valid = function valid() {
2977
+ return isFinite(this.lat) && Math.abs(this.lat) <= 90;
2978
+ };
2979
+
2980
+ _proto.toString = function toString() {
2981
+ return "(" + this.lat + ", " + this.lng + ")";
2982
+ };
2983
+
2984
+ LatLng.convert = function convert(input) {
2985
+ if (Map4dObject.isClassType(input, ClassType.LATLNG)) {
2986
+ return input;
2987
+ }
2988
+
2989
+ if (Array.isArray(input) && input.length === 2) {
2990
+ return new LatLng(Number(input[1]), Number(input[0]));
2991
+ }
2992
+
2993
+ if (!Array.isArray(input) && typeof input === "object" && input !== null && "lat" in input && "lng" in input) {
2994
+ return new LatLng(Number(input.lat), Number(input.lng));
2995
+ }
2996
+
2997
+ throw new Error("`ILngLat` argument must be specified as a LngLat instance, an object " + "{lat: <lat>, lng: <lng>}, or an array of [<lng>, <lat>]");
2998
+ };
2999
+
3000
+ _proto.distanceTo = function distanceTo(target) {
3001
+ if (target == null) {
3002
+ return 0;
3003
+ }
3004
+
3005
+ var desc = LatLng.convert(target);
3006
+ var latStartRadian = MathConstants.deg2Rad * this.lat;
3007
+ var longStartRadian = MathConstants.deg2Rad * this.lng;
3008
+ var latDescRadian = MathConstants.deg2Rad * desc.lat;
3009
+ var longDescRadian = MathConstants.deg2Rad * desc.lng;
3010
+ var u = Math.sin((latDescRadian - latStartRadian) / 2);
3011
+ var v = Math.sin((longDescRadian - longStartRadian) / 2);
3012
+ return 2.0 * MapConstants.radiusEarthMeters * Math.asin(Math.sqrt(u * u + Math.cos(latStartRadian) * Math.cos(latDescRadian) * v * v));
3013
+ };
3014
+
3015
+ _proto.normalize = function normalize() {
3016
+ var sign = this.lat > 0 ? -1 : 1;
3017
+ var lat = (this.lat - sign * 90) % 180 + 90 * sign;
3018
+ sign = this.lng > 0 ? -1 : 1;
3019
+ var lng = (this.lng - sign * 180) % 380 + 180 * sign;
3020
+ return new LatLng(lat, lng);
3021
+ };
3022
+
3023
+ _proto.add = function add(a) {
3024
+ return new LatLng(this.lat + a.lat, this.lng + a.lng).normalize();
3025
+ };
3026
+
3027
+ _proto.subtract = function subtract(a) {
3028
+ if (!a) {
3029
+ return this;
3030
+ }
3031
+
3032
+ return new LatLng(this.lat - a.lat, this.lng - a.lng).normalize();
3033
+ };
3034
+
3035
+ return LatLng;
3036
+ }(Map4dObject);
3037
+
3038
+ var ProjectionMercator = /*#__PURE__*/function () {
3039
+ function ProjectionMercator() {}
3040
+
3041
+ ProjectionMercator.projectInternal = function projectInternal(latLng, worldSize) {
3042
+ var latitude = MathUtils.clamp(latLng.lat, MapConstants.minLatitude, MapConstants.maxLatitude);
3043
+ return new Vector2(MapConstants.maxLongitude + latLng.lng, MapConstants.maxLongitude - MathConstants.rad2Deg * Math.log(Math.tan(Math.PI / 4 + latitude * Math.PI / MapConstants.maxDegrees))).multiply(worldSize / MapConstants.maxDegrees);
3044
+ };
3045
+
3046
+ ProjectionMercator.convertToMeterFromLatLng = function convertToMeterFromLatLng(latLng) {
3047
+ var constrainedLatitude = MathUtils.clamp(latLng.lat, MapConstants.minLatitude, MapConstants.maxLatitude);
3048
+ var constrainedLongitude = latLng.lng;
3049
+ var m = 1 - 1e-15;
3050
+ var f = MathUtils.clamp(Math.sin(MathConstants.deg2Rad * constrainedLatitude), -m, m);
3051
+ var easting = MapConstants.radiusEarthMeters * constrainedLongitude * MathConstants.deg2Rad;
3052
+ var northing = 0.5 * MapConstants.radiusEarthMeters * Math.log((1 + f) / (1 - f));
3053
+ return new Vector2(easting, northing);
3054
+ };
3055
+
3056
+ ProjectionMercator.convertToLatLngFromMeter = function convertToLatLngFromMeter(meters) {
3057
+ var latitude = (2 * Math.atan(Math.exp(meters.y / MapConstants.radiusEarthMeters)) - Math.PI / 2.0) * MathConstants.rad2Deg;
3058
+ var longitude = meters.x * MathConstants.rad2Deg / MapConstants.radiusEarthMeters;
3059
+ return new LatLng(latitude, longitude);
3060
+ };
3061
+
3062
+ ProjectionMercator.projectZoom = function projectZoom(latLng, zoom) {
3063
+ return this.projectInternal(latLng, 1 << zoom);
3064
+ };
3065
+
3066
+ return ProjectionMercator;
3067
+ }();
3068
+
3069
+ var CoordinateTransformer = /*#__PURE__*/function () {
3070
+ function CoordinateTransformer(coordinates) {
3071
+ this.coordinates = [];
3072
+ this.coordinates = coordinates.map(function (coordinate) {
3073
+ return LatLng.convert(coordinate);
3074
+ });
3075
+ }
3076
+
3077
+ var _proto = CoordinateTransformer.prototype;
3078
+
3079
+ _proto.setCoordinates = function setCoordinates(coordinates) {
3080
+ this.coordinates = coordinates.map(function (coordinate) {
3081
+ return LatLng.convert(coordinate);
3082
+ });
3083
+ };
3084
+
3085
+ _proto.addCoordinates = function addCoordinates(coordinates) {
3086
+ var _this = this;
3087
+
3088
+ coordinates.forEach(function (coordinate) {
3089
+ return _this.coordinates.push(LatLng.convert(coordinate));
3090
+ });
3091
+ };
3092
+
3093
+ _proto.rotate = function rotate(degree, anchor) {
3094
+ if (anchor === void 0) {
3095
+ anchor = null;
3096
+ }
3097
+
3098
+ if (this.coordinates.length <= 1) {
3099
+ return this.coordinates.slice();
3100
+ }
3101
+
3102
+ var center = null;
3103
+
3104
+ if (anchor != null) {
3105
+ center = LatLng.convert(center);
3106
+ } else {
3107
+ center = this.center;
3108
+ }
3109
+
3110
+ var centerInMeters = ProjectionMercator.convertToMeterFromLatLng(center);
3111
+ var transformedCoordinates = [];
3112
+ var degreeInRadians = MathUtils.toRadians(degree);
3113
+ this.coordinates.forEach(function (coordinate) {
3114
+ var point = ProjectionMercator.convertToMeterFromLatLng(coordinate);
3115
+ point.x -= centerInMeters.x;
3116
+ point.y -= centerInMeters.y;
3117
+ var x = point.x;
3118
+ var y = point.y;
3119
+ point.x = x * Math.cos(degreeInRadians) - y * Math.sin(degreeInRadians);
3120
+ point.y = x * Math.sin(degreeInRadians) + y * Math.cos(degreeInRadians);
3121
+ transformedCoordinates.push(ProjectionMercator.convertToLatLngFromMeter(new Vector2(centerInMeters.x + point.x, centerInMeters.y + point.y)));
3122
+ });
3123
+ return transformedCoordinates;
3124
+ };
3125
+
3126
+ _proto.translate = function translate(target, anchor) {
3127
+ if (anchor === void 0) {
3128
+ anchor = null;
3129
+ }
3130
+
3131
+ if (this.coordinates.length <= 0) {
3132
+ return [];
3133
+ }
3134
+
3135
+ var newCenter = LatLng.convert(target);
3136
+ var oldCenter = null;
3137
+
3138
+ if (anchor != null) {
3139
+ oldCenter = LatLng.convert(anchor);
3140
+ } else {
3141
+ oldCenter = this.center;
3142
+ }
3143
+
3144
+ var transformedCoordinates = [];
3145
+ var translateVectorX = newCenter.lng - oldCenter.lng;
3146
+ var translateVectorY = newCenter.lat - oldCenter.lat;
3147
+ this.coordinates.forEach(function (coordinate) {
3148
+ transformedCoordinates.push(new LatLng(coordinate.lat + translateVectorY, coordinate.lng + translateVectorX));
3149
+ });
3150
+ return transformedCoordinates;
3151
+ };
3152
+
3153
+ _proto.scale = function scale(_scale, anchor) {
3154
+ if (anchor === void 0) {
3155
+ anchor = null;
3156
+ }
3157
+
3158
+ if (this.coordinates.length <= 1) {
3159
+ return this.coordinates.slice();
3160
+ }
3161
+
3162
+ var center = null;
3163
+
3164
+ if (anchor != null) {
3165
+ center = LatLng.convert(anchor);
3166
+ } else {
3167
+ center = this.center;
3168
+ }
3169
+
3170
+ var centerInMeters = ProjectionMercator.convertToMeterFromLatLng(center);
3171
+ var transformedCoordinates = [];
3172
+ this.coordinates.forEach(function (coordinate) {
3173
+ var point = ProjectionMercator.convertToMeterFromLatLng(coordinate);
3174
+ point.x -= centerInMeters.x;
3175
+ point.y -= centerInMeters.y;
3176
+ point.x *= _scale;
3177
+ point.y *= _scale;
3178
+ transformedCoordinates.push(ProjectionMercator.convertToLatLngFromMeter(new Vector2(centerInMeters.x + point.x, centerInMeters.y + point.y)));
3179
+ });
3180
+ return transformedCoordinates;
3181
+ };
3182
+
3183
+ _createClass(CoordinateTransformer, [{
3184
+ key: "center",
3185
+ get: function get() {
3186
+ if (this.coordinates.length == 0) {
3187
+ return null;
3188
+ }
3189
+
3190
+ var center = new LatLng(0, 0);
3191
+
3192
+ for (var i = 0; i < this.coordinates.length; ++i) {
3193
+ center.lat += this.coordinates[i].lat;
3194
+ center.lng += this.coordinates[i].lng;
3195
+ }
3196
+
3197
+ center.lat /= this.coordinates.length;
3198
+ center.lng /= this.coordinates.length;
3199
+ return center;
3200
+ }
3201
+ }]);
3202
+
3203
+ return CoordinateTransformer;
3204
+ }();
3205
+
3206
+ export { CoordinateTransformer, LatLng, MFBuilding, MFBuildingOverlay, MFCircle, MFDataLayer, MFDirectionsRenderer, MFGroundOverlay, MFImageOverlay, MFMap, MFMarker, MFMarkerCluster, MFPOI, MFPOIOverlay, MFPolygon, MFPolyline, MFTileOverlay };
1937
3207
  //# sourceMappingURL=index.modern.js.map