gralobe 1.0.42 → 1.0.44

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 CHANGED
@@ -4201,7 +4201,8 @@ class it {
4201
4201
  url: e?.url || "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",
4202
4202
  objectName: e?.objectName || "countries",
4203
4203
  disableNormalization: e?.disableNormalization || !1,
4204
- idProperty: e?.idProperty
4204
+ idProperty: e?.idProperty,
4205
+ labelProperty: e?.labelProperty
4205
4206
  }, this.statsMap = /* @__PURE__ */ new Map(), Rr.forEach((n) => {
4206
4207
  this.statsMap.set(n.id, n);
4207
4208
  }), this.loadCountries();
@@ -4275,8 +4276,8 @@ class it {
4275
4276
  this.featureLabels = this.countries.map((e) => {
4276
4277
  const t = this.computeCentroid(e);
4277
4278
  if (!t) return null;
4278
- let i = e.properties?.name || e.properties?.NAME || e.properties?.Name || e.properties?.label || e.properties?.LABEL || "";
4279
- if (!i && e.properties) {
4279
+ let i = "";
4280
+ if (this.topologyConfig?.labelProperty && (i = e.properties?.[this.topologyConfig.labelProperty] || ""), i || (i = e.properties?.name || e.properties?.NAME || e.properties?.Name || e.properties?.label || e.properties?.LABEL || ""), !i && e.properties) {
4280
4281
  const n = Object.keys(e.properties);
4281
4282
  for (const r of n) {
4282
4283
  const s = r.toLowerCase(), o = e.properties[r];
@@ -4886,21 +4887,24 @@ class $a {
4886
4887
  */
4887
4888
  addCustomLabels(e) {
4888
4889
  e.forEach((t) => {
4889
- const i = t.size || "small", n = document.createElement("div");
4890
- n.className = `country-label hidden size-${i} custom-label`, n.textContent = t.name;
4891
- const r = new _n(n), s = {
4890
+ if (this.labels.some(
4891
+ (h) => h.country.id === t.id || h.country.name.toLowerCase() === t.name.toLowerCase()
4892
+ )) return;
4893
+ const n = t.size || "small", r = document.createElement("div");
4894
+ r.className = `country-label hidden size-${n} custom-label`, r.textContent = t.name;
4895
+ const s = new _n(r), o = {
4892
4896
  id: t.id,
4893
4897
  code: t.id,
4894
4898
  name: t.name
4895
- }, o = {
4896
- element: n,
4897
- object: r,
4898
- country: s,
4899
+ }, l = {
4900
+ element: r,
4901
+ object: s,
4902
+ country: o,
4899
4903
  lat: t.lat,
4900
4904
  lon: t.lon,
4901
- sizeCategory: i
4905
+ sizeCategory: n
4902
4906
  };
4903
- this.labelGroup.add(r), this.labels.push(o), this.dataIds.add(t.id), this.updateLabelPosition(r, o, this.currentMorph);
4907
+ this.labelGroup.add(s), this.labels.push(l), this.dataIds.add(t.id), this.updateLabelPosition(s, l, this.currentMorph);
4904
4908
  }), this.setStyle(this.currentStyle);
4905
4909
  }
4906
4910
  /**
@@ -6776,11 +6780,11 @@ class wo {
6776
6780
  }
6777
6781
  async init() {
6778
6782
  const e = this.config.width || this.container.clientWidth || 800, t = this.config.height || this.container.clientHeight || 600;
6779
- this.scene = new A.Scene(), this.scene.background = new A.Color(2066), this.camera = new A.PerspectiveCamera(50, e / t, 1, 1e3), this.camera.position.set(
6783
+ this.scene = new A.Scene(), this.scene.background = new A.Color(2066), this.camera = new A.PerspectiveCamera(50, e / t, 0.1, 1e3), this.camera.position.set(
6780
6784
  0,
6781
6785
  0,
6782
6786
  this.config.initialView === "flat" ? 350 : 150
6783
- ), this.renderer = new A.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 ga(this.camera, this.renderer.domElement), this.controls.enableDamping = !0, this.controls.minDistance = 10, this.controls.maxDistance = 400;
6787
+ ), this.renderer = new A.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 ga(this.camera, this.renderer.domElement), this.controls.enableDamping = !0, this.controls.minDistance = 2, this.controls.maxDistance = 400;
6784
6788
  try {
6785
6789
  this.choropleth = new it(
6786
6790
  this.config.topology,
@@ -6924,6 +6928,7 @@ class wo {
6924
6928
  "minimal",
6925
6929
  "major",
6926
6930
  "all",
6931
+ "all-countries",
6927
6932
  "data"
6928
6933
  ];
6929
6934
  this.gui.addFolder("Display").add({ labels: this.config.labels }, "labels", s).name("Labels").onChange((l) => this.setLabels(l)), this.gui.add(this.config, "autoRotate").name("Auto Rotate"), this.gui.addFolder("Export").add(