react-globe.gl 2.30.0 → 2.31.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
@@ -90,6 +90,7 @@ ReactDOM.render(
90
90
  * [Hex Bin Layer](#hex-bin-layer)
91
91
  * [Hexed Polygons Layer](#hexed-polygons-layer)
92
92
  * [Tiles Layer](#tiles-layer)
93
+ * [Particles Layer](#particles-layer)
93
94
  * [Rings Layer](#rings-layer)
94
95
  * [Labels Layer](#labels-layer)
95
96
  * [HTML Elements Layer](#html-elements-layer)
@@ -320,6 +321,28 @@ ReactDOM.render(
320
321
  | <b>onTileRightClick</b> | <i>func</i> | *-* | Callback function for tile right-clicks. The tile object, the event object and the clicked coordinates are included as arguments: `onTileRightClick(tile, event, { lat, lng, altitude })`. |
321
322
  | <b>onTileHover</b> | <i>func</i> | *-* | Callback function for tile mouse over events. The tile object (or `null` if there's no tile under the mouse line of sight) is included as the first argument, and the previous tile object (or `null`) as second argument: `onTileHover(tile, prevTile)`. |
322
323
 
324
+ ### Particles Layer
325
+
326
+ <p align="center">
327
+ <a href="//vasturiano.github.io/react-globe.gl/example/satellites/"><img width="70%" src="https://vasturiano.github.io/react-globe.gl/example/satellites/preview.png"></a>
328
+ </p>
329
+
330
+ | Prop | Type | Default | Description |
331
+ | --- | :--: | :--: | --- |
332
+ | <b>particlesData</b> | <i>array</i> | `[]` | List of particle sets to represent in the particles map layer. Each particle set is displayed as a group of [Points](https://threejs.org/docs/#api/en/objects/Points). Each point in the group is a geometry vertex and can be individually positioned anywhere relative to the globe. |
333
+ | <b>particlesList</b> | <i>string</i> or <i>func</i> | `d => d` | Particle set accessor function or attribute for the list of particles in the set. By default, the data structure is expected to be an array of arrays of individual particle objects. |
334
+ | <b>particleLabel</b> | <i>string</i> or <i>func</i> | `name` | Particle object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML content. |
335
+ | <b>particleLat</b> | <i>number</i>, <i>string</i> or <i>func</i> | `lat` | Particle object accessor function, attribute or a numeric constant for the latitude coordinate. |
336
+ | <b>particleLng</b> | <i>number</i>, <i>string</i> or <i>func</i> | `lng` | Particle object accessor function, attribute or a numeric constant for the longitude coordinate. |
337
+ | <b>particleAltitude</b> | <i>number</i>, <i>string</i> or <i>func</i> | 0.01 | Particle object accessor function, attribute or a numeric constant for the altitude in terms of globe radius units. |
338
+ | <b>particlesSize</b> | <i>number</i>, <i>string</i> or <i>func</i> | 0.5 | Particle set accessor function, attribute or a numeric constant for the size of all the particles in the group. |
339
+ | <b>particlesSizeAttenuation</b> | <i>bool</i>, <i>string</i> or <i>func</i> | `true` | Particle set accessor function, attribute or a boolean constant for whether the size of each particle on the screen should be attenuated according to the distance to the camera. |
340
+ | <b>particlesColor</b> | <i>string</i> or <i>func</i> | `white` | Particle set accessor function or attribute for the color of all the particles in the group. This setting will be ignored if `particlesTexture` is defined. |
341
+ | <b>particlesTexture</b> | <i>string</i> or <i>func</i> | - | Particle set accessor function or attribute for the [Texture](https://threejs.org/docs/#api/en/textures/Texture) to be applied to all the particles in the group. |
342
+ | <b>onParticleClick</b> | <i>func</i> | - | Callback function for particle (left-button) clicks. The particle object, the event object and the clicked coordinates are included as arguments: `onParticleClick(particle, event, { lat, lng, altitude })`. |
343
+ | <b>onParticleRightClick</b> | <i>func</i> | - | Callback function for particle right-clicks. The particle object, the event object and the clicked coordinates are included as arguments: `onParticleRightClick(particle, event, { lat, lng, altitude })`. |
344
+ | <b>onParticleHover</b> | <i>func</i> | - | Callback function for particle mouse over events. The particle object (or `null` if there's no particle under the mouse line of sight) is included as the first argument, and the previous particle object (or `null`) as second argument: `onParticleHover(particle, prevParticle)`. |
345
+
323
346
  ### Rings Layer
324
347
 
325
348
  <p align="center">
@@ -382,10 +405,6 @@ ReactDOM.render(
382
405
 
383
406
  ### 3D Objects Layer
384
407
 
385
- <p align="center">
386
- <a href="//vasturiano.github.io/react-globe.gl/example/satellites/"><img width="70%" src="https://vasturiano.github.io/react-globe.gl/example/satellites/preview.png"></a>
387
- </p>
388
-
389
408
  | Prop | Type | Default | Description |
390
409
  | --- | :--: | :--: | --- |
391
410
  | <b>objectsData</b> | <i>array</i> | `[]` | Getter/setter for the list of custom 3D objects to represent in the objects layer. Each object is rendered according to the `objectThreeObject` method. |
@@ -423,7 +442,7 @@ ReactDOM.render(
423
442
  | <b>rendererConfig</b> | <i>object</i> | `{ antialias: true, alpha: true }` | Configuration parameters to pass to the [ThreeJS WebGLRenderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) constructor. This prop only has an effect on component mount. |
424
443
  | <b>enablePointerInteraction</b> | <i>bool</i> | `true` | Whether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click and tooltip labels, at the cost of performance. If you're looking for maximum gain in your globe performance it's recommended to switch off this property. |
425
444
  | <b>pointerEventsFilter</b> | <i>func</i> | `() => true` | 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. |
426
- | <b>lineHoverPrecision</b> | <i>number</i> | 0.2 | Precision to use when detecting hover events over [Line](https://threejs.org/docs/#api/objects/Line) objects, such as arcs and paths. |
445
+ | <b>lineHoverPrecision</b> | <i>number</i> | 0.2 | Precision to use when detecting hover events over [Line](https://threejs.org/docs/#api/objects/Line) and [Points](https://threejs.org/docs/#api/objects/Points) objects, such as arcs, paths or particles. |
427
446
 
428
447
  | Method | Arguments | Description |
429
448
  | --- | :--: | --- |
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Material, Object3D, Light, Scene, Camera, WebGLRenderer } from 'three';
2
+ import { Material, Texture, 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';
@@ -201,6 +201,21 @@ interface GlobeProps extends ConfigOptions {
201
201
  onTileRightClick?: (tile: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
202
202
  onTileHover?: (tile: object | null, prevTile: object | null) => void;
203
203
 
204
+ // Particles layer
205
+ particlesData?: object[];
206
+ particlesList?: ObjAccessor<object[]>;
207
+ particleLat?: ObjAccessor<number>;
208
+ particleLng?: ObjAccessor<number>;
209
+ particleAltitude?: ObjAccessor<number>;
210
+ particlesSize?: ObjAccessor<number>;
211
+ particlesSizeAttenuation?: ObjAccessor<boolean>;
212
+ particlesColor?: ObjAccessor<string>;
213
+ particlesTexture?: ObjAccessor<Texture>;
214
+ particleLabel?: ObjAccessor<TooltipContent>;
215
+ onParticleClick?: (particle: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
216
+ onParticleRightClick?: (particle: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
217
+ onParticleHover?: (particle: object | null, prevParticle: object | null) => void;
218
+
204
219
  // Rings Layer
205
220
  ringsData?: object[];
206
221
  ringLat?: ObjAccessor<number>;