gralobe 1.0.66 → 1.0.67
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 +15 -6
- package/dist/gralobe.js.map +1 -1
- package/dist/gralobe.umd.cjs +3 -3
- package/dist/gralobe.umd.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/package.json +15 -16
package/dist/gralobe.js
CHANGED
|
@@ -5771,9 +5771,9 @@ class so {
|
|
|
5771
5771
|
camera = null;
|
|
5772
5772
|
dataIds = /* @__PURE__ */ new Set();
|
|
5773
5773
|
constructor(e, t) {
|
|
5774
|
-
this.sphereRadius = t, this.labelRenderer = new wn();
|
|
5775
|
-
const
|
|
5776
|
-
this.labelRenderer.setSize(
|
|
5774
|
+
this.sphereRadius = t, window.getComputedStyle(e).position === "static" && (e.style.position = "relative"), this.labelRenderer = new wn();
|
|
5775
|
+
const r = e.clientWidth || 800, n = e.clientHeight || 600;
|
|
5776
|
+
this.labelRenderer.setSize(r, 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", this.labelRenderer.domElement.style.zIndex = "5", e.appendChild(this.labelRenderer.domElement), this.labelGroup = new S.Group(), this.injectStyles(), this.createLabels();
|
|
5777
5777
|
}
|
|
5778
5778
|
injectStyles() {
|
|
5779
5779
|
const e = document.createElement("style");
|
|
@@ -8147,6 +8147,9 @@ class Yo {
|
|
|
8147
8147
|
animationId = null;
|
|
8148
8148
|
isDestroyed = !1;
|
|
8149
8149
|
urbanPoints = null;
|
|
8150
|
+
resizeObserver = null;
|
|
8151
|
+
lastContainerWidth = 0;
|
|
8152
|
+
lastContainerHeight = 0;
|
|
8150
8153
|
/** Promise that resolves when fully initialized */
|
|
8151
8154
|
ready;
|
|
8152
8155
|
resolveReady;
|
|
@@ -8187,7 +8190,13 @@ class Yo {
|
|
|
8187
8190
|
}
|
|
8188
8191
|
), this.config.showLegend && (this.legend = new Mo(this.container)), await this.createGlobe(), this.createStars(), this.config.effects.atmosphere && this.createAtmosphere(), this.countryLabels = new so(this.container, ee), 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 Ao(this.renderer, this.scene, this.camera), this.legend && this.exporter.setLegendElement(this.legend.getElement()), this.countryLabels && this.exporter.setCountryLabels(this.countryLabels), (this.config.showControls || this.config.showDebug) && this.createGUI(), this.setupInteraction(), await this.choropleth.waitForLoad();
|
|
8189
8192
|
const i = this.choropleth.getFeatureLabels();
|
|
8190
|
-
i.length > 0 && this.addCustomLabels(i), 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),
|
|
8193
|
+
i.length > 0 && this.addCustomLabels(i), 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), this.resizeObserver = new ResizeObserver((r) => {
|
|
8194
|
+
if (!this.isDestroyed)
|
|
8195
|
+
for (const n of r) {
|
|
8196
|
+
const { width: a, height: o } = n.contentRect;
|
|
8197
|
+
(a !== this.lastContainerWidth || o !== this.lastContainerHeight) && (this.lastContainerWidth = a, this.lastContainerHeight = o, this.handleResize());
|
|
8198
|
+
}
|
|
8199
|
+
}), this.resizeObserver.observe(this.container), document.addEventListener("fullscreenchange", this.handleFullscreenChange), this.renderer.domElement.tabIndex = 0, this.renderer.domElement.style.outline = "none", this.renderer.domElement.addEventListener("mousedown", () => {
|
|
8191
8200
|
this.renderer.domElement.focus();
|
|
8192
8201
|
}), this.renderer.domElement.addEventListener("keydown", this.handleKeydown), this.animate(), (this.config.showToolbar || this.config.showControls) && (this.toolbar = new bt(this.container, {
|
|
8193
8202
|
onShowData: () => {
|
|
@@ -8196,7 +8205,7 @@ class Yo {
|
|
|
8196
8205
|
},
|
|
8197
8206
|
onToggleFullscreen: () => this.toggleFullscreen(),
|
|
8198
8207
|
onToggleProjection: () => this.toggleProjection()
|
|
8199
|
-
}), this.dataGrid = new co(this.container), this.toolbar.updateProjectionIcon(this.config.initialView === "globe"), this.toolbar.setShortcutsEnabled(!!this.config.enableShortcuts)), this.resolveReady();
|
|
8208
|
+
}), this.dataGrid = new co(this.container), this.toolbar.updateProjectionIcon(this.config.initialView === "globe"), this.toolbar.setShortcutsEnabled(!!this.config.enableShortcuts)), this.lastContainerWidth = this.container.clientWidth, this.lastContainerHeight = this.container.clientHeight, this.handleResize(), this.resolveReady();
|
|
8200
8209
|
} catch (e) {
|
|
8201
8210
|
console.error("GlobeViz init failed:", e), this.rejectReady(e);
|
|
8202
8211
|
}
|
|
@@ -9026,7 +9035,7 @@ class Yo {
|
|
|
9026
9035
|
return {};
|
|
9027
9036
|
}
|
|
9028
9037
|
destroy() {
|
|
9029
|
-
this.isDestroyed = !0, this.animationId && cancelAnimationFrame(this.animationId), window.removeEventListener("resize", this.handleResize), window.removeEventListener("keydown", this.handleKeydown), document.removeEventListener("fullscreenchange", this.handleFullscreenChange), this.categoryGUIs.forEach((e) => e.destroy()), this.categoryGUIs = [], this.legend?.dispose(), this.countryLabels?.dispose(), this.markerLayer?.dispose(), this.controls?.dispose(), this.toolbar?.dispose(), this.dataGrid?.dispose(), document.querySelectorAll(".lil-gui-tooltip").forEach((e) => e.remove()), this.globe?.geometry.dispose(), this.globe?.material?.dispose(), this.atmosphere?.geometry.dispose(), this.atmosphere?.material?.dispose(), this.stars?.geometry.dispose(), this.stars?.material?.dispose(), this.dataTexture?.dispose(), this.scene?.clear();
|
|
9038
|
+
this.isDestroyed = !0, this.animationId && cancelAnimationFrame(this.animationId), window.removeEventListener("resize", this.handleResize), window.removeEventListener("keydown", this.handleKeydown), document.removeEventListener("fullscreenchange", this.handleFullscreenChange), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.categoryGUIs.forEach((e) => e.destroy()), this.categoryGUIs = [], this.legend?.dispose(), this.countryLabels?.dispose(), this.markerLayer?.dispose(), this.controls?.dispose(), this.toolbar?.dispose(), this.dataGrid?.dispose(), document.querySelectorAll(".lil-gui-tooltip").forEach((e) => e.remove()), this.globe?.geometry.dispose(), this.globe?.material?.dispose(), this.atmosphere?.geometry.dispose(), this.atmosphere?.material?.dispose(), this.stars?.geometry.dispose(), this.stars?.material?.dispose(), this.dataTexture?.dispose(), this.scene?.clear();
|
|
9030
9039
|
try {
|
|
9031
9040
|
this.renderer?.dispose(), this.renderer?.forceContextLoss(), this.renderer?.getContext()?.getExtension("WEBGL_lose_context")?.loseContext();
|
|
9032
9041
|
} catch (e) {
|