globe.gl 2.34.5 → 2.34.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/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.34.5 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.34.6 globe.gl - https://github.com/vasturiano/globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -48674,7 +48674,7 @@ void main() {
48674
48674
  }
48675
48675
  }
48676
48676
  function _createClass$2(e, r, t) {
48677
- return r && _defineProperties$1(e.prototype, r), Object.defineProperty(e, "prototype", {
48677
+ return _defineProperties$1(e.prototype, r), Object.defineProperty(e, "prototype", {
48678
48678
  writable: !1
48679
48679
  }), e;
48680
48680
  }
@@ -50453,7 +50453,7 @@ void main() {
50453
50453
 
50454
50454
  if (v1 === 0 && v2 === 0) {
50455
50455
  if ((u2 <= 0 && u1 >= 0) || (u1 <= 0 && u2 >= 0)) { return 0 }
50456
- } else if ((v2 >= 0 && v1 < 0) || (v2 < 0 && v1 >= 0)) {
50456
+ } else if ((v2 >= 0 && v1 <= 0) || (v2 <= 0 && v1 >= 0)) {
50457
50457
  f = orient2d(u1, u2, v1, v2, 0, 0);
50458
50458
  if (f === 0) { return 0 }
50459
50459
  if ((f > 0 && v2 > 0 && v1 <= 0) || (f < 0 && v2 <= 0 && v1 > 0)) { k++; }
@@ -51780,7 +51780,7 @@ void main() {
51780
51780
  };
51781
51781
  };
51782
51782
 
51783
- return data ? v(data) : v;
51783
+ return v(data) ;
51784
51784
  }
51785
51785
 
51786
51786
  function _arrayLikeToArray$3(r, a) {
@@ -72804,6 +72804,7 @@ void main() {
72804
72804
 
72805
72805
  var THREE$i = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
72806
72806
  : {
72807
+ Camera: Camera,
72807
72808
  Group: Group$1,
72808
72809
  Vector2: Vector2,
72809
72810
  Vector3: Vector3
@@ -72903,10 +72904,13 @@ void main() {
72903
72904
  }
72904
72905
  return cartesian2Polar.apply(void 0, args);
72905
72906
  },
72906
- setPointOfView: function setPointOfView(state, globalPov, globePos) {
72907
+ setPointOfView: function setPointOfView(state, camera) {
72907
72908
  var isBehindGlobe = undefined;
72908
- if (globalPov) {
72909
+ if (state.scene && camera) {
72910
+ var globalPov = camera instanceof THREE$i.Camera ? camera.position : camera; // for backwards compatibility
72909
72911
  var globeRadius = getGlobeRadius();
72912
+ var globePos = new THREE$i.Vector3();
72913
+ state.scene.getWorldPosition(globePos);
72910
72914
  var pov = globePos ? globalPov.clone().sub(globePos) : globalPov; // convert to local vector
72911
72915
 
72912
72916
  var povDist, povEdgeDist, povEdgeAngle;
@@ -73055,29 +73059,29 @@ void main() {
73055
73059
  function fromKapsule (kapsule) {
73056
73060
  var baseClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Object;
73057
73061
  var initKapsuleWithSelf = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
73058
- var FromKapsule = /*#__PURE__*/function (_baseClass) {
73059
- function FromKapsule() {
73062
+ var Globe = /*#__PURE__*/function (_baseClass) {
73063
+ function Globe() {
73060
73064
  var _this;
73061
- _classCallCheck(this, FromKapsule);
73065
+ _classCallCheck(this, Globe);
73062
73066
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
73063
73067
  args[_key] = arguments[_key];
73064
73068
  }
73065
- _this = _callSuper(this, FromKapsule, [].concat(args));
73069
+ _this = _callSuper(this, Globe, [].concat(args));
73066
73070
  _this.__kapsuleInstance = _construct$1(kapsule, [].concat(_toConsumableArray$1(initKapsuleWithSelf ? [_this] : []), args));
73067
73071
  return _this;
73068
73072
  }
73069
- _inherits(FromKapsule, _baseClass);
73070
- return _createClass(FromKapsule);
73073
+ _inherits(Globe, _baseClass);
73074
+ return _createClass(Globe);
73071
73075
  }(baseClass); // attach kapsule props/methods to class prototype
73072
73076
  Object.keys(kapsule()).forEach(function (m) {
73073
- return FromKapsule.prototype[m] = function () {
73077
+ return Globe.prototype[m] = function () {
73074
73078
  var _this$__kapsuleInstan;
73075
73079
  var returnVal = (_this$__kapsuleInstan = this.__kapsuleInstance)[m].apply(_this$__kapsuleInstan, arguments);
73076
73080
  return returnVal === this.__kapsuleInstance ? this // chain based on this class, not the kapsule obj
73077
73081
  : returnVal;
73078
73082
  };
73079
73083
  });
73080
- return FromKapsule;
73084
+ return Globe;
73081
73085
  }
73082
73086
 
73083
73087
  var three$1 = window.THREE ? window.THREE : {
@@ -113844,9 +113848,7 @@ var<${access}> ${name} : ${structName};`;
113844
113848
  * }
113845
113849
  */
113846
113850
  function hsl(value, saturation, lightness) {
113847
- if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
113848
- return hslToHex(value, saturation, lightness);
113849
- } else if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
113851
+ if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
113850
113852
  return hslToHex(value.hue, value.saturation, value.lightness);
113851
113853
  }
113852
113854
  throw new PolishedError(1);
@@ -113879,9 +113881,7 @@ var<${access}> ${name} : ${structName};`;
113879
113881
  * }
113880
113882
  */
113881
113883
  function hsla(value, saturation, lightness, alpha) {
113882
- if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
113883
- return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
113884
- } else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
113884
+ if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
113885
113885
  return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
113886
113886
  }
113887
113887
  throw new PolishedError(2);
@@ -113954,12 +113954,7 @@ var<${access}> ${name} : ${structName};`;
113954
113954
  * }
113955
113955
  */
113956
113956
  function rgba(firstValue, secondValue, thirdValue, fourthValue) {
113957
- if (typeof firstValue === 'string' && typeof secondValue === 'number') {
113958
- var rgbValue = parseToRgb(firstValue);
113959
- return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
113960
- } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
113961
- return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
113962
- } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
113957
+ if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
113963
113958
  return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
113964
113959
  }
113965
113960
  throw new PolishedError(7);
@@ -115565,7 +115560,7 @@ var<${access}> ${name} : ${structName};`;
115565
115560
  controls.zoomSpeed = (pov.altitude + 1) * 0.1; // Math.sqrt(pov.altitude) * 0.2;
115566
115561
 
115567
115562
  // Update three-globe pov when camera moves, for proper hiding of elements
115568
- state.globe.setPointOfView(state.renderObjs.camera().position);
115563
+ state.globe.setPointOfView(state.renderObjs.camera());
115569
115564
  state.onZoom && state.onZoom(pov);
115570
115565
  });
115571
115566