maplibre-gl-layer-control-tidop 0.0.11 → 0.0.13

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/index.cjs CHANGED
@@ -814,10 +814,6 @@ class LayerControl {
814
814
  }
815
815
  this.buildLayerItems();
816
816
  }
817
- const actionButtons = this.createActionButtons();
818
- this.panel.insertBefore(actionButtons, this.panel.firstChild);
819
- const header = this.createPanelHeader();
820
- this.panel.insertBefore(header, this.panel.firstChild);
821
817
  if (!this.state.collapsed) {
822
818
  requestAnimationFrame(() => {
823
819
  this.updatePanelPosition();
@@ -1172,6 +1168,10 @@ class LayerControl {
1172
1168
  if (!this.state.collapsed) {
1173
1169
  panel.classList.add("expanded");
1174
1170
  }
1171
+ const header = this.createPanelHeader();
1172
+ panel.appendChild(header);
1173
+ const actionButtons = this.createActionButtons();
1174
+ panel.appendChild(actionButtons);
1175
1175
  return panel;
1176
1176
  }
1177
1177
  /**
@@ -1626,6 +1626,10 @@ class LayerControl {
1626
1626
  }
1627
1627
  }
1628
1628
  }
1629
+ const tidopButton = this.createTidopButton(layerId);
1630
+ if (tidopButton) {
1631
+ row.appendChild(tidopButton);
1632
+ }
1629
1633
  item.appendChild(row);
1630
1634
  if (this.enableContextMenu && layerId !== "Background") {
1631
1635
  row.addEventListener("contextmenu", (e) => {
@@ -2098,6 +2102,27 @@ class LayerControl {
2098
2102
  });
2099
2103
  return button;
2100
2104
  }
2105
+ createTidopButton(layerId) {
2106
+ if (layerId === "Background") {
2107
+ return null;
2108
+ }
2109
+ const layerState = this.state.layerStates[layerId];
2110
+ const isCustomLayer = (layerState == null ? void 0 : layerState.isCustomLayer) === true;
2111
+ const button = document.createElement("button");
2112
+ button.className = "layer-control-style-button layer-control-tidop-button-" + layerId;
2113
+ button.innerHTML = "⚙";
2114
+ if (isCustomLayer) {
2115
+ button.title = "Layer info (style editing not available)";
2116
+ button.setAttribute("aria-label", `Layer info for ${layerId}`);
2117
+ } else {
2118
+ button.title = "Edit layer style";
2119
+ button.setAttribute("aria-label", `Edit style for ${layerId}`);
2120
+ }
2121
+ button.addEventListener("click", (e) => {
2122
+ console.log(e);
2123
+ });
2124
+ return button;
2125
+ }
2101
2126
  /**
2102
2127
  * Toggle style editor for a layer
2103
2128
  */