globe.gl 2.38.1 → 2.39.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/dist/globe.gl.mjs CHANGED
@@ -166,7 +166,7 @@ var THREE = _objectSpread2(_objectSpread2({}, window.THREE ? window.THREE // Pre
166
166
 
167
167
  // Expose config from ThreeGlobe
168
168
  var bindGlobe = linkKapsule('globe', ThreeGlobe);
169
- var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'globeTileEngineUrl', 'globeTileEngineMaxLevel', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', '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', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', '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) {
169
+ var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray(['globeImageUrl', 'bumpImageUrl', 'globeTileEngineUrl', 'globeTileEngineMaxLevel', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', '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', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'particlesData', 'particlesList', 'particleLat', 'particleLng', 'particleAltitude', 'particlesSize', 'particlesSizeAttenuation', 'particlesColor', 'particlesTexture', '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) {
170
170
  return _defineProperty({}, p, bindGlobe.linkProp(p));
171
171
  })));
172
172
  var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
@@ -293,6 +293,19 @@ var globe = Kapsule({
293
293
  onTileHover: {
294
294
  triggerUpdate: false
295
295
  },
296
+ particleLabel: {
297
+ "default": 'name',
298
+ triggerUpdate: false
299
+ },
300
+ onParticleClick: {
301
+ triggerUpdate: false
302
+ },
303
+ onParticleRightClick: {
304
+ triggerUpdate: false
305
+ },
306
+ onParticleHover: {
307
+ triggerUpdate: false
308
+ },
296
309
  labelLabel: {
297
310
  triggerUpdate: false
298
311
  },
@@ -346,7 +359,8 @@ var globe = Kapsule({
346
359
  "default": 0.2,
347
360
  triggerUpdate: false,
348
361
  onChange: function onChange(val, state) {
349
- return state.renderObjs.lineHoverPrecision(val);
362
+ state.renderObjs.lineHoverPrecision(val);
363
+ state.renderObjs.pointsHoverPrecision(val);
350
364
  }
351
365
  }
352
366
  }, linkedGlobeProps), linkedRenderObjsProps),
