globe.gl 2.22.8 → 2.24.2
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 +42 -20
- package/dist/globe.gl.common.js +16 -26
- package/dist/globe.gl.d.ts +18 -18
- package/dist/globe.gl.js +13852 -14299
- package/dist/globe.gl.js.map +1 -1
- package/dist/globe.gl.min.js +4 -4
- package/dist/globe.gl.module.js +16 -26
- package/example/clouds/clouds.png +0 -0
- package/example/clouds/index.html +42 -0
- package/example/clouds/preview.png +0 -0
- package/example/custom-globe-styling/preview.png +0 -0
- package/example/earth-shield/index.html +24 -0
- package/example/earth-shield/preview.png +0 -0
- package/example/emit-arcs-on-click/index.html +57 -0
- package/example/moon-landing-sites/preview.png +0 -0
- package/example/random-rings/index.html +34 -0
- package/example/random-rings/preview.png +0 -0
- package/example/solar-terminator/preview.png +0 -0
- package/package.json +13 -13
package/dist/globe.gl.module.js
CHANGED
|
@@ -42,14 +42,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
42
42
|
|
|
43
43
|
if (Object.getOwnPropertySymbols) {
|
|
44
44
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
keys.push.apply(keys, symbols);
|
|
45
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
47
|
+
})), keys.push.apply(keys, symbols);
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
return keys;
|
|
@@ -57,19 +52,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
57
52
|
|
|
58
53
|
function _objectSpread2(target) {
|
|
59
54
|
for (var i = 1; i < arguments.length; i++) {
|
|
60
|
-
var source = arguments[i]
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
67
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
68
|
-
} else {
|
|
69
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
70
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
71
|
-
});
|
|
72
|
-
}
|
|
55
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
56
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
57
|
+
_defineProperty(target, key, source[key]);
|
|
58
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
59
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
60
|
+
});
|
|
73
61
|
}
|
|
74
62
|
|
|
75
63
|
return target;
|
|
@@ -200,7 +188,7 @@ var three = window.THREE ? window.THREE // Prefer consumption from global THREE,
|
|
|
200
188
|
// Expose config from ThreeGlobe
|
|
201
189
|
|
|
202
190
|
var bindGlobe = linkKapsule('globe', ThreeGlobe);
|
|
203
|
-
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', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
|
|
191
|
+
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', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
|
|
204
192
|
return _defineProperty({}, p, bindGlobe.linkProp(p));
|
|
205
193
|
})));
|
|
206
194
|
var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray(['getCoords', 'toGeoCoords'].map(function (p) {
|
|
@@ -674,10 +662,9 @@ var globe = Kapsule({
|
|
|
674
662
|
var objType = globeObj.__globeObjType;
|
|
675
663
|
|
|
676
664
|
if (globeObj && objFns.hasOwnProperty(objType) && objFns[objType]) {
|
|
677
|
-
var args = [ev];
|
|
665
|
+
var args = [ev]; // include click coords
|
|
678
666
|
|
|
679
667
|
if (objType === 'globe') {
|
|
680
|
-
// include click coords in { lat, lng }
|
|
681
668
|
var _this$toGeoCoords = _this.toGeoCoords(point),
|
|
682
669
|
lat = _this$toGeoCoords.lat,
|
|
683
670
|
lng = _this$toGeoCoords.lng;
|
|
@@ -686,6 +673,8 @@ var globe = Kapsule({
|
|
|
686
673
|
lat: lat,
|
|
687
674
|
lng: lng
|
|
688
675
|
});
|
|
676
|
+
} else {
|
|
677
|
+
args.push(_this.toGeoCoords(point));
|
|
689
678
|
}
|
|
690
679
|
|
|
691
680
|
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
|
|
@@ -711,10 +700,9 @@ var globe = Kapsule({
|
|
|
711
700
|
var objType = globeObj.__globeObjType;
|
|
712
701
|
|
|
713
702
|
if (globeObj && objFns.hasOwnProperty(objType) && objFns[objType]) {
|
|
714
|
-
var args = [ev];
|
|
703
|
+
var args = [ev]; // include click coords
|
|
715
704
|
|
|
716
705
|
if (objType === 'globe') {
|
|
717
|
-
// include click coords in { lat, lng }
|
|
718
706
|
var _this$toGeoCoords2 = _this.toGeoCoords(point),
|
|
719
707
|
lat = _this$toGeoCoords2.lat,
|
|
720
708
|
lng = _this$toGeoCoords2.lng;
|
|
@@ -723,6 +711,8 @@ var globe = Kapsule({
|
|
|
723
711
|
lat: lat,
|
|
724
712
|
lng: lng
|
|
725
713
|
});
|
|
714
|
+
} else {
|
|
715
|
+
args.push(_this.toGeoCoords(point));
|
|
726
716
|
}
|
|
727
717
|
|
|
728
718
|
dataAccessors.hasOwnProperty(objType) && args.unshift(dataAccessors[objType](globeObj.__data));
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<head>
|
|
2
|
+
<style> body { margin: 0; } </style>
|
|
3
|
+
|
|
4
|
+
<script src="//unpkg.com/three"></script>
|
|
5
|
+
|
|
6
|
+
<script src="//unpkg.com/globe.gl"></script>
|
|
7
|
+
<!--<script src="../../dist/globe.gl.js"></script>-->
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<div id="globeViz"></div>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
const world = Globe({ animateIn: false })
|
|
15
|
+
(document.getElementById('globeViz'))
|
|
16
|
+
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
|
|
17
|
+
.bumpImageUrl('//unpkg.com/three-globe/example/img/earth-topology.png');
|
|
18
|
+
|
|
19
|
+
// Auto-rotate
|
|
20
|
+
world.controls().autoRotate = true;
|
|
21
|
+
world.controls().autoRotateSpeed = 0.35;
|
|
22
|
+
|
|
23
|
+
// Add clouds sphere
|
|
24
|
+
const GLOBE_RADIUS = 100;
|
|
25
|
+
const CLOUDS_IMG_URL = './clouds.png'; // from https://github.com/turban/webgl-earth
|
|
26
|
+
const CLOUDS_ALT = 0.004;
|
|
27
|
+
const CLOUDS_ROTATION_SPEED = -0.006; // deg/frame
|
|
28
|
+
|
|
29
|
+
new THREE.TextureLoader().load(CLOUDS_IMG_URL, cloudsTexture => {
|
|
30
|
+
const clouds = new THREE.Mesh(
|
|
31
|
+
new THREE.SphereBufferGeometry(GLOBE_RADIUS * (1 + CLOUDS_ALT), 75, 75),
|
|
32
|
+
new THREE.MeshPhongMaterial({ map: cloudsTexture, transparent: true })
|
|
33
|
+
);
|
|
34
|
+
world.scene().add(clouds);
|
|
35
|
+
|
|
36
|
+
(function rotateClouds() {
|
|
37
|
+
clouds.rotation.y += CLOUDS_ROTATION_SPEED * Math.PI / 180;
|
|
38
|
+
requestAnimationFrame(rotateClouds);
|
|
39
|
+
})();
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
</body>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<head>
|
|
2
|
+
<style> body { margin: 0; } </style>
|
|
3
|
+
|
|
4
|
+
<script src="//unpkg.com/globe.gl"></script>
|
|
5
|
+
<!-- <script src="../../dist/globe.gl.js"></script>-->
|
|
6
|
+
</head>
|
|
7
|
+
|
|
8
|
+
<body>
|
|
9
|
+
<div id="globeViz"></div>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
const shieldRing = { lat: 90, lng: 0 };
|
|
13
|
+
|
|
14
|
+
const globe = Globe()
|
|
15
|
+
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-night.jpg')
|
|
16
|
+
.ringsData([shieldRing])
|
|
17
|
+
.ringAltitude(0.25)
|
|
18
|
+
.ringColor(() => 'lightblue')
|
|
19
|
+
.ringMaxRadius(180)
|
|
20
|
+
.ringPropagationSpeed(20)
|
|
21
|
+
.ringRepeatPeriod(200)
|
|
22
|
+
(document.getElementById('globeViz'));
|
|
23
|
+
</script>
|
|
24
|
+
</body>
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<head>
|
|
2
|
+
<style> body { margin: 0; } </style>
|
|
3
|
+
|
|
4
|
+
<script src="//unpkg.com/globe.gl"></script>
|
|
5
|
+
<!-- <script src="../../dist/globe.gl.js"></script>-->
|
|
6
|
+
</head>
|
|
7
|
+
|
|
8
|
+
<body>
|
|
9
|
+
<div id="globeViz"></div>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
const ARC_REL_LEN = 0.4; // relative to whole arc
|
|
13
|
+
const FLIGHT_TIME = 1000;
|
|
14
|
+
const NUM_RINGS = 3;
|
|
15
|
+
const RINGS_MAX_R = 5; // deg
|
|
16
|
+
const RING_PROPAGATION_SPEED = 5; // deg/sec
|
|
17
|
+
|
|
18
|
+
const globe = Globe()
|
|
19
|
+
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-night.jpg')
|
|
20
|
+
.arcColor(() => 'darkOrange')
|
|
21
|
+
.onGlobeClick(emitArc)
|
|
22
|
+
.arcDashLength(ARC_REL_LEN)
|
|
23
|
+
.arcDashGap(2)
|
|
24
|
+
.arcDashInitialGap(1)
|
|
25
|
+
.arcDashAnimateTime(FLIGHT_TIME)
|
|
26
|
+
.arcsTransitionDuration(0)
|
|
27
|
+
.ringColor(() => t => `rgba(255,100,50,${1-t})`)
|
|
28
|
+
.ringMaxRadius(RINGS_MAX_R)
|
|
29
|
+
.ringPropagationSpeed(RING_PROPAGATION_SPEED)
|
|
30
|
+
.ringRepeatPeriod(FLIGHT_TIME * ARC_REL_LEN / NUM_RINGS)
|
|
31
|
+
(document.getElementById('globeViz'));
|
|
32
|
+
|
|
33
|
+
let prevCoords = { lat: 0, lng: 0 };
|
|
34
|
+
function emitArc({ lat: endLat, lng: endLng }) {
|
|
35
|
+
const { lat: startLat, lng: startLng } = prevCoords;
|
|
36
|
+
setTimeout(() => { prevCoords = { lat: endLat, lng: endLng }}, FLIGHT_TIME);
|
|
37
|
+
|
|
38
|
+
// add and remove arc after 1 cycle
|
|
39
|
+
const arc = { startLat, startLng, endLat, endLng };
|
|
40
|
+
globe.arcsData([...globe.arcsData(), arc]);
|
|
41
|
+
setTimeout(() => globe.arcsData(globe.arcsData().filter(d => d !== arc)), FLIGHT_TIME * 2);
|
|
42
|
+
|
|
43
|
+
// add and remove start rings
|
|
44
|
+
const srcRing = { lat: startLat, lng: startLng };
|
|
45
|
+
globe.ringsData([...globe.ringsData(), srcRing]);
|
|
46
|
+
setTimeout(() => globe.ringsData(globe.ringsData().filter(r => r !== srcRing)), FLIGHT_TIME * ARC_REL_LEN);
|
|
47
|
+
|
|
48
|
+
// add and remove target rings
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
const targetRing = { lat: endLat, lng: endLng };
|
|
51
|
+
globe.ringsData([...globe.ringsData(), targetRing]);
|
|
52
|
+
setTimeout(() => globe.ringsData(globe.ringsData().filter(r => r !== targetRing)), FLIGHT_TIME * ARC_REL_LEN);
|
|
53
|
+
}, FLIGHT_TIME);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
</script>
|
|
57
|
+
</body>
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<head>
|
|
2
|
+
<style> body { margin: 0; } </style>
|
|
3
|
+
|
|
4
|
+
<script src="//unpkg.com/globe.gl"></script>
|
|
5
|
+
<!-- <script src="../../dist/globe.gl.js"></script>-->
|
|
6
|
+
</head>
|
|
7
|
+
|
|
8
|
+
<body>
|
|
9
|
+
<div id="globeViz"></div>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
// Gen random data
|
|
13
|
+
const N = 10;
|
|
14
|
+
const gData = [...Array(N).keys()].map(() => ({
|
|
15
|
+
lat: (Math.random() - 0.5) * 180,
|
|
16
|
+
lng: (Math.random() - 0.5) * 360,
|
|
17
|
+
maxR: Math.random() * 20 + 3,
|
|
18
|
+
propagationSpeed: (Math.random() - 0.5) * 20 + 1,
|
|
19
|
+
repeatPeriod: Math.random() * 2000 + 200
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
const colorInterpolator = t => `rgba(255,100,50,${Math.sqrt(1-t)})`;
|
|
23
|
+
|
|
24
|
+
const globe = Globe()
|
|
25
|
+
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-night.jpg')
|
|
26
|
+
.ringsData(gData)
|
|
27
|
+
.ringColor(() => colorInterpolator)
|
|
28
|
+
.ringMaxRadius('maxR')
|
|
29
|
+
.ringPropagationSpeed('propagationSpeed')
|
|
30
|
+
.ringRepeatPeriod('repeatPeriod')
|
|
31
|
+
(document.getElementById('globeViz'));
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
</body>
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "globe.gl",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.2",
|
|
4
4
|
"description": "UI component for Globe Data Visualization using ThreeJS/WebGL",
|
|
5
5
|
"unpkg": "dist/globe.gl.min.js",
|
|
6
6
|
"jsdelivr": "dist/globe.gl.min.js",
|
|
@@ -43,23 +43,23 @@
|
|
|
43
43
|
"accessor-fn": "1",
|
|
44
44
|
"kapsule": "^1.13",
|
|
45
45
|
"three": ">=0.118 <1",
|
|
46
|
-
"three-globe": "^2.
|
|
46
|
+
"three-globe": "^2.21",
|
|
47
47
|
"three-render-objects": "^1.26"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/core": "^7.
|
|
51
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
52
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
53
|
-
"@babel/preset-env": "^7.
|
|
50
|
+
"@babel/core": "^7.16.12",
|
|
51
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
52
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
|
|
53
|
+
"@babel/preset-env": "^7.16.11",
|
|
54
54
|
"@rollup/plugin-babel": "^5.3.0",
|
|
55
|
-
"@rollup/plugin-commonjs": "^
|
|
56
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
57
|
-
"postcss": "^8.
|
|
55
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
56
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
57
|
+
"postcss": "^8.4.5",
|
|
58
58
|
"rimraf": "^3.0.2",
|
|
59
|
-
"rollup": "^2.
|
|
60
|
-
"rollup-plugin-dts": "^4.
|
|
61
|
-
"rollup-plugin-postcss": "^4.0.
|
|
59
|
+
"rollup": "^2.66.1",
|
|
60
|
+
"rollup-plugin-dts": "^4.1.0",
|
|
61
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
62
62
|
"rollup-plugin-terser": "^7.0.2",
|
|
63
|
-
"typescript": "^4.
|
|
63
|
+
"typescript": "^4.5.5"
|
|
64
64
|
}
|
|
65
65
|
}
|