globe.gl 2.38.0 → 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/README.md +24 -5
- package/dist/globe.gl.d.ts +5 -0
- package/dist/globe.gl.js +640 -330
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +4 -4
- package/dist/globe.gl.mjs +38 -12
- package/example/satellites/index.html +6 -14
- package/package.json +3 -3
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
|
-
|
|
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.
|
|
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,8 +677,9 @@ 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
|
-
}).onClick(function (obj, ev,
|
|
682
|
+
}).onClick(function (obj, ev, intersection) {
|
|
661
683
|
if (!obj) return; // ignore background clicks
|
|
662
684
|
|
|
663
685
|
// Handle click events on objects
|
|
@@ -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
|
|
@@ -681,6 +704,7 @@ var globe = Kapsule({
|
|
|
681
704
|
var args = [ev];
|
|
682
705
|
|
|
683
706
|
// include click coords
|
|
707
|
+
var point = intersection !== null && intersection !== undefined && intersection.isVector3 ? intersection : intersection === null || intersection === undefined ? undefined : intersection.point;
|
|
684
708
|
if (objType === 'globe') {
|
|
685
709
|
var _this$toGeoCoords = _this.toGeoCoords(point),
|
|
686
710
|
lat = _this$toGeoCoords.lat,
|
|
@@ -692,10 +716,10 @@ var globe = Kapsule({
|
|
|
692
716
|
} else {
|
|
693
717
|
args.push(_this.toGeoCoords(point));
|
|
694
718
|
}
|
|
695
|
-
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
|
|
719
|
+
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data, intersection));
|
|
696
720
|
objFns[objType].apply(objFns, args);
|
|
697
721
|
}
|
|
698
|
-
}).onRightClick(function (obj, ev,
|
|
722
|
+
}).onRightClick(function (obj, ev, intersection) {
|
|
699
723
|
if (!obj) return; // ignore background clicks
|
|
700
724
|
|
|
701
725
|
// Handle right-click events
|
|
@@ -709,6 +733,7 @@ var globe = Kapsule({
|
|
|
709
733
|
hexbin: state.onHexRightClick,
|
|
710
734
|
hexPolygon: state.onHexPolygonRightClick,
|
|
711
735
|
tile: state.onTileRightClick,
|
|
736
|
+
particles: state.onParticleRightClick,
|
|
712
737
|
label: state.onLabelRightClick,
|
|
713
738
|
object: state.onObjectRightClick,
|
|
714
739
|
custom: state.onCustomLayerRightClick
|
|
@@ -719,6 +744,7 @@ var globe = Kapsule({
|
|
|
719
744
|
var args = [ev];
|
|
720
745
|
|
|
721
746
|
// include click coords
|
|
747
|
+
var point = intersection !== null && intersection !== undefined && intersection.isVector3 ? intersection : intersection === null || intersection === undefined ? undefined : intersection.point;
|
|
722
748
|
if (objType === 'globe') {
|
|
723
749
|
var _this$toGeoCoords2 = _this.toGeoCoords(point),
|
|
724
750
|
lat = _this$toGeoCoords2.lat,
|
|
@@ -730,7 +756,7 @@ var globe = Kapsule({
|
|
|
730
756
|
} else {
|
|
731
757
|
args.push(_this.toGeoCoords(point));
|
|
732
758
|
}
|
|
733
|
-
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
|
|
759
|
+
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data, intersection));
|
|
734
760
|
objFns[objType].apply(objFns, args);
|
|
735
761
|
}
|
|
736
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
|
-
.
|
|
39
|
-
.
|
|
40
|
-
.
|
|
41
|
-
.
|
|
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.
|
|
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.
|
|
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.
|
|
56
|
-
"three-render-objects": "^1.
|
|
55
|
+
"three-globe": "^2.41",
|
|
56
|
+
"three-render-objects": "^1.37"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/core": "^7.26.0",
|