@@ -463,6 +477,7 @@ var globe = Kapsule({
463
477
  this.hexBinPointsData([]);
464
478
  this.hexPolygonsData([]);
465
479
  this.tilesData([]);
480
+ this.particlesData([]);
466
481
  this.labelsData([]);
467
482
  this.htmlElementsData([]);
468
483
  this.objectsData([]);
@@ -570,6 +585,9 @@ var globe = Kapsule({
570
585
  tile: function tile(d) {
571
586
  return d;
572
587
  },
588
+ particles: function particles(d, intersection) {
589
+ return !intersection || !intersection.hasOwnProperty('index') || d.length <= intersection.index ? d : d[intersection.index];
590
+ },
573
591
  label: function label(d) {
574
592
  return d;
575
593
  },
@@ -590,7 +608,7 @@ var globe = Kapsule({
590
608
  return !o;
591
609
  }; // || o.__globeObjType === 'globe' || o.__globeObjType === 'atmosphere';
592
610
  return isBackground(aObj) - isBackground(bObj);
593
- }).tooltipContent(function (obj) {
611
+ }).tooltipContent(function (obj, intersection) {
594
612
  var objAccessors = {
595
613
  point: state.pointLabel,
596
614
  arc: state.arcLabel,
@@ -599,14 +617,15 @@ var globe = Kapsule({
599
617
  hexbin: state.hexLabel,
600
618
  hexPolygon: state.hexPolygonLabel,
601
619
  tile: state.tileLabel,
620
+ particles: state.particleLabel,
602
621
  label: state.labelLabel,
603
622
  object: state.objectLabel,
604
623
  custom: state.customLayerLabel
605
624
  };
606
625
  var globeObj = getGlobeObj(obj);
607
626
  var objType = globeObj && globeObj.__globeObjType;
608
- return globeObj && objType && objAccessors.hasOwnProperty(objType) && dataAccessors.hasOwnProperty(objType) ? accessorFn(objAccessors[objType])(dataAccessors[objType](globeObj.__data)) || '' : '';
609
- }).onHover(function (obj) {
627
+ return globeObj && objType && objAccessors.hasOwnProperty(objType) && dataAccessors.hasOwnProperty(objType) ? accessorFn(objAccessors[objType])(dataAccessors[objType](globeObj.__data, intersection)) || '' : '';
628
+ }).onHover(function (obj, _, intersection) {
610
629
  // Update tooltip and trigger onHover events
611
630
  var hoverObjFns = {
612
631
  point: state.onPointHover,
@@ -617,6 +636,7 @@ var globe = Kapsule({
617
636
  hexbin: state.onHexHover,
618
637
  hexPolygon: state.onHexPolygonHover,
619
638
  tile: state.onTileHover,
639
+ particles: state.onParticleHover,
620
640
  label: state.onLabelHover,
621
641
  object: state.onObjectHover,
622
642
  custom: state.onCustomLayerHover
@@ -631,6 +651,7 @@ var globe = Kapsule({
631
651
  hexbin: state.onHexClick,
632
652
  hexPolygon: state.onHexPolygonClick,
633
653
  tile: state.onTileClick,
654
+ particles: state.onParticleClick,
634
655
  label: state.onLabelClick,
635
656
  object: state.onObjectClick,
636
657
  custom: state.onCustomLayerClick
@@ -641,12 +662,12 @@ var globe = Kapsule({
641
662
  hoverObj && !hoverObjFns.hasOwnProperty(hoverObj.__globeObjType) && (hoverObj = null);
642
663
  if (hoverObj !== state.hoverObj) {
643
664
  var prevObjType = state.hoverObj ? state.hoverObj.__globeObjType : null;
644
- var prevObjData = state.hoverObj ? dataAccessors[prevObjType](state.hoverObj.__data) : null;
665
+ var prevObjData = state.hoverData;
645
666
  var objType = hoverObj ? hoverObj.__globeObjType : null;
646
- var objData = hoverObj ? dataAccessors[objType](hoverObj.__data) : null;
667
+ var objData = hoverObj ? dataAccessors[objType](hoverObj.__data, intersection) : null;
647
668
  if (prevObjType && prevObjType !== objType) {
648
669
  // Hover out
649
- hoverObjFns[prevObjType] && hoverObjFns[prevObjType](null, prevObjData);
670
+ hoverObjFns[prevObjType] && hoverObjFns[prevObjType](null, prevObjData || null);
650
671
  }
651
672
  if (objType) {
652
673
  // Hover in
@@ -656,6 +677,7 @@ var globe = Kapsule({
656
677
  // set pointer if hovered object is clickable
657
678
  state.renderObjs.renderer().domElement.classList[objType && clickObjFns[objType] ? 'add' : 'remove']('clickable');
658
679
  state.hoverObj = hoverObj;
680
+ state.hoverData = objData;
659
681
  }
660
682
  }).onClick(function (obj, ev, intersection) {
661
683
  if (!obj) return; // ignore background clicks
@@ -671,6 +693,7 @@ var globe = Kapsule({
671
693
  hexbin: state.onHexClick,
672
694
  hexPolygon: state.onHexPolygonClick,
673
695
  tile: state.onTileClick,
696
+ particles: state.onParticleClick,
674
697
  label: state.onLabelClick,
675
698
  object: state.onObjectClick,
676
699
  custom: state.onCustomLayerClick
@@ -693,7 +716,7 @@ var globe = Kapsule({
693
716
  } else {
694
717
  args.push(_this.toGeoCoords(point));
695
718
  }
696
- dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
719
+ dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data, intersection));
697
720
  objFns[objType].apply(objFns, args);
698
721
  }
699
722
  }).onRightClick(function (obj, ev, intersection) {
@@ -710,6 +733,7 @@ var globe = Kapsule({
710
733
  hexbin: state.onHexRightClick,
711
734
  hexPolygon: state.onHexPolygonRightClick,
712
735
  tile: state.onTileRightClick,
736
+ particles: state.onParticleRightClick,
713
737
  label: state.onLabelRightClick,
714
738
  object: state.onObjectRightClick,
715
739
  custom: state.onCustomLayerRightClick
@@ -732,7 +756,7 @@ var globe = Kapsule({
732
756
  } else {
733
757
  args.push(_this.toGeoCoords(point));
734
758
  }
735
- dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
759
+ dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data, intersection));
736
760
  objFns[objType].apply(objFns, args);
737
761
  }
738
762
  });
@@ -25,28 +25,21 @@
25
25
 
26
26
  <script type="module">
27
27
  import * as satellite from 'https://esm.sh/satellite.js';
28
- import * as THREE from 'https://esm.sh/three';
29
28
 
30
29
  const EARTH_RADIUS_KM = 6371; // km
31
- const SAT_SIZE = 100; // km
32
30
  const TIME_STEP = 3 * 1000; // per frame
33
31
 
34
32
  const timeLogger = document.getElementById('time-log');
35
33
 
36
34
  const world = new Globe(document.getElementById('chart'))
37
35
  .globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
38
- .objectLat('lat')
39
- .objectLng('lng')
40
- .objectAltitude('alt')
41
- .objectFacesSurface(false)
42
- .objectLabel('name');
36
+ .particleLat('lat')
37
+ .particleLng('lng')
38
+ .particleAltitude('alt')
39
+ .particlesColor(() => 'palegreen');
43
40
 
44
41
  setTimeout(() => world.pointOfView({ altitude: 3.5 }));
45
42
 
46
- const satGeometry = new THREE.OctahedronGeometry(SAT_SIZE * world.getGlobeRadius() / EARTH_RADIUS_KM / 2, 0);
47
- const satMaterial = new THREE.MeshLambertMaterial({ color: 'palegreen', transparent: true, opacity: 0.7 });
48
- world.objectThreeObject(() => new THREE.Mesh(satGeometry, satMaterial));
49
-
50
43
  fetch('../datasets/space-track-leo.txt').then(r => r.text()).then(rawData => {
51
44
  const tleData = rawData.replace(/\r/g, '')
52
45
  .split(/\n(?=[^12])/)
@@ -57,8 +50,7 @@
57
50
  name: name.trim().replace(/^0 /, '')
58
51
  }))
59
52
  // exclude those that can't be propagated
60
- .filter(d => !!satellite.propagate(d.satrec, new Date()).position)
61
- .slice(0, 2000);
53
+ .filter(d => !!satellite.propagate(d.satrec, new Date()).position);
62
54
 
63
55
  // time ticker
64
56
  let time = new Date();
@@ -80,7 +72,7 @@
80
72
  }
81
73
  });
82
74
 
83
- world.objectsData(satData);
75
+ world.particlesData([satData.filter(d => !isNaN(d.lat) && !isNaN(d.lng) && !isNaN(d.alt))]);
84
76
  })();
85
77
  });
86
78
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "globe.gl",
3
- "version": "2.38.1",
3
+ "version": "2.39.0",
4
4
  "description": "UI component for Globe Data Visualization using ThreeJS/WebGL",
5
5
  "type": "module",
6
6
  "unpkg": "dist/globe.gl.min.js",
@@ -52,8 +52,8 @@
52
52
  "accessor-fn": "1",
53
53
  "kapsule": "^1.16",
54
54
  "three": ">=0.154 <1",
55
- "three-globe": "^2.40",
56
- "three-render-objects": "^1.35"
55
+ "three-globe": "^2.41",
56
+ "three-render-objects": "^1.37"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/core": "^7.26.0",