globe.gl 2.34.6 → 2.35.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.mjs CHANGED
@@ -7,7 +7,7 @@ import Kapsule from 'kapsule';
7
7
  import { Tween, Easing, Group } from '@tweenjs/tween.js';
8
8
 
9
9
  function styleInject(css, ref) {
10
- if (ref === void 0) ref = {};
10
+ if (ref === undefined) ref = {};
11
11
  var insertAt = ref.insertAt;
12
12
  if (typeof document === 'undefined') {
13
13
  return;
@@ -45,9 +45,9 @@ function _arrayWithoutHoles(r) {
45
45
  function _defineProperty(e, r, t) {
46
46
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
47
47
  value: t,
48
- enumerable: !0,
49
- configurable: !0,
50
- writable: !0
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true
51
51
  }) : e[r] = t, e;
52
52
  }
53
53
  function _iterableToArray(r) {
@@ -69,7 +69,7 @@ function ownKeys(e, r) {
69
69
  function _objectSpread2(e) {
70
70
  for (var r = 1; r < arguments.length; r++) {
71
71
  var t = null != arguments[r] ? arguments[r] : {};
72
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
72
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
73
73
  _defineProperty(e, r, t[r]);
74
74
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
75
75
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
@@ -103,7 +103,7 @@ function _toConsumableArray(r) {
103
103
  function _toPrimitive(t, r) {
104
104
  if ("object" != typeof t || !t) return t;
105
105
  var e = t[Symbol.toPrimitive];
106
- if (void 0 !== e) {
106
+ if (undefined !== e) {
107
107
  var i = e.call(t, r || "default");
108
108
  if ("object" != typeof i) return i;
109
109
  throw new TypeError("@@toPrimitive must return a primitive value.");
@@ -118,7 +118,7 @@ function _unsupportedIterableToArray(r, a) {
118
118
  if (r) {
119
119
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
120
120
  var t = {}.toString.call(r).slice(8, -1);
121
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
121
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
122
122
  }
123
123
  }
124
124
 
@@ -166,7 +166,7 @@ var THREE = _objectSpread2(_objectSpread2({}, window.THREE ? window.THREE // Pre
166
166
 
167
167
  // Expose config from ThreeGlobe
168
168
  var bindGlobe = linkKapsule('globe', ThreeGlobe);
169
- var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
169
+ var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'globeTileEngineUrl', 'globeTileEngineMaxLevel', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
170
170
  return _defineProperty({}, p, bindGlobe.linkProp(p));
171
171
  })));
172
172
  var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
@@ -357,7 +357,7 @@ var globe = Kapsule({
357
357
  cancelAnimationFrame(state.animationFrameRequestId);
358
358
  state.animationFrameRequestId = null;
359
359
  }
360
- (_state$globe = state.globe) === null || _state$globe === void 0 || _state$globe.pauseAnimation();
360
+ (_state$globe = state.globe) === null || _state$globe === undefined || _state$globe.pauseAnimation();
361
361
  return this;
362
362
  },
363
363
  resumeAnimation: function resumeAnimation(state) {
@@ -365,7 +365,7 @@ var globe = Kapsule({
365
365
  if (state.animationFrameRequestId === null) {
366
366
  this._animationCycle();
367
367
  }
368
- (_state$globe2 = state.globe) === null || _state$globe2 === void 0 || _state$globe2.resumeAnimation();
368
+ (_state$globe2 = state.globe) === null || _state$globe2 === undefined || _state$globe2.resumeAnimation();
369
369
  return this;
370
370
  },
371
371
  _animationCycle: function _animationCycle(state) {
@@ -411,6 +411,7 @@ var globe = Kapsule({
411
411
  lng = _ref5.lng,
412
412
  altitude = _ref5.altitude;
413
413
  state.renderObjs.cameraPosition(state.globe.getCoords(lat, lng, altitude));
414
+ state.globe.setPointOfView(state.renderObjs.camera()); // report position to globe
414
415
  }
415
416
  },
416
417
  getScreenCoords: function getScreenCoords(state) {
@@ -471,7 +472,7 @@ var globe = Kapsule({
471
472
  stateInit: function stateInit(_ref6) {
472
473
  var rendererConfig = _ref6.rendererConfig,
473
474
  _ref6$waitForGlobeRea = _ref6.waitForGlobeReady,
474
- waitForGlobeReady = _ref6$waitForGlobeRea === void 0 ? true : _ref6$waitForGlobeRea,
475
+ waitForGlobeReady = _ref6$waitForGlobeRea === undefined ? true : _ref6$waitForGlobeRea,
475
476
  globeInitConfig = _objectWithoutProperties(_ref6, _excluded);
476
477
  var globe = new ThreeGlobe(_objectSpread2({
477
478
  waitForGlobeReady: waitForGlobeReady
@@ -513,7 +514,8 @@ var globe = Kapsule({
513
514
  // calibrate orbit controls
514
515
  var globeR = state.globe.getGlobeRadius();
515
516
  var controls = state.renderObjs.controls();
516
- controls.minDistance = globeR * 1.01; // just above the surface
517
+ state.renderObjs.camera().near = 0.05; // less will start causing depth z-fighting issues
518
+ controls.minDistance = globeR + Math.max(0.001, state.renderObjs.camera().near * 1.1); // just above the surface, as much as camera near plane permits
517
519
  controls.maxDistance = globeR * 100;
518
520
  controls.enablePan = false;
519
521
  controls.enableDamping = true;
@@ -523,8 +525,8 @@ var globe = Kapsule({
523
525
  controls.addEventListener('change', function () {
524
526
  // adjust controls speed based on altitude
525
527
  var pov = _this.pointOfView();
526
- controls.rotateSpeed = pov.altitude * 0.2; // Math.pow(pov.altitude + 1, 2) * 0.025;
527
- controls.zoomSpeed = (pov.altitude + 1) * 0.1; // Math.sqrt(pov.altitude) * 0.2;
528
+ controls.rotateSpeed = pov.altitude * 0.3;
529
+ controls.zoomSpeed = Math.sqrt(pov.altitude) * 0.4;
528
530
 
529
531
  // Update three-globe pov when camera moves, for proper hiding of elements
530
532
  state.globe.setPointOfView(state.renderObjs.camera());
@@ -0,0 +1,15 @@
1
+ <head>
2
+ <style> body { margin: 0; } </style>
3
+
4
+ <script src="//unpkg.com/globe.gl"></script>
5
+ <!-- <script src="../../dist/globe.gl.js"></script>-->
6
+ </head>
7
+
8
+ <body>
9
+ <div id="globeViz"></div>
10
+
11
+ <script type="module">
12
+ new Globe(document.getElementById('globeViz'))
13
+ .globeTileEngineUrl((x, y, l) => `https://tile.openstreetmap.org/${l}/${x}/${y}.png`);
14
+ </script>
15
+ </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "globe.gl",
3
- "version": "2.34.6",
3
+ "version": "2.35.1",
4
4
  "description": "UI component for Globe Data Visualization using ThreeJS/WebGL",
5
5
  "type": "module",
6
6
  "unpkg": "dist/globe.gl.min.js",
@@ -52,7 +52,7 @@
52
52
  "accessor-fn": "1",
53
53
  "kapsule": "^1.16",
54
54
  "three": ">=0.154 <1",
55
- "three-globe": "^2.39",
55
+ "three-globe": "^2.40",
56
56
  "three-render-objects": "^1.31"
57
57
  },
58
58
  "devDependencies": {
@@ -64,10 +64,10 @@
64
64
  "@rollup/plugin-terser": "^0.4.4",
65
65
  "postcss": "^8.4.49",
66
66
  "rimraf": "^6.0.1",
67
- "rollup": "^4.29.1",
67
+ "rollup": "^4.30.1",
68
68
  "rollup-plugin-dts": "^6.1.1",
69
69
  "rollup-plugin-postcss": "^4.0.2",
70
- "typescript": "^5.7.2"
70
+ "typescript": "^5.7.3"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=12"