gralobe 1.0.21 → 1.0.22
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 -8
- package/dist/gralobe.js.map +1 -1
- package/dist/gralobe.umd.cjs +1 -1
- package/dist/gralobe.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/gralobe.js
CHANGED
|
@@ -4832,22 +4832,24 @@ class eo {
|
|
|
4832
4832
|
}
|
|
4833
4833
|
/**
|
|
4834
4834
|
* Draw country labels onto canvas
|
|
4835
|
+
* @param camera - Optional camera to use for projection (defaults to main camera)
|
|
4835
4836
|
*/
|
|
4836
|
-
drawCountryLabelsOnCanvas(e, t, i) {
|
|
4837
|
+
drawCountryLabelsOnCanvas(e, t, i, n) {
|
|
4837
4838
|
if (this.countryLabels)
|
|
4838
4839
|
try {
|
|
4839
|
-
this.countryLabels.getVisibleLabelsForCanvas(this.camera, t, i).forEach((
|
|
4840
|
-
e.save(), e.globalAlpha =
|
|
4840
|
+
this.countryLabels.getVisibleLabelsForCanvas(n || this.camera, t, i).forEach((s) => {
|
|
4841
|
+
e.save(), e.globalAlpha = s.opacity, e.font = "bold 12px Arial, sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.strokeStyle = "rgba(0, 0, 0, 0.8)", e.lineWidth = 3, e.strokeText(s.text, s.x, s.y), e.fillStyle = "#ffffff", e.fillText(s.text, s.x, s.y), e.restore();
|
|
4841
4842
|
});
|
|
4842
|
-
} catch (
|
|
4843
|
-
console.warn("Failed to draw country labels:",
|
|
4843
|
+
} catch (r) {
|
|
4844
|
+
console.warn("Failed to draw country labels:", r);
|
|
4844
4845
|
}
|
|
4845
4846
|
}
|
|
4846
4847
|
/**
|
|
4847
4848
|
* Draw all overlays (legend + country labels) onto canvas
|
|
4849
|
+
* @param camera - Optional camera to use for label projection (defaults to main camera)
|
|
4848
4850
|
*/
|
|
4849
|
-
drawOverlaysOnCanvas(e, t, i) {
|
|
4850
|
-
this.drawCountryLabelsOnCanvas(e, t, i), this.drawLegendOnCanvas(e, t, i);
|
|
4851
|
+
drawOverlaysOnCanvas(e, t, i, n) {
|
|
4852
|
+
this.drawCountryLabelsOnCanvas(e, t, i, n), this.drawLegendOnCanvas(e, t, i);
|
|
4851
4853
|
}
|
|
4852
4854
|
/**
|
|
4853
4855
|
* Draw legend onto canvas at specified position
|
|
@@ -4895,7 +4897,7 @@ class eo {
|
|
|
4895
4897
|
});
|
|
4896
4898
|
r.setSize(t, i), r.setPixelRatio(1);
|
|
4897
4899
|
const s = this.camera.clone();
|
|
4898
|
-
s.aspect = t / i, s.updateProjectionMatrix(), r.render(this.scene, s), this.compositeCanvas.width = t, this.compositeCanvas.height = i, this.compositeCtx.drawImage(r.domElement, 0, 0), this.drawOverlaysOnCanvas(this.compositeCtx, t, i);
|
|
4900
|
+
s.aspect = t / i, s.updateProjectionMatrix(), r.render(this.scene, s), this.compositeCanvas.width = t, this.compositeCanvas.height = i, this.compositeCtx.drawImage(r.domElement, 0, 0), this.drawOverlaysOnCanvas(this.compositeCtx, t, i, s);
|
|
4899
4901
|
const o = this.compositeCanvas.toDataURL("image/png");
|
|
4900
4902
|
r.dispose();
|
|
4901
4903
|
const l = n ? `${n}.png` : `globe-${Date.now()}.png`;
|