globe.gl 2.31.0 → 2.32.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/README.md CHANGED
@@ -296,7 +296,7 @@ Globe({ configOptions })(<domElement>)
296
296
  | <b>hexPolygonMargin</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function, attribute or a numeric constant for the radial margin of each hexagon. Margins above `0` will create gaps between adjacent hexagons within a polygon. The margin is specified in terms of fraction of the hexagon's surface diameter. Values below `0` or above `1` are disadvised. | 0.2 |
297
297
  | <b>hexPolygonUseDots</b>([<i>boolean</i>, <i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function, attribute or a boolean constant for whether to represent each polygon point as a circular dot instead of an hexagon. | `false` |
298
298
  | <b>hexPolygonCurvatureResolution</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function, attribute or a numeric constant for the resolution (in angular degrees) of each hexed polygon surface curvature. The finer the resolution, the more the polygon hexes are fragmented into smaller faces to approximate the spheric surface, at the cost of performance. | 5 |
299
- | <b>hexPolygonDotResolution</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function, attribute or a numeric constant for the resolution of each circular dot, expressed in how many slice segments to divide the circumference. Higher values yield smoother cylinders, at the cost of performance. This is only applicable in dot representation mode. | 12 |
299
+ | <b>hexPolygonDotResolution</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function, attribute or a numeric constant for the resolution of each circular dot, expressed in how many slice segments to divide the circumference. Higher values yield smoother circles, at the cost of performance. This is only applicable in dot representation mode. | 12 |
300
300
  | <b>hexPolygonsTransitionDuration</b>([<i>num</i>]) | Getter/setter for duration (ms) of the transition to animate hexed polygons altitude and margin changes. A value of `0` will move the hexagons immediately to their final state. New hexed polygons are animated by sizing each hexagon from `0` radius. | 0 |
301
301
  | <b>onHexPolygonClick</b>(<i>fn</i>) | Callback function for hexed polygon (left-button) clicks. The polygon object, the event object and the clicked coordinates are included as arguments: `onHexPolygonClick(polygon, event, { lat, lng, altitude })`. | - |
302
302
  | <b>onHexPolygonRightClick</b>(<i>fn</i>) | Callback function for hexed polygon right-clicks. The polygon object, the event object and the clicked coordinates are included as arguments: `onHexPolygonRightClick(polygon, event, { lat, lng, altitude })`. | - |
@@ -432,6 +432,7 @@ Globe({ configOptions })(<domElement>)
432
432
  | <b>pointerEventsFilter</b>([<i>fn</i>]) | Getter/setter for the filter function which defines whether a particular object can be the target of pointer interactions. In general, objects that are closer to the camera get precedence in capturing pointer events. This function allows having ignored object layers so that pointer events can be passed through to deeper objects in the various globe layers. The ThreeJS object and its associated data (if any) are passed as arguments: `pointerEventsFilter(obj, data)`. The function should return a boolean value. | `() => true` |
433
433
  | <b>lineHoverPrecision</b>([<i>num</i>]) | Getter/setter for the precision to use when detecting hover events over [Line](https://threejs.org/docs/#api/objects/Line) objects, such as arcs and paths. | 0.2 |
434
434
  | <b>onZoom</b>(<i>fn</i>) | Callback function for point-of-view changes by zooming or rotating the globe using the orbit controls. The current point of view (with the syntax `{ lat, lng, altitude }`) is included as sole argument. | |
435
+ | <b>lights</b>([<i>array</i>]) | Getter/setter for the list of lights to use in the scene. Each item should be an instance of [Light](https://threejs.org/docs/#api/en/lights/Light). | [AmbientLight](https://threejs.org/docs/?q=ambient#api/en/lights/AmbientLight) + [DirectionalLight](https://threejs.org/docs/#api/en/lights/DirectionalLight) (from above) |
435
436
  | <b>scene</b>() | Access the internal ThreeJS [Scene](https://threejs.org/docs/#api/scenes/Scene). Can be used to extend the current scene with additional objects not related to globe.gl. | |
436
437
  | <b>camera</b>() | Access the internal ThreeJS [Camera](https://threejs.org/docs/#api/cameras/PerspectiveCamera). | |
437
438
  | <b>renderer</b>() | Access the internal ThreeJS [WebGL renderer](https://threejs.org/docs/#api/renderers/WebGLRenderer). ||
@@ -1,4 +1,4 @@
1
- import { WebGLRendererParameters, Scene, Camera, WebGLRenderer, Object3D } from 'three';
1
+ import { WebGLRendererParameters, Light, Scene, Camera, WebGLRenderer, Object3D } from 'three';
2
2
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
3
3
  import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
4
4
  import { ConfigOptions as ConfigOptions$1, ThreeGlobeGeneric } from 'three-globe';
@@ -112,6 +112,8 @@ interface GlobeGenericInstance<ChainableInstance>
112
112
  lineHoverPrecision(): number;
113
113
  lineHoverPrecision(precision: number): ChainableInstance;
114
114
  onZoom(callback: (pov: GeoCoords) => void): ChainableInstance;
115
+ lights(): Light[];
116
+ lights(lights: Light[]): ChainableInstance;
115
117
  scene(): Scene;
116
118
  camera(): Camera;
117
119
  renderer(): WebGLRenderer;
package/dist/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.31.0 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.32.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) :
@@ -73402,31 +73402,31 @@
73402
73402
  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}";
73403
73403
  styleInject(css_248z);
73404
73404
 
73405
- function _iterableToArrayLimit(arr, i) {
73406
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
73407
- if (null != _i) {
73408
- var _s,
73409
- _e,
73410
- _x,
73411
- _r,
73412
- _arr = [],
73413
- _n = !0,
73414
- _d = !1;
73405
+ function _iterableToArrayLimit(r, l) {
73406
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
73407
+ if (null != t) {
73408
+ var e,
73409
+ n,
73410
+ i,
73411
+ u,
73412
+ a = [],
73413
+ f = !0,
73414
+ o = !1;
73415
73415
  try {
73416
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
73417
- if (Object(_i) !== _i) return;
73418
- _n = !1;
73419
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
73420
- } catch (err) {
73421
- _d = !0, _e = err;
73416
+ if (i = (t = t.call(r)).next, 0 === l) {
73417
+ if (Object(t) !== t) return;
73418
+ f = !1;
73419
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
73420
+ } catch (r) {
73421
+ o = !0, n = r;
73422
73422
  } finally {
73423
73423
  try {
73424
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
73424
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
73425
73425
  } finally {
73426
- if (_d) throw _e;
73426
+ if (o) throw n;
73427
73427
  }
73428
73428
  }
73429
- return _arr;
73429
+ return a;
73430
73430
  }
73431
73431
  }
73432
73432
  function _defineProperty(obj, key, value) {
@@ -73542,6 +73542,9 @@
73542
73542
  objects: {
73543
73543
  "default": []
73544
73544
  },
73545
+ lights: {
73546
+ "default": []
73547
+ },
73545
73548
  enablePointerInteraction: {
73546
73549
  "default": true,
73547
73550
  onChange: function onChange(_, state) {
@@ -74002,6 +74005,15 @@
74002
74005
  }
74003
74006
  }
74004
74007
  changedProps.hasOwnProperty('showNavInfo') && (state.navInfo.style.display = state.showNavInfo ? null : 'none');
74008
+ if (changedProps.hasOwnProperty('lights')) {
74009
+ (changedProps.lights || []).forEach(function (light) {
74010
+ return state.scene.remove(light);
74011
+ }); // Clear the place
74012
+ state.lights.forEach(function (light) {
74013
+ return state.scene.add(light);
74014
+ }); // Add to scene
74015
+ }
74016
+
74005
74017
  if (changedProps.hasOwnProperty('objects')) {
74006
74018
  (changedProps.objects || []).forEach(function (obj) {
74007
74019
  return state.scene.remove(obj);
@@ -74074,7 +74086,7 @@
74074
74086
  var linkedRenderObjsProps = Object.assign.apply(Object, _toConsumableArray$5(['width', 'height', 'backgroundColor', 'backgroundImageUrl', 'enablePointerInteraction'].map(function (p) {
74075
74087
  return _defineProperty$3({}, p, bindRenderObjs.linkProp(p));
74076
74088
  })));
74077
- var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray$5(['postProcessingComposer'].map(function (p) {
74089
+ var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray$5(['lights', 'postProcessingComposer'].map(function (p) {
74078
74090
  return _defineProperty$3({}, p, bindRenderObjs.linkMethod(p));
74079
74091
  })));
74080
74092
 
@@ -74378,7 +74390,8 @@
74378
74390
  rendererConfig: rendererConfig,
74379
74391
  waitForLoadComplete: waitForGlobeReady,
74380
74392
  extraRenderers: [new THREE.CSS2DRenderer()] // Used in HTML elements layer
74381
- }).skyRadius(globe.getGlobeRadius() * 500).showNavInfo(false)
74393
+ }).skyRadius(globe.getGlobeRadius() * 500).showNavInfo(false).objects([globe]) // Populate scene
74394
+ .lights([new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI)])
74382
74395
  };
74383
74396
  },
74384
74397
  init: function init(domNode, state) {
@@ -74469,9 +74482,7 @@
74469
74482
  }
74470
74483
  };
74471
74484
  state.renderObjs.renderer().useLegacyLights = false; // force behavior of three < 155
74472
- state.renderObjs.objects([
74473
- // Populate scene
74474
- new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI), state.globe]).hoverOrderComparator(function (a, b) {
74485
+ state.renderObjs.hoverOrderComparator(function (a, b) {
74475
74486
  var aObj = getGlobeObj(a);
74476
74487
  var bObj = getGlobeObj(b);
74477
74488