react-globe.gl 2.21.1 → 2.22.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
@@ -14,11 +14,13 @@ React bindings for the [globe.gl](https://github.com/vasturiano/globe.gl) UI com
14
14
  <a href="//vasturiano.github.io/react-globe.gl/example/submarine-cables/"><img width="48%" src="https://vasturiano.github.io/react-globe.gl/example/submarine-cables/preview.png"></a>
15
15
  <a href="//vasturiano.github.io/react-globe.gl/example/hexed-polygons/"><img width="48%" src="https://vasturiano.github.io/react-globe.gl/example/hexed-polygons/preview.png"></a>
16
16
  <a href="//vasturiano.github.io/react-globe.gl/example/world-cities/"><img width="48%" src="https://vasturiano.github.io/react-globe.gl/example/world-cities/preview.png"></a>
17
+ <a href="//vasturiano.github.io/react-globe.gl/example/satellites/"><img width="48%" src="https://vasturiano.github.io/react-globe.gl/example/satellites/preview.png"></a>
18
+ <a href="//vasturiano.github.io/react-globe.gl/example/moon-landing-sites/"><img width="48%" src="https://vasturiano.github.io/react-globe.gl/example/moon-landing-sites/preview.png"></a>
17
19
  </p>
18
20
 
19
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.
20
22
 
21
- Check out the examples:
23
+ #### Check out the examples:
22
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))
23
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))
24
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))
@@ -27,6 +29,7 @@ Check out the examples:
27
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))
28
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))
29
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))
30
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))
31
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))
32
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))
@@ -44,7 +47,6 @@ Check out the examples:
44
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))
45
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))
46
49
 
47
-
48
50
  ## Quick start
49
51
 
50
52
  ```js
@@ -70,7 +72,24 @@ ReactDOM.render(
70
72
 
71
73
  ## API reference
72
74
 
73
- ### 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
74
93
 
75
94
  | Prop | Type | Default | Description |
76
95
  | --- | :--: | :--: | --- |
@@ -311,7 +330,22 @@ ReactDOM.render(
311
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 })`. |
312
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)`. |
313
332
 
314
- ### 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
315
349
 
316
350
  <p align="center">
317
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>
@@ -345,7 +379,7 @@ ReactDOM.render(
345
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 })`. |
346
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)`. |
347
381
 
348
- ### Render control
382
+ ### Render Control
349
383
 
350
384
  | Prop | Type | Default | Description |
351
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]),
@@ -210,7 +210,15 @@ interface GlobeProps extends ConfigOptions {
210
210
  onLabelRightClick?: (label: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
211
211
  onLabelHover?: (label: object | null, prevLabel: object | null) => void;
212
212
 
213
- // Objects layer
213
+ // HTML Elements layer
214
+ htmlElementsData?: object[];
215
+ htmlLat?: ObjAccessor<number>;
216
+ htmlLng?: ObjAccessor<number>;
217
+ htmlAltitude?: ObjAccessor<number>;
218
+ htmlElement?: string | ((d: object) => HTMLElement);
219
+ htmlTransitionDuration?: number;
220
+
221
+ // 3D Objects layer
214
222
  objectsData?: object[];
215
223
  objectLat?: ObjAccessor<number>;
216
224
  objectLng?: ObjAccessor<number>;