react-globe.gl 2.26.0 → 2.27.0

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
@@ -426,7 +426,8 @@ ReactDOM.render(
426
426
  | <b>pointOfView</b> | { <i>lat</i>, <i>lng</i>, <i>altitude</i> } [,<i>ms</i>=`0`] | By default the camera will aim at the cross between the equator and the prime meridian (`0,0` coordinates), at an altitude of `2.5` globe radii. | Camera position, in terms of geographical `lat`, `lng`, `altitude` coordinates. Each of the coordinates is optional, allowing for motion in just some direction. The 2nd optional argument defines the duration of the transition (in ms) to animate the camera motion. A value of 0 (default) moves the camera immediately to the final position. |
427
427
  | <b>pauseAnimation</b>| *-* |Pauses the rendering cycle of the component, effectively freezing the current view and cancelling all user interaction. This method can be used to save performance in circumstances when a static image is sufficient. |
428
428
  | <b>resumeAnimation</b>| *-* |Resumes the rendering cycle of the component, and re-enables the user interaction. This method can be used together with `pauseAnimation` for performance optimization purposes. |
429
- | <b>onZoom</b> | <i>func</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. |
429
+ | <b>onZoom</b> | <i>func</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. |
430
+ | <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). |
430
431
  | <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. |
431
432
  | <b>camera</b>| *-* |Access the internal ThreeJS [Camera](https://threejs.org/docs/#api/cameras/PerspectiveCamera). |
432
433
  | <b>renderer</b>| *-* |Access the internal ThreeJS [WebGL renderer](https://threejs.org/docs/#api/renderers/WebGLRenderer). |
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Material, Object3D, Scene, Camera, WebGLRenderer } from 'three';
2
+ import { Material, Object3D, Light, Scene, Camera, WebGLRenderer } from 'three';
3
3
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
4
4
  import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
5
5
  import { ConfigOptions, GlobeInstance } from 'globe.gl';
@@ -272,6 +272,8 @@ interface GlobeMethods {
272
272
  pointOfView(pov: { lat?: number, lng?: number, altitude?: number }, transitionMs?: number): GlobeInstance;
273
273
  pauseAnimation(): GlobeInstance;
274
274
  resumeAnimation(): GlobeInstance;
275
+ lights(): Light[];
276
+ lights(lights: Light[]): ChainableInstance;
275
277
  scene(): Scene;
276
278
  camera(): Camera;
277
279
  renderer(): WebGLRenderer;
@@ -1,4 +1,4 @@
1
- // Version 2.26.0 react-globe.gl - https://github.com/vasturiano/react-globe.gl
1
+ // Version 2.27.0 react-globe.gl - https://github.com/vasturiano/react-globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['react'], factory) :
@@ -73566,31 +73566,31 @@
73566
73566
  var css_248z$1 = ".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}";
73567
73567
  styleInject$1(css_248z$1);
73568
73568
 
73569
- function _iterableToArrayLimit(arr, i) {
73570
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
73571
- if (null != _i) {
73572
- var _s,
73573
- _e,
73574
- _x,
73575
- _r,
73576
- _arr = [],
73577
- _n = !0,
73578
- _d = !1;
73569
+ function _iterableToArrayLimit(r, l) {
73570
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
73571
+ if (null != t) {
73572
+ var e,
73573
+ n,
73574
+ i,
73575
+ u,
73576
+ a = [],
73577
+ f = !0,
73578
+ o = !1;
73579
73579
  try {
73580
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
73581
- if (Object(_i) !== _i) return;
73582
- _n = !1;
73583
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
73584
- } catch (err) {
73585
- _d = !0, _e = err;
73580
+ if (i = (t = t.call(r)).next, 0 === l) {
73581
+ if (Object(t) !== t) return;
73582
+ f = !1;
73583
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
73584
+ } catch (r) {
73585
+ o = !0, n = r;
73586
73586
  } finally {
73587
73587
  try {
73588
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
73588
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
73589
73589
  } finally {
73590
- if (_d) throw _e;
73590
+ if (o) throw n;
73591
73591
  }
73592
73592
  }
73593
- return _arr;
73593
+ return a;
73594
73594
  }
73595
73595
  }
73596
73596
  function _defineProperty$1(obj, key, value) {
@@ -73706,6 +73706,9 @@
73706
73706
  objects: {
73707
73707
  "default": []
73708
73708
  },
73709
+ lights: {
73710
+ "default": []
73711
+ },
73709
73712
  enablePointerInteraction: {
73710
73713
  "default": true,
73711
73714
  onChange: function onChange(_, state) {
@@ -74166,6 +74169,15 @@
74166
74169
  }
74167
74170
  }
74168
74171
  changedProps.hasOwnProperty('showNavInfo') && (state.navInfo.style.display = state.showNavInfo ? null : 'none');
74172
+ if (changedProps.hasOwnProperty('lights')) {
74173
+ (changedProps.lights || []).forEach(function (light) {
74174
+ return state.scene.remove(light);
74175
+ }); // Clear the place
74176
+ state.lights.forEach(function (light) {
74177
+ return state.scene.add(light);
74178
+ }); // Add to scene
74179
+ }
74180
+
74169
74181
  if (changedProps.hasOwnProperty('objects')) {
74170
74182
  (changedProps.objects || []).forEach(function (obj) {
74171
74183
  return state.scene.remove(obj);
@@ -74368,7 +74380,7 @@
74368
74380
  var linkedRenderObjsProps = Object.assign.apply(Object, _toConsumableArray(['width', 'height', 'backgroundColor', 'backgroundImageUrl', 'enablePointerInteraction'].map(function (p) {
74369
74381
  return _defineProperty({}, p, bindRenderObjs.linkProp(p));
74370
74382
  })));
74371
- var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray(['postProcessingComposer'].map(function (p) {
74383
+ var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray(['lights', 'postProcessingComposer'].map(function (p) {
74372
74384
  return _defineProperty({}, p, bindRenderObjs.linkMethod(p));
74373
74385
  })));
74374
74386
 
@@ -74672,7 +74684,8 @@
74672
74684
  rendererConfig: rendererConfig,
74673
74685
  waitForLoadComplete: waitForGlobeReady,
74674
74686
  extraRenderers: [new THREE.CSS2DRenderer()] // Used in HTML elements layer
74675
- }).skyRadius(globe.getGlobeRadius() * 500).showNavInfo(false)
74687
+ }).skyRadius(globe.getGlobeRadius() * 500).showNavInfo(false).objects([globe]) // Populate scene
74688
+ .lights([new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI)])
74676
74689
  };
74677
74690
  },
74678
74691
  init: function init(domNode, state) {
@@ -74763,9 +74776,7 @@
74763
74776
  }
74764
74777
  };
74765
74778
  state.renderObjs.renderer().useLegacyLights = false; // force behavior of three < 155
74766
- state.renderObjs.objects([
74767
- // Populate scene
74768
- new THREE.AmbientLight(0xcccccc, Math.PI), new THREE.DirectionalLight(0xffffff, 0.6 * Math.PI), state.globe]).hoverOrderComparator(function (a, b) {
74779
+ state.renderObjs.hoverOrderComparator(function (a, b) {
74769
74780
  var aObj = getGlobeObj(a);
74770
74781
  var bObj = getGlobeObj(b);
74771
74782
 
@@ -76151,7 +76162,7 @@
76151
76162
  var Globe = index$3(globe, {
76152
76163
  methodNames: [
76153
76164
  // bind methods
76154
- 'pauseAnimation', 'resumeAnimation', 'pointOfView', 'scene', 'camera', 'renderer', 'postProcessingComposer', 'controls', 'getGlobeRadius', 'getCoords', 'getScreenCoords', 'toGeoCoords', 'toGlobeCoords'],
76165
+ 'pauseAnimation', 'resumeAnimation', 'pointOfView', 'lights', 'scene', 'camera', 'renderer', 'postProcessingComposer', 'controls', 'getGlobeRadius', 'getCoords', 'getScreenCoords', 'toGeoCoords', 'toGlobeCoords'],
76155
76166
  initPropNames: ['animateIn', 'waitForGlobeReady', 'rendererConfig']
76156
76167
  });
76157
76168
  Globe.displayName = 'Globe';