gralobe 1.0.8 → 1.0.9
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/gralobe.js +10 -3
- package/dist/gralobe.js.map +1 -1
- package/dist/gralobe.umd.cjs +2 -2
- package/dist/gralobe.umd.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/package.json +1 -1
package/dist/gralobe.js
CHANGED
|
@@ -5248,7 +5248,9 @@ class oo {
|
|
|
5248
5248
|
globe = null;
|
|
5249
5249
|
camera = null;
|
|
5250
5250
|
constructor(e, t) {
|
|
5251
|
-
this.sphereRadius = t, this.labelRenderer = new eo()
|
|
5251
|
+
this.sphereRadius = t, this.labelRenderer = new eo();
|
|
5252
|
+
const i = e.clientWidth || 800, n = e.clientHeight || 600;
|
|
5253
|
+
this.labelRenderer.setSize(i, n), this.labelRenderer.domElement.style.position = "absolute", this.labelRenderer.domElement.style.top = "0", this.labelRenderer.domElement.style.left = "0", this.labelRenderer.domElement.style.pointerEvents = "none", e.appendChild(this.labelRenderer.domElement), this.labelGroup = new S.Group(), this.injectStyles(), this.createLabels();
|
|
5252
5254
|
}
|
|
5253
5255
|
injectStyles() {
|
|
5254
5256
|
const e = document.createElement("style");
|
|
@@ -6083,6 +6085,9 @@ class _o {
|
|
|
6083
6085
|
currentStatistic = null;
|
|
6084
6086
|
animationId = null;
|
|
6085
6087
|
isDestroyed = !1;
|
|
6088
|
+
/** Promise that resolves when fully initialized */
|
|
6089
|
+
ready;
|
|
6090
|
+
resolveReady;
|
|
6086
6091
|
/**
|
|
6087
6092
|
* Create a new GlobeViz instance
|
|
6088
6093
|
* @param container CSS selector or HTMLElement
|
|
@@ -6099,11 +6104,13 @@ class _o {
|
|
|
6099
6104
|
...Pn,
|
|
6100
6105
|
...t,
|
|
6101
6106
|
effects: { ...Pn.effects, ...t.effects }
|
|
6102
|
-
}, this.
|
|
6107
|
+
}, this.ready = new Promise((i) => {
|
|
6108
|
+
this.resolveReady = i;
|
|
6109
|
+
}), this.init();
|
|
6103
6110
|
}
|
|
6104
6111
|
async init() {
|
|
6105
6112
|
const e = this.config.width || this.container.clientWidth || 800, t = this.config.height || this.container.clientHeight || 600;
|
|
6106
|
-
this.scene = new S.Scene(), this.scene.background = new S.Color(2066), this.camera = new S.PerspectiveCamera(50, e / t, 1, 1e3), this.camera.position.set(0, 0, this.config.initialView === "flat" ? 350 : 150), this.renderer = new S.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(e, t), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.container.appendChild(this.renderer.domElement), this.controls = new $r(this.camera, this.renderer.domElement), this.controls.enableDamping = !0, this.controls.minDistance = 80, this.controls.maxDistance = 400, this.choropleth = new La(), this.config.showLegend && (this.legend = new ka()), await this.createGlobe(), this.createStars(), this.config.effects.atmosphere && this.createAtmosphere(), this.countryLabels = new oo(this.container, Be), this.scene.add(this.countryLabels.getGroup()), this.globe && this.countryLabels.setGlobe(this.globe), this.countryLabels.setCamera(this.camera), this.countryLabels.setStyle(this.config.labels), this.exporter = new Qa(this.renderer, this.scene, this.camera), this.config.showControls && this.createGUI(), await this.choropleth.waitForLoad(), this.setStatistic(this.config.statistic), this.morph = this.config.initialView === "globe" ? 1 : 0, this.material && (this.material.uniforms.uMorph.value = this.morph), this.countryLabels?.setMorph(this.morph), window.addEventListener("resize", this.handleResize), window.addEventListener("keydown", this.handleKeydown), this.animate();
|
|
6113
|
+
this.scene = new S.Scene(), this.scene.background = new S.Color(2066), this.camera = new S.PerspectiveCamera(50, e / t, 1, 1e3), this.camera.position.set(0, 0, this.config.initialView === "flat" ? 350 : 150), this.renderer = new S.WebGLRenderer({ antialias: !0 }), this.renderer.setSize(e, t), this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)), this.container.appendChild(this.renderer.domElement), this.controls = new $r(this.camera, this.renderer.domElement), this.controls.enableDamping = !0, this.controls.minDistance = 80, this.controls.maxDistance = 400, this.choropleth = new La(), this.config.showLegend && (this.legend = new ka()), await this.createGlobe(), this.createStars(), this.config.effects.atmosphere && this.createAtmosphere(), this.countryLabels = new oo(this.container, Be), this.scene.add(this.countryLabels.getGroup()), this.globe && this.countryLabels.setGlobe(this.globe), this.countryLabels.setCamera(this.camera), this.countryLabels.setStyle(this.config.labels), this.exporter = new Qa(this.renderer, this.scene, this.camera), this.config.showControls && this.createGUI(), await this.choropleth.waitForLoad(), this.setStatistic(this.config.statistic), this.morph = this.config.initialView === "globe" ? 1 : 0, this.material && (this.material.uniforms.uMorph.value = this.morph), this.countryLabels?.setMorph(this.morph), window.addEventListener("resize", this.handleResize), window.addEventListener("keydown", this.handleKeydown), this.animate(), this.resolveReady();
|
|
6107
6114
|
}
|
|
6108
6115
|
async createGlobe() {
|
|
6109
6116
|
const e = await this.textureLoader.loadAsync(
|