globe.gl 2.36.3 → 2.37.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 +10 -10
- package/dist/globe.gl.d.ts +20 -18
- package/dist/globe.gl.js +13 -3
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -141,7 +141,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
141
141
|
| Method | Description | Default |
|
|
142
142
|
| --- | --- | :--: |
|
|
143
143
|
| <b>pointsData</b>([<i>array</i>]) | Getter/setter for the list of points to represent in the points map layer. Each point is displayed as a cylindrical 3D object rising perpendicularly from the surface of the globe. | `[]` |
|
|
144
|
-
| <b>pointLabel</b>([<i>str</i> or <i>fn</i>]) | Point object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
144
|
+
| <b>pointLabel</b>([<i>str</i> or <i>fn</i>]) | Point object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
145
145
|
| <b>pointLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's center latitude coordinate. | `lat` |
|
|
146
146
|
| <b>pointLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the cylinder's center longitude coordinate. | `lng` |
|
|
147
147
|
| <b>pointColor</b>([<i>str</i> or <i>fn</i>]) | Point object accessor function or attribute for the cylinder color. | `() => '#ffffaa'` |
|
|
@@ -163,7 +163,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
163
163
|
| Method | Description | Default |
|
|
164
164
|
| --- | --- | :--: |
|
|
165
165
|
| <b>arcsData</b>([<i>array</i>]) | Getter/setter for the list of links to represent in the arcs map layer. Each link is displayed as an arc line that rises from the surface of the globe, connecting the start and end coordinates. | `[]` |
|
|
166
|
-
| <b>arcLabel</b>([<i>str</i> or <i>fn</i>]) | Arc object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
166
|
+
| <b>arcLabel</b>([<i>str</i> or <i>fn</i>]) | Arc object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
167
167
|
| <b>arcStartLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's start latitude coordinate. | `startLat` |
|
|
168
168
|
| <b>arcStartLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's start longitude coordinate. | `startLng` |
|
|
169
169
|
| <b>arcEndLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Arc object accessor function, attribute or a numeric constant for the line's end latitude coordinate. | `endLat` |
|
|
@@ -192,7 +192,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
192
192
|
| Method | Description | Default |
|
|
193
193
|
| --- | --- | :--: |
|
|
194
194
|
| <b>polygonsData</b>([<i>array</i>]) | Getter/setter for the list of polygon shapes to represent in the polygons map layer. Each polygon is displayed as a shaped cone that extrudes from the surface of the globe. | `[]` |
|
|
195
|
-
| <b>polygonLabel</b>([<i>str</i> or <i>fn</i>]) | Polygon object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
195
|
+
| <b>polygonLabel</b>([<i>str</i> or <i>fn</i>]) | Polygon object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
196
196
|
| <b>polygonGeoJsonGeometry</b>([<i>str</i> or <i>fn</i>]) | Polygon object accessor function or attribute for the GeoJson geometry specification of the polygon's shape. The returned value should have a minimum of two fields: `type` and `coordinates`. Only GeoJson geometries of type `Polygon` or `MultiPolygon` are supported, other types will be skipped. | `geometry` |
|
|
197
197
|
| <b>polygonCapColor</b>([<i>str</i> or <i>fn</i>]) | Polygon object accessor function or attribute for the color of the top surface. | `() => '#ffffaa'` |
|
|
198
198
|
| <b>polygonCapMaterial</b>([<i>material</i>, <i>str</i> or <i>fn</i>]) | Polygon object accessor function, attribute or material object for the [ThreeJS material](https://threejs.org/docs/#api/en/materials/Material) to use in the top surface. This property takes precedence over `polygonCapColor`, which will be ignored if both are defined. | - |
|
|
@@ -215,7 +215,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
215
215
|
| Method | Description | Default |
|
|
216
216
|
| --- | --- | :--: |
|
|
217
217
|
| <b>pathsData</b>([<i>array</i>]) | Getter/setter for the list of lines to represent in the paths map layer. Each path is displayed as a line that connects all the coordinate pairs in the path array. | `[]` |
|
|
218
|
-
| <b>pathLabel</b>([<i>str</i> or <i>fn</i>]) | Path object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
218
|
+
| <b>pathLabel</b>([<i>str</i> or <i>fn</i>]) | Path object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
219
219
|
| <b>pathPoints</b>([<i>array</i>, <i>str</i> or <i>fn</i>]) | Path object accessor function, attribute or an array for the set of points that define the path line. By default, each path point is assumed to be a 2-position array (`[<lat>, <lon>]`). This default behavior can be modified using the `pathPointLat` and `pathPointLng` methods. | `pnts => pnts` |
|
|
220
220
|
| <b>pathPointLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Path point object accessor function, attribute or a numeric constant for the latitude coordinate. | `arr => arr[0]` |
|
|
221
221
|
| <b>pathPointLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Path point object accessor function, attribute or a numeric constant for the longitude coordinate. | `arr => arr[1]` |
|
|
@@ -264,7 +264,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
264
264
|
| Method | Description | Default |
|
|
265
265
|
| --- | --- | :--: |
|
|
266
266
|
| <b>hexBinPointsData</b>([<i>array</i>]) | Getter/setter for the list of points to aggregate using the hex bin map layer. Each point is added to an hexagonal prism 3D object that represents all the points within a tesselated portion of the space. | `[]` |
|
|
267
|
-
| <b>hexLabel</b>([<i>str</i> or <i>fn</i>]) | Hex object accessor function or attribute for label (shown as tooltip). An hex object includes all points binned, and has the syntax: `{ points, sumWeight, center: { lat, lng } }`. Supports plain text or HTML
|
|
267
|
+
| <b>hexLabel</b>([<i>str</i> or <i>fn</i>]) | Hex object accessor function or attribute for label (shown as tooltip). An hex object includes all points binned, and has the syntax: `{ points, sumWeight, center: { lat, lng } }`. Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | - |
|
|
268
268
|
| <b>hexBinPointLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the latitude coordinate. | `lat` |
|
|
269
269
|
| <b>hexBinPointLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the longitude coordinate. | `lng` |
|
|
270
270
|
| <b>hexBinPointWeight</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Point object accessor function, attribute or a numeric constant for the weight of the point. Weights for points in the same bin are summed and determine the hexagon default altitude. | 1 |
|
|
@@ -289,7 +289,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
289
289
|
| Method | Description | Default |
|
|
290
290
|
| --- | --- | :--: |
|
|
291
291
|
| <b>hexPolygonsData</b>([<i>array</i>]) | Getter/setter for the list of polygon shapes to represent in the hexed polygons map layer. Each polygon is displayed as a tesselated group of hexagons that approximate the polygons shape according to the resolution specified in `hexPolygonResolution`. | `[]` |
|
|
292
|
-
| <b>hexPolygonLabel</b>([<i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
292
|
+
| <b>hexPolygonLabel</b>([<i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
293
293
|
| <b>hexPolygonGeoJsonGeometry</b>([<i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function or attribute for the GeoJson geometry specification of the polygon's shape. The returned value should have a minimum of two fields: `type` and `coordinates`. Only GeoJson geometries of type `Polygon` or `MultiPolygon` are supported, other types will be skipped. | `geometry` |
|
|
294
294
|
| <b>hexPolygonColor</b>([<i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function or attribute for the color of each hexagon in the polygon. | `() => '#ffffaa'` |
|
|
295
295
|
| <b>hexPolygonAltitude</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Hexed polygon object accessor function, attribute or a numeric constant for the polygon's hexagons altitude in terms of globe radius units (`0` = 0 altitude, `1` = globe radius). | 0.001 |
|
|
@@ -312,7 +312,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
312
312
|
| Method | Description | Default |
|
|
313
313
|
| --- | --- | :--: |
|
|
314
314
|
| <b>tilesData</b>([<i>array</i>]) | Getter/setter for the list of tiles to represent in the tiles map layer. Each tile is displayed as a spherical surface segment. The segments can be placed side-by-side for a tiled surface and each can be styled separately. | `[]` |
|
|
315
|
-
| <b>tileLabel</b>([<i>str</i> or <i>fn</i>]) | Tile object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
315
|
+
| <b>tileLabel</b>([<i>str</i> or <i>fn</i>]) | Tile object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
316
316
|
| <b>tileLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Tile object accessor function, attribute or a numeric constant for the segment's centroid latitude coordinate. | `lat` |
|
|
317
317
|
| <b>tileLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Tile object accessor function, attribute or a numeric constant for the segment's centroid longitude coordinate. | `lng` |
|
|
318
318
|
| <b>tileAltitude</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Tile object accessor function, attribute or a numeric constant for the segment's altitude in terms of globe radius units. | 0.01 |
|
|
@@ -353,7 +353,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
353
353
|
| Method | Description | Default |
|
|
354
354
|
| --- | --- | :--: |
|
|
355
355
|
| <b>labelsData</b>([<i>array</i>]) | Getter/setter for the list of label objects to represent in the labels map layer. | `[]` |
|
|
356
|
-
| <b>labelLabel</b>([<i>str</i> or <i>fn</i>]) | Label object accessor function or attribute for its own tooltip label. Supports plain text or HTML
|
|
356
|
+
| <b>labelLabel</b>([<i>str</i> or <i>fn</i>]) | Label object accessor function or attribute for its own tooltip label. Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | - |
|
|
357
357
|
| <b>labelLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Label object accessor function, attribute or a numeric constant for the latitude coordinate. | `lat` |
|
|
358
358
|
| <b>labelLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Label object accessor function, attribute or a numeric constant for the longitude coordinate. | `lng` |
|
|
359
359
|
| <b>labelText</b>([<i>str</i> or <i>fn</i>]) | Label object accessor function or attribute for the label text. | `text` |
|
|
@@ -395,7 +395,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
395
395
|
| Method | Description | Default |
|
|
396
396
|
| --- | --- | :--: |
|
|
397
397
|
| <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. | `[]` |
|
|
398
|
-
| <b>objectLabel</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for its own tooltip label. Supports plain text or HTML
|
|
398
|
+
| <b>objectLabel</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for its own tooltip label. Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
399
399
|
| <b>objectLat</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Object accessor function, attribute or a numeric constant for the latitude coordinate of the object's position. | `lat` |
|
|
400
400
|
| <b>objectLng</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Object accessor function, attribute or a numeric constant for the longitude coordinate of the object's position. | `lng` |
|
|
401
401
|
| <b>objectAltitude</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Object accessor function, attribute or a numeric constant for the altitude coordinate of the object's position, in terms of globe radius units. | 0.01 |
|
|
@@ -415,7 +415,7 @@ new Globe(<domElement>, { configOptions })
|
|
|
415
415
|
| Method | Description | Default |
|
|
416
416
|
| --- | --- | :--: |
|
|
417
417
|
| <b>customLayerData</b>([<i>array</i>]) | Getter/setter for the list of items to represent in the custom map layer. Each item is rendered according to the `customThreeObject` method. | `[]` |
|
|
418
|
-
| <b>customLayerLabel</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for label (shown as tooltip). Supports plain text or HTML
|
|
418
|
+
| <b>customLayerLabel</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for label (shown as tooltip). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
419
419
|
| <b>customThreeObject</b>([<i>Object3d</i>, <i>str</i> or <i>fn</i>]) | Object accessor function or attribute for generating a custom 3d object to render as part of the custom map layer. Should return an instance of [ThreeJS Object3d](https://threejs.org/docs/index.html#api/core/Object3D). | `null` |
|
|
420
420
|
| <b>customThreeObjectUpdate</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for updating an existing custom 3d object with new data. This can be used for performance improvement on data updates as the objects don't need to be removed and recreated at each update. The callback method's signature includes the object to be update and its new data: `customThreeObjectUpdate((obj, objData) => { ... })`. | `null` |
|
|
421
421
|
| <b>onCustomLayerClick</b>(<i>fn</i>) | Callback function for custom object (left-button) clicks. The custom object, the event object and the clicked coordinates are included as arguments: `onCustomLayerClick(obj, event, { lat, lng, altitude })`. | - |
|
package/dist/globe.gl.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ interface ConfigOptions extends ConfigOptions$1 {
|
|
|
10
10
|
type Accessor<In, Out> = Out | string | ((obj: In) => Out);
|
|
11
11
|
type ObjAccessor<T> = Accessor<object, T>;
|
|
12
12
|
|
|
13
|
+
type Label = string | HTMLElement;
|
|
14
|
+
|
|
13
15
|
interface HexBin {
|
|
14
16
|
points: object[],
|
|
15
17
|
sumWeight: number,
|
|
@@ -44,24 +46,24 @@ interface GlobeGenericInstance<ChainableInstance>
|
|
|
44
46
|
backgroundImageUrl(url: string | null): ChainableInstance;
|
|
45
47
|
|
|
46
48
|
// Labels
|
|
47
|
-
pointLabel(): ObjAccessor<
|
|
48
|
-
pointLabel(textAccessor: ObjAccessor<
|
|
49
|
-
arcLabel(): ObjAccessor<
|
|
50
|
-
arcLabel(textAccessor: ObjAccessor<
|
|
51
|
-
polygonLabel(): ObjAccessor<
|
|
52
|
-
polygonLabel(textAccessor: ObjAccessor<
|
|
53
|
-
pathLabel(): ObjAccessor<
|
|
54
|
-
pathLabel(textAccessor: ObjAccessor<
|
|
55
|
-
hexLabel(): Accessor<HexBin,
|
|
56
|
-
hexLabel(textAccessor: Accessor<HexBin,
|
|
57
|
-
tileLabel(): ObjAccessor<
|
|
58
|
-
tileLabel(textAccessor: ObjAccessor<
|
|
59
|
-
labelLabel(): ObjAccessor<
|
|
60
|
-
labelLabel(textAccessor: ObjAccessor<
|
|
61
|
-
objectLabel(): ObjAccessor<
|
|
62
|
-
objectLabel(textAccessor: ObjAccessor<
|
|
63
|
-
customLayerLabel(): ObjAccessor<
|
|
64
|
-
customLayerLabel(textAccessor: ObjAccessor<
|
|
49
|
+
pointLabel(): ObjAccessor<Label>;
|
|
50
|
+
pointLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
51
|
+
arcLabel(): ObjAccessor<Label>;
|
|
52
|
+
arcLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
53
|
+
polygonLabel(): ObjAccessor<Label>;
|
|
54
|
+
polygonLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
55
|
+
pathLabel(): ObjAccessor<Label>;
|
|
56
|
+
pathLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
57
|
+
hexLabel(): Accessor<HexBin, Label>;
|
|
58
|
+
hexLabel(textAccessor: Accessor<HexBin, Label>): ChainableInstance;
|
|
59
|
+
tileLabel(): ObjAccessor<Label>;
|
|
60
|
+
tileLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
61
|
+
labelLabel(): ObjAccessor<Label>;
|
|
62
|
+
labelLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
63
|
+
objectLabel(): ObjAccessor<Label>;
|
|
64
|
+
objectLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
65
|
+
customLayerLabel(): ObjAccessor<Label>;
|
|
66
|
+
customLayerLabel(textAccessor: ObjAccessor<Label>): ChainableInstance;
|
|
65
67
|
|
|
66
68
|
// Interaction events
|
|
67
69
|
onGlobeClick(callback: (coords: { lat: number, lng: number }, event: MouseEvent) => void): ChainableInstance;
|
package/dist/globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.
|
|
1
|
+
// Version 2.37.0 globe.gl - https://github.com/vasturiano/globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -133679,7 +133679,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
133679
133679
|
}
|
|
133680
133680
|
}
|
|
133681
133681
|
|
|
133682
|
-
var css_248z$1 = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
|
|
133682
|
+
var css_248z$1 = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n max-width: max(50%, 150px);\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
|
|
133683
133683
|
styleInject$1(css_248z$1);
|
|
133684
133684
|
|
|
133685
133685
|
var index = index$3({
|
|
@@ -133694,6 +133694,9 @@ var<${access}> ${name} : ${structName};`;
|
|
|
133694
133694
|
style = _ref$style === undefined ? {} : _ref$style;
|
|
133695
133695
|
var isD3Selection = !!domNode && _typeof(domNode) === 'object' && !!domNode.node && typeof domNode.node === 'function';
|
|
133696
133696
|
var el = select(isD3Selection ? domNode.node() : domNode);
|
|
133697
|
+
|
|
133698
|
+
// make sure container is positioned, to provide anchor for tooltip
|
|
133699
|
+
el.style('position') === 'static' && el.style('position', 'relative');
|
|
133697
133700
|
state.tooltipEl = el.append('div').attr('class', 'float-tooltip-kap');
|
|
133698
133701
|
Object.entries(style).forEach(function (_ref2) {
|
|
133699
133702
|
var _ref3 = _slicedToArray$1(_ref2, 2),
|
|
@@ -133727,7 +133730,14 @@ var<${access}> ${name} : ${structName};`;
|
|
|
133727
133730
|
},
|
|
133728
133731
|
update: function update(state) {
|
|
133729
133732
|
state.tooltipEl.style('display', !!state.content && state.mouseInside ? 'inline' : 'none');
|
|
133730
|
-
|
|
133733
|
+
if (state.content instanceof HTMLElement) {
|
|
133734
|
+
state.tooltipEl.text(''); // empty it
|
|
133735
|
+
state.tooltipEl.append(function () {
|
|
133736
|
+
return state.content;
|
|
133737
|
+
});
|
|
133738
|
+
} else {
|
|
133739
|
+
state.tooltipEl.html(state.content || '');
|
|
133740
|
+
}
|
|
133731
133741
|
}
|
|
133732
133742
|
});
|
|
133733
133743
|
|