globe.gl 2.35.1 → 2.36.1

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.35.1 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.36.1 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) :
@@ -53335,15 +53335,15 @@ void main() {
53335
53335
  // support both modes for backwards threejs compatibility
53336
53336
  var setAttributeFn = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
53337
53337
  var ConicPolygonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
53338
- function ConicPolygonGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
53338
+ function ConicPolygonGeometry(polygonGeoJson, bottomHeight, topHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
53339
53339
  var _this;
53340
53340
  _classCallCheck$1(this, ConicPolygonGeometry);
53341
53341
  _this = _callSuper$1(this, ConicPolygonGeometry);
53342
53342
  _this.type = 'ConicPolygonGeometry';
53343
53343
  _this.parameters = {
53344
53344
  polygonGeoJson: polygonGeoJson,
53345
- startHeight: startHeight,
53346
- endHeight: endHeight,
53345
+ bottomHeight: bottomHeight,
53346
+ topHeight: topHeight,
53347
53347
  closedBottom: closedBottom,
53348
53348
  closedTop: closedTop,
53349
53349
  includeSides: includeSides,
@@ -53351,8 +53351,8 @@ void main() {
53351
53351
  };
53352
53352
 
53353
53353
  // defaults
53354
- startHeight = startHeight || 0;
53355
- endHeight = endHeight || 1;
53354
+ bottomHeight = bottomHeight || 0;
53355
+ topHeight = topHeight || 1;
53356
53356
  closedBottom = closedBottom !== undefined ? closedBottom : true;
53357
53357
  closedTop = closedTop !== undefined ? closedTop : true;
53358
53358
  includeSides = includeSides !== undefined ? includeSides : true;
@@ -53381,8 +53381,8 @@ void main() {
53381
53381
  _this.addGroup(prevIndCnt, indices.length - prevIndCnt, groupCnt++);
53382
53382
  };
53383
53383
  includeSides && addGroup(generateTorso());
53384
- closedBottom && addGroup(generateCap(startHeight, false));
53385
- closedTop && addGroup(generateCap(endHeight, true));
53384
+ closedBottom && addGroup(generateCap(bottomHeight, false));
53385
+ closedTop && addGroup(generateCap(topHeight, true));
53386
53386
 
53387
53387
  // build geometry
53388
53388
  _this.setIndex(indices);
@@ -53395,22 +53395,25 @@ void main() {
53395
53395
  //
53396
53396
 
53397
53397
  function generateVertices(polygon, altitude) {
53398
+ var altFn = typeof altitude === 'function' ? altitude : function () {
53399
+ return altitude;
53400
+ };
53398
53401
  var coords3d = polygon.map(function (coords) {
53399
53402
  return coords.map(function (_ref) {
53400
53403
  var _ref2 = _slicedToArray$3(_ref, 2),
53401
53404
  lng = _ref2[0],
53402
53405
  lat = _ref2[1];
53403
- return polar2Cartesian$1(lat, lng, altitude);
53406
+ return polar2Cartesian$1(lat, lng, altFn(lng, lat));
53404
53407
  });
53405
53408
  });
53406
53409
  // returns { vertices, holes, coordinates }. Each point generates 3 vertice items (x,y,z).
53407
53410
  return flatten(coords3d);
53408
53411
  }
53409
53412
  function generateTorso() {
53410
- var _generateVertices = generateVertices(contour, startHeight),
53413
+ var _generateVertices = generateVertices(contour, bottomHeight),
53411
53414
  bottomVerts = _generateVertices.vertices,
53412
53415
  holes = _generateVertices.holes;
53413
- var _generateVertices2 = generateVertices(contour, endHeight),
53416
+ var _generateVertices2 = generateVertices(contour, topHeight),
53414
53417
  topVerts = _generateVertices2.vertices;
53415
53418
  var vertices = merge([topVerts, bottomVerts]);
53416
53419
  var numPoints = Math.round(topVerts.length / 3);
@@ -132676,7 +132679,7 @@ var<${access}> ${name} : ${structName};`;
132676
132679
  }
132677
132680
  }
132678
132681
 
132679
- var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
132682
+ var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n background: rgba(0,0,0,0.5);\n padding: 2px 5px;\n border-radius: 3px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
132680
132683
  styleInject(css_248z);
132681
132684
 
132682
132685
  function _arrayLikeToArray(r, a) {
@@ -132817,7 +132820,10 @@ var<${access}> ${name} : ${structName};`;
132817
132820
  onChange: function onChange(_, state) {
132818
132821
  // Reset hover state
132819
132822
  state.hoverObj = null;
132820
- if (state.toolTipElem) state.toolTipElem.innerHTML = '';
132823
+ if (state.toolTipElem) {
132824
+ state.toolTipElem.style.display = 'none';
132825
+ state.toolTipElem.innerHTML = '';
132826
+ }
132821
132827
  },
132822
132828
  triggerUpdate: false
132823
132829
  },
@@ -132887,7 +132893,7 @@ var<${access}> ${name} : ${structName};`;
132887
132893
  }
132888
132894
  if (topObject !== state.hoverObj) {
132889
132895
  state.onHover(topObject, state.hoverObj);
132890
- state.toolTipElem.innerHTML = topObject ? index$1(state.tooltipContent)(topObject) || '' : '';
132896
+ state.toolTipElem.style.display = (state.toolTipElem.innerHTML = topObject ? index$1(state.tooltipContent)(topObject) || '' : '') ? 'initial' : 'none';
132891
132897
  state.hoverObj = topObject;
132892
132898
  }
132893
132899
  }
@@ -133695,11 +133701,14 @@ var<${access}> ${name} : ${structName};`;
133695
133701
  controls.dampingFactor = 0.1;
133696
133702
  controls.rotateSpeed = 0.3;
133697
133703
  controls.zoomSpeed = 0.3;
133704
+ controls.zoomToCursor = true;
133698
133705
  controls.addEventListener('change', function () {
133706
+ controls.target.setScalar(0); // Keep orbit target on center
133707
+
133699
133708
  // adjust controls speed based on altitude
133700
133709
  var pov = _this.pointOfView();
133701
133710
  controls.rotateSpeed = pov.altitude * 0.3;
133702
- controls.zoomSpeed = Math.sqrt(pov.altitude) * 0.4;
133711
+ controls.zoomSpeed = Math.sqrt(pov.altitude) * 0.5;
133703
133712
 
133704
133713
  // Update three-globe pov when camera moves, for proper hiding of elements
133705
133714
  state.globe.setPointOfView(state.renderObjs.camera());