react-globe.gl 2.23.5 → 2.24.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
|
@@ -358,6 +358,8 @@ ReactDOM.render(
|
|
|
358
358
|
| <b>objectLat</b> | <i>number</i>, <i>string</i> or <i>func</i> | `lat` | Object accessor function, attribute or a numeric constant for the latitude coordinate of the object's position. |
|
|
359
359
|
| <b>objectLng</b> | <i>number</i>, <i>string</i> or <i>func</i> | `lng` | Object accessor function, attribute or a numeric constant for the longitude coordinate of the object's position. |
|
|
360
360
|
| <b>objectAltitude</b> | <i>number</i>, <i>string</i> or <i>func</i> | 0.01 | Object accessor function, attribute or a numeric constant for the altitude coordinate of the object's position, in terms of globe radius units. |
|
|
361
|
+
| <b>objectRotation</b> | <i>{[x], [y], [z]}</i>, <i>str</i> or <i>func</i> | | Object accessor function, attribute or a `{x, y, z}` object for the object's rotation (in degrees). Each dimension is optional, allowing for rotation only in some axes. Rotation is applied in the order **X**->**Y**->**Z**. |
|
|
362
|
+
| <b>objectFacesSurface</b> | <i>bool</i>, <i>string</i> or <i>func</i> | `true` | Object accessor function, attribute or a boolean constant for whether the object should be rotated to face (away from) the globe surface (`true`), or be left in its original universe orientation (`false`). |
|
|
361
363
|
| <b>objectThreeObject</b> | <i>Object3d</i>, <i>string</i> or <i>func</i> | *A yellow sphere* | Object accessor function or attribute for defining a custom 3d object to render as part of the objects map layer. Should return an instance of [ThreeJS Object3d](https://threejs.org/docs/index.html#api/core/Object3D). |
|
|
362
364
|
| <b>onObjectClick</b> | <i>func</i> | *-* | Callback function for object (left-button) clicks. The object itself, the event and the clicked coordinates are included as arguments: `onObjectClick(obj, event, { lat, lng, altitude })`. |
|
|
363
365
|
| <b>onObjectRightClick</b> | <i>func</i> | *-* | Callback function for object right-clicks. The object itself, the event and the clicked coordinates are included as arguments: `onObjectRightClick(obj, event, { lat, lng, altitude })`. |
|
package/dist/react-globe.gl.d.ts
CHANGED
|
@@ -224,6 +224,8 @@ interface GlobeProps extends ConfigOptions {
|
|
|
224
224
|
objectLat?: ObjAccessor<number>;
|
|
225
225
|
objectLng?: ObjAccessor<number>;
|
|
226
226
|
objectAltitude?: ObjAccessor<number>;
|
|
227
|
+
objectRotation?: ObjAccessor<{ x?: number, y?: number, z?: number } | null>;
|
|
228
|
+
objectFacesSurfaces?: ObjAccessor<boolean>;
|
|
227
229
|
objectThreeObject?: Object3D | string | ((d: object) => Object3D);
|
|
228
230
|
objectLabel?: ObjAccessor<string>;
|
|
229
231
|
onObjectClick?: (obj: object, event: MouseEvent, coords: { lat: number, lng: number, altitude: number }) => void;
|
package/dist/react-globe.gl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 2.
|
|
1
|
+
// Version 2.24.0 react-globe.gl - https://github.com/vasturiano/react-globe.gl
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['react'], factory) :
|
|
@@ -65075,6 +65075,9 @@
|
|
|
65075
65075
|
altitude: r / GLOBE_RADIUS - 1
|
|
65076
65076
|
};
|
|
65077
65077
|
}
|
|
65078
|
+
function deg2Rad$1(deg) {
|
|
65079
|
+
return deg * Math.PI / 180;
|
|
65080
|
+
}
|
|
65078
65081
|
|
|
65079
65082
|
var THREE$f = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
65080
65083
|
: {
|
|
@@ -67582,6 +67585,8 @@
|
|
|
67582
67585
|
|
|
67583
67586
|
var THREE$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
67584
67587
|
: {
|
|
67588
|
+
Euler: Euler,
|
|
67589
|
+
Group: Group$1,
|
|
67585
67590
|
Mesh: Mesh,
|
|
67586
67591
|
MeshLambertMaterial: MeshLambertMaterial,
|
|
67587
67592
|
SphereGeometry: SphereGeometry
|
|
@@ -67604,6 +67609,10 @@
|
|
|
67604
67609
|
"default": 0.01
|
|
67605
67610
|
},
|
|
67606
67611
|
// in units of globe radius
|
|
67612
|
+
objectFacesSurface: {
|
|
67613
|
+
"default": true
|
|
67614
|
+
},
|
|
67615
|
+
objectRotation: {},
|
|
67607
67616
|
objectThreeObject: {
|
|
67608
67617
|
"default": new THREE$1.Mesh(
|
|
67609
67618
|
// default object: yellow sphere
|
|
@@ -67626,6 +67635,8 @@
|
|
|
67626
67635
|
var latAccessor = index$1(state.objectLat);
|
|
67627
67636
|
var lngAccessor = index$1(state.objectLng);
|
|
67628
67637
|
var altitudeAccessor = index$1(state.objectAltitude);
|
|
67638
|
+
var parallelAccessor = index$1(state.objectFacesSurface);
|
|
67639
|
+
var rotationAccessor = index$1(state.objectRotation);
|
|
67629
67640
|
var threeObjAccessor = index$1(state.objectThreeObject);
|
|
67630
67641
|
threeDigest(state.objectsData, state.scene, {
|
|
67631
67642
|
// objs need to be recreated if this prop has changed
|
|
@@ -67636,15 +67647,21 @@
|
|
|
67636
67647
|
// clone object if it's a shared object among all points
|
|
67637
67648
|
obj = obj.clone();
|
|
67638
67649
|
}
|
|
67639
|
-
|
|
67650
|
+
var g = new THREE$1.Group();
|
|
67651
|
+
g.add(obj);
|
|
67652
|
+
g.__globeObjType = 'object'; // Add object type
|
|
67640
67653
|
|
|
67641
|
-
return
|
|
67654
|
+
return g;
|
|
67642
67655
|
},
|
|
67643
|
-
updateObj: function updateObj(
|
|
67656
|
+
updateObj: function updateObj(objG, d) {
|
|
67644
67657
|
var lat = +latAccessor(d);
|
|
67645
67658
|
var lng = +lngAccessor(d);
|
|
67646
67659
|
var alt = +altitudeAccessor(d);
|
|
67647
|
-
Object.assign(
|
|
67660
|
+
Object.assign(objG.position, polar2Cartesian(lat, lng, alt));
|
|
67661
|
+
parallelAccessor(d) ? objG.setRotationFromEuler(new Euler(deg2Rad$1(-lat), deg2Rad$1(lng), 0, 'YXZ')) : objG.rotation.set(0, 0, 0);
|
|
67662
|
+
var obj = objG.children[0];
|
|
67663
|
+
var rot = rotationAccessor(d);
|
|
67664
|
+
rot && obj.setRotationFromEuler(new Euler(deg2Rad$1(rot.x || 0), deg2Rad$1(rot.y || 0), deg2Rad$1(rot.z || 0)));
|
|
67648
67665
|
}
|
|
67649
67666
|
});
|
|
67650
67667
|
}
|
|
@@ -67758,7 +67775,7 @@
|
|
|
67758
67775
|
return _defineProperty$2({}, p, bindHtmlElementsLayer.linkProp(p));
|
|
67759
67776
|
})));
|
|
67760
67777
|
var bindObjectsLayer = linkKapsule$1('objectsLayer', ObjectsLayerKapsule);
|
|
67761
|
-
var linkedObjectsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectThreeObject'].map(function (p) {
|
|
67778
|
+
var linkedObjectsLayerProps = Object.assign.apply(Object, _toConsumableArray$2(['objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject'].map(function (p) {
|
|
67762
67779
|
return _defineProperty$2({}, p, bindObjectsLayer.linkProp(p));
|
|
67763
67780
|
})));
|
|
67764
67781
|
var bindCustomLayer = linkKapsule$1('customLayer', CustomLayerKapsule);
|
|
@@ -72437,7 +72454,7 @@
|
|
|
72437
72454
|
|
|
72438
72455
|
// Expose config from ThreeGlobe
|
|
72439
72456
|
var bindGlobe = linkKapsule('globe', threeGlobe);
|
|
72440
|
-
var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'globeMaterial', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
|
|
72457
|
+
var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'globeMaterial', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonCurvatureResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
|
|
72441
72458
|
return _defineProperty({}, p, bindGlobe.linkProp(p));
|
|
72442
72459
|
})));
|
|
72443
72460
|
var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
|
|
@@ -74167,6 +74184,12 @@
|
|
|
74167
74184
|
objectLat: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
74168
74185
|
objectLng: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
74169
74186
|
objectAltitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
74187
|
+
objectRotation: PropTypes.oneOfType([PropTypes.shape({
|
|
74188
|
+
x: PropTypes.number,
|
|
74189
|
+
y: PropTypes.number,
|
|
74190
|
+
z: PropTypes.number
|
|
74191
|
+
}), PropTypes.string, PropTypes.func]),
|
|
74192
|
+
objectFacesSurface: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.func]),
|
|
74170
74193
|
objectThreeObject: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func]),
|
|
74171
74194
|
objectLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
74172
74195
|
onObjectClick: PropTypes.func,
|