react-globe.gl 2.29.5 → 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 +24 -5
- package/dist/react-globe.gl.d.ts +28 -11
- package/dist/react-globe.gl.js +851 -445
- package/dist/react-globe.gl.js.map +1 -1
- package/dist/react-globe.gl.min.js +4 -4
- package/dist/react-globe.gl.mjs +13 -0
- package/package.json +4 -4
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
|
|
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
|
| --- | :--: | --- |
|
package/dist/react-globe.gl.d.ts
CHANGED
|
@@ -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';
|
|
@@ -8,6 +8,8 @@ type Accessor<In, Out> = Out | string | ((obj: In) => Out);
|
|
|
8
8
|
type ObjAccessor<T> = Accessor<object, T>;
|
|
9
9
|
type HexBinAccessor<T> = Accessor<HexBin, T>;
|
|
10
10
|
|
|
11
|
+
type TooltipContent = string | React.ReactHTMLElement<HTMLElement>;
|
|
12
|
+
|
|
11
13
|
interface HexBin {
|
|
12
14
|
points: object[],
|
|
13
15
|
sumWeight: number,
|
|
@@ -71,7 +73,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
71
73
|
pointResolution?: number;
|
|
72
74
|
pointsMerge?: boolean;
|
|
73
75
|
pointsTransitionDuration?: number;
|
|
74
|
-
pointLabel?: ObjAccessor<
|
|
76
|
+
pointLabel?: ObjAccessor<TooltipContent>;
|
|
75
77
|
onPointClick?: (point: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
76
78
|
onPointRightClick?: (point: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
77
79
|
onPointHover?: (point: object | null, prevPoint: object | null) => void;
|
|
@@ -93,7 +95,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
93
95
|
arcDashInitialGap?: ObjAccessor<number>;
|
|
94
96
|
arcDashAnimateTime?: ObjAccessor<number>;
|
|
95
97
|
arcsTransitionDuration?: number;
|
|
96
|
-
arcLabel?: ObjAccessor<
|
|
98
|
+
arcLabel?: ObjAccessor<TooltipContent>;
|
|
97
99
|
onArcClick?: (arc: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
98
100
|
onArcRightClick?: (arc: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
99
101
|
onArcHover?: (arc: object | null, prevArc: object | null) => void;
|
|
@@ -109,7 +111,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
109
111
|
polygonAltitude?: ObjAccessor<number>;
|
|
110
112
|
polygonCapCurvatureResolution?: ObjAccessor<number>;
|
|
111
113
|
polygonsTransitionDuration?: number;
|
|
112
|
-
polygonLabel?: ObjAccessor<
|
|
114
|
+
polygonLabel?: ObjAccessor<TooltipContent>;
|
|
113
115
|
onPolygonClick?: (polygon: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
114
116
|
onPolygonRightClick?: (polygon: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
115
117
|
onPolygonHover?: (polygon: object | null, prevPolygon: object | null) => void;
|
|
@@ -128,7 +130,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
128
130
|
pathDashInitialGap?: ObjAccessor<number>;
|
|
129
131
|
pathDashAnimateTime?: ObjAccessor<number>;
|
|
130
132
|
pathTransitionDuration?: number;
|
|
131
|
-
pathLabel?: ObjAccessor<
|
|
133
|
+
pathLabel?: ObjAccessor<TooltipContent>;
|
|
132
134
|
onPathClick?: (path: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
133
135
|
onPathRightClick?: (path: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
134
136
|
onPathHover?: (path: object | null, prevPath: object | null) => void;
|
|
@@ -162,7 +164,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
162
164
|
hexSideColor?: HexBinAccessor<string>;
|
|
163
165
|
hexBinMerge?: boolean;
|
|
164
166
|
hexTransitionDuration?: number;
|
|
165
|
-
hexLabel?: HexBinAccessor<
|
|
167
|
+
hexLabel?: HexBinAccessor<TooltipContent>;
|
|
166
168
|
onHexClick?: (hex: HexBin, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
167
169
|
onHexRightClick?: (hex: HexBin, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
168
170
|
onHexHover?: (hex: HexBin | null, prevHex: HexBin | null) => void;
|
|
@@ -178,7 +180,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
178
180
|
hexPolygonCurvatureResolution?: ObjAccessor<number>;
|
|
179
181
|
hexPolygonDotResolution?: ObjAccessor<number>;
|
|
180
182
|
hexPolygonsTransitionDuration?: number;
|
|
181
|
-
hexPolygonLabel?: ObjAccessor<
|
|
183
|
+
hexPolygonLabel?: ObjAccessor<TooltipContent>;
|
|
182
184
|
onHexPolygonClick?: (polygon: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
183
185
|
onHexPolygonRightClick?: (polygon: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
184
186
|
onHexPolygonHover?: (polygon: object | null, prevPolygon: object | null) => void;
|
|
@@ -194,11 +196,26 @@ interface GlobeProps extends ConfigOptions {
|
|
|
194
196
|
tileMaterial?: ObjAccessor<Material>;
|
|
195
197
|
tileCurvatureResolution?: ObjAccessor<number>;
|
|
196
198
|
tilesTransitionDuration?: number;
|
|
197
|
-
tileLabel?: ObjAccessor<
|
|
199
|
+
tileLabel?: ObjAccessor<TooltipContent>;
|
|
198
200
|
onTileClick?: (tile: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
199
201
|
onTileRightClick?: (tile: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
200
202
|
onTileHover?: (tile: object | null, prevTile: object | null) => void;
|
|
201
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
|
+
|
|
202
219
|
// Rings Layer
|
|
203
220
|
ringsData?: object[];
|
|
204
221
|
ringLat?: ObjAccessor<number>;
|
|
@@ -225,7 +242,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
225
242
|
labelDotRadius?: ObjAccessor<number>;
|
|
226
243
|
labelDotOrientation?: ObjAccessor<LabelOrientation>;
|
|
227
244
|
labelsTransitionDuration?: number;
|
|
228
|
-
labelLabel?: ObjAccessor<
|
|
245
|
+
labelLabel?: ObjAccessor<TooltipContent>;
|
|
229
246
|
onLabelClick?: (label: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
230
247
|
onLabelRightClick?: (label: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
231
248
|
onLabelHover?: (label: object | null, prevLabel: object | null) => void;
|
|
@@ -246,7 +263,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
246
263
|
objectRotation?: ObjAccessor<{ x?: number, y?: number, z?: number } | null>;
|
|
247
264
|
objectFacesSurfaces?: ObjAccessor<boolean>;
|
|
248
265
|
objectThreeObject?: Object3D | string | ((d: object) => Object3D);
|
|
249
|
-
objectLabel?: ObjAccessor<
|
|
266
|
+
objectLabel?: ObjAccessor<TooltipContent>;
|
|
250
267
|
onObjectClick?: (obj: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
251
268
|
onObjectRightClick?: (obj: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
252
269
|
onObjectHover?: (obj: object | null, prevObj: object | null) => void;
|
|
@@ -255,7 +272,7 @@ interface GlobeProps extends ConfigOptions {
|
|
|
255
272
|
customLayerData?: object[];
|
|
256
273
|
customThreeObject?: Object3D | string | ((d: object) => Object3D);
|
|
257
274
|
customThreeObjectUpdate?: string | ((obj: Object3D, objData: object) => void);
|
|
258
|
-
customLayerLabel?: ObjAccessor<
|
|
275
|
+
customLayerLabel?: ObjAccessor<TooltipContent>;
|
|
259
276
|
onCustomLayerClick?: (obj: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
260
277
|
onCustomLayerRightClick?: (obj: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
|
261
278
|
onCustomLayerHover?: (obj: object | null, prevObj: object | null) => void;
|