maplibre-gl-layer-control-tidop 0.0.12 → 0.0.14
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 +27 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +27 -0
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -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,29 @@ 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
|
+
e.stopPropagation();
|
|
2123
|
+
this.toggleStyleEditor(layerId);
|
|
2124
|
+
console.log(e);
|
|
2125
|
+
});
|
|
2126
|
+
return button;
|
|
2127
|
+
}
|
|
2101
2128
|
/**
|
|
2102
2129
|
* Toggle style editor for a layer
|
|
2103
2130
|
*/
|