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