maplibre-gl-components 0.25.0 → 0.25.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/dist/{ControlGrid-C6BgPi2T.js → ControlGrid-BvZW0xA8.js} +92 -48
- package/dist/{ControlGrid-CLlaJrXV.cjs → ControlGrid-Ciu89fdF.cjs} +9 -9
- package/dist/{DuckDBConverter-rfnNPos-.cjs → DuckDBConverter-B1kwVTcu.cjs} +1 -1
- package/dist/{ShapefileConverter-BPS-MS0z.cjs → ShapefileConverter-Cli5FqLf.cjs} +1 -1
- package/dist/{geotiff-CdKVv3B3.cjs → geotiff-BFSWSzWO.cjs} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{lerc-C5i3vJZh.cjs → lerc-Vc9s1n7L.cjs} +1 -1
- package/dist/{maplibre-geoman.es-BVsCqtcC.cjs → maplibre-geoman.es-DczvASmd.cjs} +1 -1
- package/dist/maplibre-gl-components.css +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/types/lib/core/Colorbar.d.ts +1 -0
- package/dist/types/lib/core/Colorbar.d.ts.map +1 -1
- package/dist/types/lib/core/ColorbarGuiControl.d.ts +29 -2
- package/dist/types/lib/core/ColorbarGuiControl.d.ts.map +1 -1
- package/dist/types/lib/core/types.d.ts +20 -0
- package/dist/types/lib/core/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -921,17 +921,18 @@ var MF = [
|
|
|
921
921
|
_options;
|
|
922
922
|
_colorbarOptions;
|
|
923
923
|
_colorbars;
|
|
924
|
+
_stackOrientation = "vertical";
|
|
924
925
|
_state;
|
|
925
926
|
_eventHandlers = /* @__PURE__ */ new Map();
|
|
926
927
|
_map;
|
|
927
928
|
_handleZoom;
|
|
928
929
|
_zoomVisible = !0;
|
|
929
930
|
constructor(e) {
|
|
930
|
-
const { colorbars: t, position: n,
|
|
931
|
+
const { colorbars: t, position: n, stackOrientation: i, ...s } = e ?? {};
|
|
931
932
|
this._options = {
|
|
932
933
|
...TF,
|
|
933
|
-
...
|
|
934
|
-
}, this._colorbarOptions = t, this._colorbars = this._resolveColorbars(), this._state = this._createState();
|
|
934
|
+
...s
|
|
935
|
+
}, this._colorbarOptions = t, i && (this._stackOrientation = i), this._colorbars = this._resolveColorbars(), this._state = this._createState();
|
|
935
936
|
}
|
|
936
937
|
onAdd(e) {
|
|
937
938
|
return this._map = e, this._container = this._createContainer(), this._render(), this._handleZoom = () => this._checkZoomVisibility(), this._map.on("zoom", this._handleZoom), this._checkZoomVisibility(), this._container;
|
|
@@ -946,11 +947,11 @@ var MF = [
|
|
|
946
947
|
this._state.visible && (this._options.visible = !1, this._state = this._createState(), this._updateDisplayState(), this._emit("hide"));
|
|
947
948
|
}
|
|
948
949
|
update(e) {
|
|
949
|
-
const { colorbars: t, position: n,
|
|
950
|
+
const { colorbars: t, position: n, stackOrientation: i, ...s } = e;
|
|
950
951
|
this._options = {
|
|
951
952
|
...this._options,
|
|
952
|
-
...
|
|
953
|
-
}, t !== void 0 && (this._colorbarOptions = t), this._colorbars = this._resolveColorbars(), this._state = this._createState(), this._render(), this._emit("update");
|
|
953
|
+
...s
|
|
954
|
+
}, i !== void 0 && (this._stackOrientation = i), t !== void 0 && (this._colorbarOptions = t), this._colorbars = this._resolveColorbars(), this._state = this._createState(), this._render(), this._emit("update");
|
|
954
955
|
}
|
|
955
956
|
getState() {
|
|
956
957
|
return { ...this._state };
|
|
@@ -1099,17 +1100,17 @@ var MF = [
|
|
|
1099
1100
|
_render() {
|
|
1100
1101
|
if (!this._container) return;
|
|
1101
1102
|
this._container.innerHTML = "";
|
|
1102
|
-
const e = this._hasVisibleColorbars();
|
|
1103
|
+
const e = this._hasVisibleColorbars(), t = this._stackOrientation === "horizontal";
|
|
1103
1104
|
Object.assign(this._container.style, {
|
|
1104
1105
|
display: e ? "flex" : "none",
|
|
1105
|
-
flexDirection: "column",
|
|
1106
|
-
alignItems: "stretch",
|
|
1106
|
+
flexDirection: t ? "row" : "column",
|
|
1107
|
+
alignItems: t ? "flex-end" : "stretch",
|
|
1107
1108
|
gap: "8px",
|
|
1108
1109
|
background: "transparent",
|
|
1109
1110
|
boxShadow: "none",
|
|
1110
1111
|
padding: "0"
|
|
1111
|
-
}), this._colorbars.forEach((
|
|
1112
|
-
this._isColorbarVisible(
|
|
1112
|
+
}), this._colorbars.forEach((n, i) => {
|
|
1113
|
+
this._isColorbarVisible(n, i) && this._container?.appendChild(this._createColorbarElement(n));
|
|
1113
1114
|
});
|
|
1114
1115
|
}
|
|
1115
1116
|
}, BF = {
|
|
@@ -11676,7 +11677,8 @@ var TU = class {
|
|
|
11676
11677
|
fontSize: 12,
|
|
11677
11678
|
fontColor: "#333",
|
|
11678
11679
|
minzoom: 0,
|
|
11679
|
-
maxzoom: 24
|
|
11680
|
+
maxzoom: 24,
|
|
11681
|
+
stackOrientation: "vertical"
|
|
11680
11682
|
}, BU = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="none"><defs><linearGradient id="cbg" x1="0" y1="1" x2="0" y2="0"><stop offset="0%" stop-color="#440154"/><stop offset="25%" stop-color="#31688e"/><stop offset="50%" stop-color="#21918c"/><stop offset="75%" stop-color="#90d743"/><stop offset="100%" stop-color="#fde725"/></linearGradient></defs><rect x="8" y="2" width="8" height="20" rx="2" fill="url(#cbg)" stroke="currentColor" stroke-width="1.5"/></svg>', RU = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>', kU = class {
|
|
11681
11683
|
_container;
|
|
11682
11684
|
_button;
|
|
@@ -11689,7 +11691,7 @@ var TU = class {
|
|
|
11689
11691
|
_handleResize;
|
|
11690
11692
|
_zoomVisible = !0;
|
|
11691
11693
|
_colorbar;
|
|
11692
|
-
|
|
11694
|
+
_positionControls = /* @__PURE__ */ new Map();
|
|
11693
11695
|
_colorbarEntries = [];
|
|
11694
11696
|
_colorbarSelect;
|
|
11695
11697
|
_colormapSelect;
|
|
@@ -11698,6 +11700,7 @@ var TU = class {
|
|
|
11698
11700
|
_labelInput;
|
|
11699
11701
|
_unitsInput;
|
|
11700
11702
|
_orientationSelect;
|
|
11703
|
+
_stackSelect;
|
|
11701
11704
|
_positionSelect;
|
|
11702
11705
|
_addBtn;
|
|
11703
11706
|
_updateBtn;
|
|
@@ -11726,7 +11729,8 @@ var TU = class {
|
|
|
11726
11729
|
colorbarPosition: "bottom-right",
|
|
11727
11730
|
hasColorbar: !1,
|
|
11728
11731
|
selectedColorbarIndex: -1,
|
|
11729
|
-
colorbars: []
|
|
11732
|
+
colorbars: [],
|
|
11733
|
+
stackOrientation: this._options.stackOrientation
|
|
11730
11734
|
};
|
|
11731
11735
|
}
|
|
11732
11736
|
onAdd(e) {
|
|
@@ -11773,14 +11777,11 @@ var TU = class {
|
|
|
11773
11777
|
};
|
|
11774
11778
|
}
|
|
11775
11779
|
setState(e) {
|
|
11776
|
-
this._map && this.
|
|
11780
|
+
this._map && this._positionControls.forEach((s) => {
|
|
11777
11781
|
this._map.removeControl(s);
|
|
11778
|
-
});
|
|
11782
|
+
}), this._positionControls.clear();
|
|
11779
11783
|
const t = (e.colorbars ?? []).map((s) => ({ ...s }));
|
|
11780
|
-
this.
|
|
11781
|
-
const r = this._createColorbar(s);
|
|
11782
|
-
this._map.addControl(r, s.colorbarPosition), this._colorbars.push(r);
|
|
11783
|
-
});
|
|
11784
|
+
this._colorbarEntries = t, this._state.stackOrientation = e.stackOrientation ?? this._state.stackOrientation, this._map && new Set(t.map((s) => s.colorbarPosition)).forEach((s) => this._syncPositionControl(s));
|
|
11784
11785
|
const n = typeof e.selectedColorbarIndex == "number" && e.selectedColorbarIndex >= 0 && e.selectedColorbarIndex < t.length ? e.selectedColorbarIndex : t.length > 0 ? t.length - 1 : -1, i = n >= 0 ? t[n] : {
|
|
11785
11786
|
mode: e.mode ?? this._state.mode,
|
|
11786
11787
|
colormap: e.colormap ?? this._state.colormap,
|
|
@@ -11800,7 +11801,7 @@ var TU = class {
|
|
|
11800
11801
|
hasColorbar: t.length > 0,
|
|
11801
11802
|
selectedColorbarIndex: n,
|
|
11802
11803
|
colorbars: t.map((s) => ({ ...s }))
|
|
11803
|
-
}, this._colorbar = n >= 0 ? this.
|
|
11804
|
+
}, this._colorbar = n >= 0 ? this._positionControls.get(t[n].colorbarPosition) : void 0, this._applyEntryToForm(i), this._stackSelect && (this._stackSelect.value = this._state.stackOrientation), this._state.collapsed ? this._hidePanel() : this._showPanel(), this._container && (this._container.style.display = this._state.visible && this._zoomVisible ? "" : "none"), this._updateButtonStates(), this._emit("colorbarupdate"), this;
|
|
11804
11805
|
}
|
|
11805
11806
|
_createContainer() {
|
|
11806
11807
|
const e = document.createElement("div");
|
|
@@ -11831,9 +11832,9 @@ var TU = class {
|
|
|
11831
11832
|
this._modeCustomRadio.checked && this._setMode("custom");
|
|
11832
11833
|
}), o.appendChild(this._modeCustomRadio), o.appendChild(document.createTextNode(" Custom Colors")), r.appendChild(o), s.appendChild(r), n.appendChild(s), this._namedSection = document.createElement("div");
|
|
11833
11834
|
const l = this._createField("Colormap");
|
|
11834
|
-
this._colormapSelect = document.createElement("select"), this._colormapSelect.className = "colorbar-gui-select", Wx().forEach((
|
|
11835
|
-
const
|
|
11836
|
-
|
|
11835
|
+
this._colormapSelect = document.createElement("select"), this._colormapSelect.className = "colorbar-gui-select", Wx().forEach((S) => {
|
|
11836
|
+
const R = document.createElement("option");
|
|
11837
|
+
R.value = S, R.textContent = S, R.selected = S === this._state.colormap, this._colormapSelect.appendChild(R);
|
|
11837
11838
|
}), this._colormapSelect.addEventListener("change", () => {
|
|
11838
11839
|
this._state.colormap = this._colormapSelect.value, this._updatePreview();
|
|
11839
11840
|
}), l.appendChild(this._colormapSelect), this._namedSection.appendChild(l), n.appendChild(this._namedSection), this._customSection = document.createElement("div");
|
|
@@ -11863,9 +11864,9 @@ or #440154, #21918c, #fde725`, this._customColorsTextarea.addEventListener("inpu
|
|
|
11863
11864
|
const y = document.createElement("div");
|
|
11864
11865
|
y.className = "colorbar-gui-row";
|
|
11865
11866
|
const x = this._createField("Orientation");
|
|
11866
|
-
this._orientationSelect = document.createElement("select"), this._orientationSelect.className = "colorbar-gui-select", ["horizontal", "vertical"].forEach((
|
|
11867
|
-
const
|
|
11868
|
-
|
|
11867
|
+
this._orientationSelect = document.createElement("select"), this._orientationSelect.className = "colorbar-gui-select", ["horizontal", "vertical"].forEach((S) => {
|
|
11868
|
+
const R = document.createElement("option");
|
|
11869
|
+
R.value = S, R.textContent = S.charAt(0).toUpperCase() + S.slice(1), R.selected = S === this._state.orientation, this._orientationSelect.appendChild(R);
|
|
11869
11870
|
}), this._orientationSelect.addEventListener("change", () => {
|
|
11870
11871
|
this._state.orientation = this._orientationSelect.value;
|
|
11871
11872
|
}), x.appendChild(this._orientationSelect), y.appendChild(x);
|
|
@@ -11887,14 +11888,27 @@ or #440154, #21918c, #fde725`, this._customColorsTextarea.addEventListener("inpu
|
|
|
11887
11888
|
value: "bottom-right",
|
|
11888
11889
|
label: "Bottom Right"
|
|
11889
11890
|
}
|
|
11890
|
-
].forEach((
|
|
11891
|
-
const
|
|
11892
|
-
|
|
11891
|
+
].forEach((S) => {
|
|
11892
|
+
const R = document.createElement("option");
|
|
11893
|
+
R.value = S.value, R.textContent = S.label, R.selected = S.value === this._state.colorbarPosition, this._positionSelect.appendChild(R);
|
|
11893
11894
|
}), this._positionSelect.addEventListener("change", () => {
|
|
11894
11895
|
this._state.colorbarPosition = this._positionSelect.value;
|
|
11895
|
-
}), v.appendChild(this._positionSelect), y.appendChild(v), n.appendChild(y)
|
|
11896
|
-
const b =
|
|
11897
|
-
|
|
11896
|
+
}), v.appendChild(this._positionSelect), y.appendChild(v), n.appendChild(y);
|
|
11897
|
+
const b = this._createField("Stack multiple colorbars");
|
|
11898
|
+
this._stackSelect = document.createElement("select"), this._stackSelect.className = "colorbar-gui-select", [{
|
|
11899
|
+
value: "vertical",
|
|
11900
|
+
label: "Vertically"
|
|
11901
|
+
}, {
|
|
11902
|
+
value: "horizontal",
|
|
11903
|
+
label: "Horizontally"
|
|
11904
|
+
}].forEach((S) => {
|
|
11905
|
+
const R = document.createElement("option");
|
|
11906
|
+
R.value = S.value, R.textContent = S.label, R.selected = S.value === this._state.stackOrientation, this._stackSelect.appendChild(R);
|
|
11907
|
+
}), this._stackSelect.addEventListener("change", () => {
|
|
11908
|
+
this._state.stackOrientation = this._stackSelect.value, this._applyStackOrientation(), this._emit("colorbarupdate");
|
|
11909
|
+
}), b.appendChild(this._stackSelect), n.appendChild(b), this._addBtn = document.createElement("button"), this._addBtn.type = "button", this._addBtn.className = "colorbar-gui-add-btn", this._addBtn.textContent = "Add Colorbar", this._addBtn.addEventListener("click", () => this._addColorbar()), n.appendChild(this._addBtn);
|
|
11910
|
+
const w = document.createElement("button");
|
|
11911
|
+
return w.type = "button", w.className = "colorbar-gui-add-btn", w.textContent = "Update Selected Colorbar", w.style.display = this._state.hasColorbar ? "" : "none", w.addEventListener("click", () => this._updateColorbar()), n.appendChild(w), this._updateBtn = w, this._removeBtn = document.createElement("button"), this._removeBtn.type = "button", this._removeBtn.className = "colorbar-gui-remove-btn", this._removeBtn.textContent = "Remove Colorbar", this._removeBtn.style.display = this._state.hasColorbar ? "" : "none", this._removeBtn.addEventListener("click", () => this._removeColorbar()), n.appendChild(this._removeBtn), e.appendChild(n), e;
|
|
11898
11912
|
}
|
|
11899
11913
|
_createField(e) {
|
|
11900
11914
|
const t = document.createElement("div");
|
|
@@ -11943,9 +11957,9 @@ or #440154, #21918c, #fde725`, this._customColorsTextarea.addEventListener("inpu
|
|
|
11943
11957
|
_applyEntryToForm(e) {
|
|
11944
11958
|
this._state.mode = e.mode, this._state.colormap = e.colormap, this._state.customColors = e.customColors, this._state.vmin = e.vmin, this._state.vmax = e.vmax, this._state.label = e.label, this._state.units = e.units, this._state.orientation = e.orientation, this._state.colorbarPosition = e.colorbarPosition, this._modeNamedRadio && (this._modeNamedRadio.checked = e.mode === "named"), this._modeCustomRadio && (this._modeCustomRadio.checked = e.mode === "custom"), this._namedSection && (this._namedSection.style.display = e.mode === "named" ? "" : "none"), this._customSection && (this._customSection.style.display = e.mode === "custom" ? "" : "none"), this._colormapSelect && (this._colormapSelect.value = e.colormap), this._customColorsTextarea && (this._customColorsTextarea.value = e.customColors), this._vminInput && (this._vminInput.value = String(e.vmin)), this._vmaxInput && (this._vmaxInput.value = String(e.vmax)), this._labelInput && (this._labelInput.value = e.label), this._unitsInput && (this._unitsInput.value = e.units), this._orientationSelect && (this._orientationSelect.value = e.orientation), this._positionSelect && (this._positionSelect.value = e.colorbarPosition), this._updatePreview();
|
|
11945
11959
|
}
|
|
11946
|
-
|
|
11960
|
+
_buildColorbarItem(e) {
|
|
11947
11961
|
const t = e.mode === "custom" ? e.customColors.split(/[,\n]+/).map((n) => n.trim()).filter((n) => n.length > 0) : e.colormap;
|
|
11948
|
-
return
|
|
11962
|
+
return {
|
|
11949
11963
|
colormap: Array.isArray(t) && t.length === 0 ? [
|
|
11950
11964
|
"#440154",
|
|
11951
11965
|
"#21918c",
|
|
@@ -11955,8 +11969,36 @@ or #440154, #21918c, #fde725`, this._customColorsTextarea.addEventListener("inpu
|
|
|
11955
11969
|
vmax: e.vmax,
|
|
11956
11970
|
label: e.label,
|
|
11957
11971
|
units: e.units,
|
|
11958
|
-
orientation: e.orientation
|
|
11959
|
-
|
|
11972
|
+
orientation: e.orientation
|
|
11973
|
+
};
|
|
11974
|
+
}
|
|
11975
|
+
_entriesAtPosition(e) {
|
|
11976
|
+
return this._colorbarEntries.filter((t) => t.colorbarPosition === e);
|
|
11977
|
+
}
|
|
11978
|
+
_syncPositionControl(e) {
|
|
11979
|
+
if (!this._map) return;
|
|
11980
|
+
const t = this._entriesAtPosition(e).map((s) => this._buildColorbarItem(s)), n = this._positionControls.get(e);
|
|
11981
|
+
if (t.length === 0) {
|
|
11982
|
+
n && (this._map.removeControl(n), this._positionControls.delete(e));
|
|
11983
|
+
return;
|
|
11984
|
+
}
|
|
11985
|
+
if (n) {
|
|
11986
|
+
n.update({
|
|
11987
|
+
colorbars: t,
|
|
11988
|
+
stackOrientation: this._state.stackOrientation
|
|
11989
|
+
});
|
|
11990
|
+
return;
|
|
11991
|
+
}
|
|
11992
|
+
const i = new LF({
|
|
11993
|
+
colorbars: t,
|
|
11994
|
+
position: e,
|
|
11995
|
+
stackOrientation: this._state.stackOrientation
|
|
11996
|
+
});
|
|
11997
|
+
this._map.addControl(i, e), this._positionControls.set(e, i);
|
|
11998
|
+
}
|
|
11999
|
+
_applyStackOrientation() {
|
|
12000
|
+
this._positionControls.forEach((e) => {
|
|
12001
|
+
e.update({ stackOrientation: this._state.stackOrientation });
|
|
11960
12002
|
});
|
|
11961
12003
|
}
|
|
11962
12004
|
_selectColorbar(e) {
|
|
@@ -11964,7 +12006,7 @@ or #440154, #21918c, #fde725`, this._customColorsTextarea.addEventListener("inpu
|
|
|
11964
12006
|
this._state.selectedColorbarIndex = -1, this._colorbar = void 0, this._updateButtonStates();
|
|
11965
12007
|
return;
|
|
11966
12008
|
}
|
|
11967
|
-
e >= this._colorbarEntries.length || (this._state.selectedColorbarIndex = e, this._colorbar = this.
|
|
12009
|
+
e >= this._colorbarEntries.length || (this._state.selectedColorbarIndex = e, this._colorbar = this._positionControls.get(this._colorbarEntries[e].colorbarPosition), this._applyEntryToForm(this._colorbarEntries[e]), this._updateButtonStates());
|
|
11968
12010
|
}
|
|
11969
12011
|
_renderColorbarSelect() {
|
|
11970
12012
|
if (!this._colorbarSelect) return;
|
|
@@ -11977,30 +12019,32 @@ or #440154, #21918c, #fde725`, this._customColorsTextarea.addEventListener("inpu
|
|
|
11977
12019
|
}
|
|
11978
12020
|
_addColorbar() {
|
|
11979
12021
|
if (!this._map) return;
|
|
11980
|
-
const e = this._getFormEntry()
|
|
11981
|
-
this.
|
|
12022
|
+
const e = this._getFormEntry();
|
|
12023
|
+
this._colorbarEntries.push(e), this._syncPositionControl(e.colorbarPosition), this._colorbar = this._positionControls.get(e.colorbarPosition), this._state.hasColorbar = !0, this._state.selectedColorbarIndex = this._colorbarEntries.length - 1, this._state.colorbars = this._colorbarEntries.map((t) => ({ ...t })), this._updateButtonStates(), this._emit("colorbaradd");
|
|
11982
12024
|
}
|
|
11983
12025
|
_updateColorbar() {
|
|
11984
12026
|
if (!this._map) return;
|
|
11985
12027
|
const e = this._state.selectedColorbarIndex;
|
|
11986
|
-
if (e < 0 || e >= this.
|
|
12028
|
+
if (e < 0 || e >= this._colorbarEntries.length) {
|
|
11987
12029
|
this._addColorbar();
|
|
11988
12030
|
return;
|
|
11989
12031
|
}
|
|
11990
|
-
const t = this._getFormEntry();
|
|
11991
|
-
this.
|
|
11992
|
-
const n = this._createColorbar(t);
|
|
11993
|
-
this._map.addControl(n, t.colorbarPosition), this._colorbars[e] = n, this._colorbarEntries[e] = t, this._colorbar = n, this._state.colorbars = this._colorbarEntries.map((i) => ({ ...i })), this._emit("colorbarupdate"), this._updateButtonStates();
|
|
12032
|
+
const t = this._colorbarEntries[e].colorbarPosition, n = this._getFormEntry();
|
|
12033
|
+
this._colorbarEntries[e] = n, t !== n.colorbarPosition && this._syncPositionControl(t), this._syncPositionControl(n.colorbarPosition), this._colorbar = this._positionControls.get(n.colorbarPosition), this._state.colorbars = this._colorbarEntries.map((i) => ({ ...i })), this._emit("colorbarupdate"), this._updateButtonStates();
|
|
11994
12034
|
}
|
|
11995
12035
|
_removeColorbar() {
|
|
11996
12036
|
if (!this._map) return;
|
|
11997
12037
|
const e = this._state.selectedColorbarIndex;
|
|
11998
|
-
e < 0 || e >= this.
|
|
12038
|
+
if (e < 0 || e >= this._colorbarEntries.length) return;
|
|
12039
|
+
const [t] = this._colorbarEntries.splice(e, 1);
|
|
12040
|
+
this._syncPositionControl(t.colorbarPosition), this._state.hasColorbar = this._colorbarEntries.length > 0, this._state.selectedColorbarIndex = this._state.hasColorbar ? Math.min(e, this._colorbarEntries.length - 1) : -1;
|
|
12041
|
+
const n = this._state.selectedColorbarIndex;
|
|
12042
|
+
this._colorbar = n >= 0 ? this._positionControls.get(this._colorbarEntries[n].colorbarPosition) : void 0, this._state.colorbars = this._colorbarEntries.map((i) => ({ ...i })), n >= 0 && this._applyEntryToForm(this._colorbarEntries[n]), this._updateButtonStates(), this._emit("colorbarremove");
|
|
11999
12043
|
}
|
|
12000
12044
|
_removeAllColorbars() {
|
|
12001
|
-
this._map &&
|
|
12045
|
+
this._map && this._positionControls.forEach((e) => {
|
|
12002
12046
|
this._map.removeControl(e);
|
|
12003
|
-
}), this.
|
|
12047
|
+
}), this._positionControls.clear(), this._colorbarEntries = [], this._colorbar = void 0, this._state.hasColorbar = !1, this._state.selectedColorbarIndex = -1, this._state.colorbars = [], this._updateButtonStates();
|
|
12004
12048
|
}
|
|
12005
12049
|
_updateButtonStates() {
|
|
12006
12050
|
this._addBtn && (this._addBtn.textContent = "Add Colorbar");
|