react-globe.gl 2.21.2 → 2.22.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
@@ -20,7 +20,7 @@ React bindings for the [globe.gl](https://github.com/vasturiano/globe.gl) UI com
20
20
 
21
21
  A React component to represent data visualization layers on a 3-dimensional globe in a spherical projection, using [ThreeJS](https://github.com/mrdoob/three.js/)/WebGL for 3D rendering.
22
22
 
23
- Check out the examples:
23
+ #### Check out the examples:
24
24
  * [Basic](https://vasturiano.github.io/react-globe.gl/example/basic/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/basic/index.html))
25
25
  * [Arc Links](https://vasturiano.github.io/react-globe.gl/example/random-arcs/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/random-arcs/index.html))
26
26
  * [Highlight links](https://vasturiano.github.io/react-globe.gl/example/airline-routes/highlight-links.html) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/airline-routes/highlight-links.html))
@@ -29,6 +29,7 @@ Check out the examples:
29
29
  * [Hollow Globe](https://vasturiano.github.io/react-globe.gl/example/hollow-globe/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/hollow-globe/index.html))
30
30
  * [Path Lines](https://vasturiano.github.io/react-globe.gl/example/random-paths/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/random-paths/index.html))
31
31
  * [Map Labels](https://vasturiano.github.io/react-globe.gl/example/world-cities/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/world-cities/index.html))
32
+ * [HTML Markers](https://vasturiano.github.io/react-globe.gl/example/html-markers/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/html-markers/index.html))
32
33
  * [Hexed Country Polygons](https://vasturiano.github.io/react-globe.gl/example/hexed-polygons/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/hexed-polygons/index.html))
33
34
  * [Tiles](https://vasturiano.github.io/react-globe.gl/example/tiles/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/tiles/index.html))
34
35
  * [Ripple Rings](https://vasturiano.github.io/react-globe.gl/example/random-rings/) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/random-rings/index.html))
@@ -46,7 +47,6 @@ Check out the examples:
46
47
  * [Submarine Cables](https://vasturiano.github.io/react-globe.gl/example/submarine-cables/index.html) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/submarine-cables/index.html))
47
48
  * [Moon Landing Sites](https://vasturiano.github.io/react-globe.gl/example/moon-landing-sites/index.html) ([source](https://github.com/vasturiano/react-globe.gl/blob/master/example/moon-landing-sites/index.html))
48
49
 
49
-
50
50
  ## Quick start
51
51
 
52
52
  ```js
@@ -72,7 +72,24 @@ ReactDOM.render(
72
72
 
73
73
  ## API reference
74
74
 
75
- ### Container layout
75
+ * [Container Layout](#container-layout)
76
+ * [Globe Layer](#globe-layer)
77
+ * [Points Layer](#points-layer)
78
+ * [Arcs Layer](#arcs-layer)
79
+ * [Polygons Layer](#polygons-layer)
80
+ * [Paths Layer](#paths-layer)
81
+ * [Hex Bin Layer](#hex-bin-layer)
82
+ * [Hexed Polygons Layer](#hexed-polygons-layer)
83
+ * [Tiles Layer](#tiles-layer)
84
+ * [Rings Layer](#rings-layer)
85
+ * [Labels Layer](#labels-layer)
86
+ * [HTML Elements Layer](#html-elements-layer)
87
+ * [3D Objects Layer](#3d-objects-layer)
88
+ * [Custom Layer](#custom-layer)
89
+ * [Render Control](#render-control)
90
+ * [Utility](#utility)
91
+
92
+ ### Container Layout
76
93
 
77
94
  | Prop | Type | Default | Description |
78
95
  | --- | :--: | :--: | --- |
@@ -313,7 +330,22 @@ ReactDOM.render(
313
330
  | <b>onLabelRightClick</b> | <i>func</i>| *-* | Callback function for label right-clicks. The label object, the event object and the clicked coordinates are included as arguments: `onLabelRightClick(label, event, { lat, lng, altitude })`. |
314
331
  | <b>onLabelHover</b> | <i>func</i>| *-* | Callback function for label mouse over events. The label object (or `null` if there's no label under the mouse line of sight) is included as the first argument, and the previous label object (or `null`) as second argument: `onLabelHover(label, prevlabel)`. |
315
332
 
316
- ### Objects Layer
333
+ ### HTML Elements Layer
334
+
335
+ <p align="center">
336
+ <a href="//vasturiano.github.io/react-globe.gl/example/html-markers/"><img width="70%" src="https://vasturiano.github.io/react-globe.gl/example/html-markers/preview.png"></a>
337
+ </p>
338
+
339
+ | Prop | Type | Default | Description |
340
+ | --- | :--: | :--: | --- |
341
+ | <b>htmlElementsData</b> | <i>array</i> | `[]` | List objects to represent in the HTML elements map layer. Each HTML element is rendered using [ThreeJS CSS2DRenderer](https://threejs.org/docs/#examples/en/renderers/CSS2DRenderer). |
342
+ | <b>htmlLat</b> | <i>number</i>, <i>string</i> or <i>func</i> | `lat` | HTML element accessor function, attribute or a numeric constant for the latitude coordinate of the element's central position. |
343
+ | <b>htmlLng</b> | <i>number</i>, <i>string</i> or <i>func</i> | `lng` | HTML element accessor function, attribute or a numeric constant for the longitude coordinate of the element's central position. |
344
+ | <b>htmlAltitude</b> | <i>number</i>, <i>string</i> or <i>func</i> | 0 | HTML element accessor function, attribute or a numeric constant for the altitude coordinate of the element's position, in terms of globe radius units. |
345
+ | <b>htmlElement</b> | <i>string</i> or <i>func</i> | `null` | Accessor function or attribute to retrieve the DOM element to use. Should return an instance of [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). |
346
+ | <b>htmlTransitionDuration</b> | <i>number</i> | 1000 | Duration (ms) of the transition to animate HTML elements position changes. A value of `0` will move the elements immediately to their final position. |
347
+
348
+ ### 3D Objects Layer
317
349
 
318
350
  <p align="center">
319
351
  <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>
@@ -347,7 +379,7 @@ ReactDOM.render(
347
379
  | <b>onCustomLayerRightClick</b> | <i>func</i>| *-* | Callback function for custom object right-clicks. The custom object, the event object and the clicked coordinates are included as arguments: `onCustomLayerRightClick(obj, event, { lat, lng, altitude })`. |
348
380
  | <b>onCustomLayerHover</b> | <i>func</i>| *-* | Callback function for custom object mouse over events. The custom object (or `null` if there's no object under the mouse line of sight) is included as the first argument, and the previous custom object (or `null`) as second argument: `onCustomLayerHover(obj, prevObj)`. |
349
381
 
350
- ### Render control
382
+ ### Render Control
351
383
 
352
384
  | Prop | Type | Default | Description |
353
385
  | --- | :--: | :--: | --- |
@@ -159,6 +159,12 @@ var GlobePropTypes = {
159
159
  onLabelClick: PropTypes__default["default"].func,
160
160
  onLabelRightClick: PropTypes__default["default"].func,
161
161
  onLabelHover: PropTypes__default["default"].func,
162
+ htmlElementsData: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
163
+ htmlLat: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string, PropTypes__default["default"].func]),
164
+ htmlLng: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string, PropTypes__default["default"].func]),
165
+ htmlAltitude: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string, PropTypes__default["default"].func]),
166
+ htmlElement: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
167
+ htmlTransitionDuration: PropTypes__default["default"].number,
162
168
  objectsData: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
163
169
  objectLat: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string, PropTypes__default["default"].func]),
164
170
  objectLng: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string, PropTypes__default["default"].func]),
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { Material, Object3D, Scene, Camera, WebGLRenderer } from 'three';
3
2
  import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
4
3
  import { ConfigOptions, GlobeInstance } from 'globe.gl';
@@ -210,7 +209,15 @@ interface GlobeProps extends ConfigOptions {
210
209
  onLabelRightClick?: (label: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
211
210
  onLabelHover?: (label: object | null, prevLabel: object | null) => void;
212
211
 
213
- // Objects layer
212
+ // HTML Elements layer
213
+ htmlElementsData?: object[];
214
+ htmlLat?: ObjAccessor<number>;
215
+ htmlLng?: ObjAccessor<number>;
216
+ htmlAltitude?: ObjAccessor<number>;
217
+ htmlElement?: string | ((d: object) => HTMLElement);
218
+ htmlTransitionDuration?: number;
219
+
220
+ // 3D Objects layer
214
221
  objectsData?: object[];
215
222
  objectLat?: ObjAccessor<number>;
216
223
  objectLng?: ObjAccessor<number>;