globe.gl 2.27.3 → 2.28.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
@@ -367,6 +367,8 @@ Globe({ configOptions })(<domElement>)
367
367
  | <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` |
368
368
  | <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` |
369
369
  | <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 |
370
+ | <b>objectRotation</b>([<i>{[x], [y], [z]}</i>, <i>str</i> or <i>fn</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**. | - |
371
+ | <b>objectFacesSurface</b>([<i>boolean</i>, <i>str</i> or <i>fn</i>]) | 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`). | `true` |
370
372
  | <b>objectThreeObject</b>([<i>Object3d</i>, <i>str</i> or <i>fn</i>]) | 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). | *A yellow sphere* |
371
373
  | <b>onObjectClick</b>(<i>fn</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 })`. | - |
372
374
  | <b>onObjectRightClick</b>(<i>fn</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/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.27.3 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.28.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) :
@@ -64911,6 +64911,9 @@
64911
64911
  altitude: r / GLOBE_RADIUS - 1
64912
64912
  };
64913
64913
  }
64914
+ function deg2Rad$1(deg) {
64915
+ return deg * Math.PI / 180;
64916
+ }
64914
64917
 
64915
64918
  var THREE$f = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
64916
64919
  : {
@@ -67418,6 +67421,8 @@
67418
67421
 
67419
67422
  var THREE$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
67420
67423
  : {
67424
+ Euler: Euler,
67425
+ Group: Group$1,
67421
67426
  Mesh: Mesh,
67422
67427
  MeshLambertMaterial: MeshLambertMaterial,
67423
67428
  SphereGeometry: SphereGeometry
@@ -67440,6 +67445,10 @@
67440
67445
  "default": 0.01
67441
67446
  },
67442
67447
  // in units of globe radius
67448
+ objectFacesSurface: {
67449
+ "default": true
67450
+ },
67451
+ objectRotation: {},
67443
67452
  objectThreeObject: {
67444
67453
  "default": new THREE$1.Mesh(
67445
67454
  // default object: yellow sphere
@@ -67462,6 +67471,8 @@
67462
67471
  var latAccessor = index$1(state.objectLat);
67463
67472
  var lngAccessor = index$1(state.objectLng);
67464
67473
  var altitudeAccessor = index$1(state.objectAltitude);
67474
+ var parallelAccessor = index$1(state.objectFacesSurface);
67475
+ var rotationAccessor = index$1(state.objectRotation);
67465
67476
  var threeObjAccessor = index$1(state.objectThreeObject);
67466
67477
  threeDigest(state.objectsData, state.scene, {
67467
67478
  // objs need to be recreated if this prop has changed
@@ -67472,15 +67483,21 @@
67472
67483
  // clone object if it's a shared object among all points
67473
67484
  obj = obj.clone();
67474
67485
  }
67475
- obj.__globeObjType = 'object'; // Add object type
67486
+ var g = new THREE$1.Group();
67487
+ g.add(obj);
67488
+ g.__globeObjType = 'object'; // Add object type
67476
67489
 
67477
- return obj;
67490
+ return g;
67478
67491
  },
67479
- updateObj: function updateObj(obj, d) {
67492
+ updateObj: function updateObj(objG, d) {
67480
67493
  var lat = +latAccessor(d);
67481
67494
  var lng = +lngAccessor(d);
67482
67495
  var alt = +altitudeAccessor(d);
67483
- Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
67496
+ Object.assign(objG.position, polar2Cartesian(lat, lng, alt));
67497
+ parallelAccessor(d) ? objG.setRotationFromEuler(new Euler(deg2Rad$1(-lat), deg2Rad$1(lng), 0, 'YXZ')) : objG.rotation.set(0, 0, 0);
67498
+ var obj = objG.children[0];
67499
+ var rot = rotationAccessor(d);
67500
+ rot && obj.setRotationFromEuler(new Euler(deg2Rad$1(rot.x || 0), deg2Rad$1(rot.y || 0), deg2Rad$1(rot.z || 0)));
67484
67501
  }
67485
67502
  });
67486
67503
  }
@@ -67594,7 +67611,7 @@
67594
67611
  return _defineProperty$1({}, p, bindHtmlElementsLayer.linkProp(p));
67595
67612
  })));
67596
67613
  var bindObjectsLayer = linkKapsule$1('objectsLayer', ObjectsLayerKapsule);
67597
- var linkedObjectsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectThreeObject'].map(function (p) {
67614
+ var linkedObjectsLayerProps = Object.assign.apply(Object, _toConsumableArray$1(['objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject'].map(function (p) {
67598
67615
  return _defineProperty$1({}, p, bindObjectsLayer.linkProp(p));
67599
67616
  })));
67600
67617
  var bindCustomLayer = linkKapsule$1('customLayer', CustomLayerKapsule);
@@ -72145,7 +72162,7 @@
72145
72162
 
72146
72163
  // Expose config from ThreeGlobe
72147
72164
  var bindGlobe = linkKapsule('globe', threeGlobe);
72148
- var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray$5(['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) {
72165
+ var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray$5(['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) {
72149
72166
  return _defineProperty$3({}, p, bindGlobe.linkProp(p));
72150
72167
  })));
72151
72168
  var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray$5(['getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {