maplibre-gl-layer-control 0.17.1 → 0.17.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/README.md +2 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +14 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -722,6 +722,8 @@ class LayerControl {
|
|
|
722
722
|
__publicField(this, "onLayerRename");
|
|
723
723
|
__publicField(this, "onLayerReorder");
|
|
724
724
|
__publicField(this, "onLayerRemove");
|
|
725
|
+
__publicField(this, "onBackgroundVisibilityChange");
|
|
726
|
+
__publicField(this, "onBackgroundOpacityChange");
|
|
725
727
|
// Background-layer visibility presets
|
|
726
728
|
__publicField(this, "enableBackgroundPresets");
|
|
727
729
|
__publicField(this, "backgroundPresetStorageKey");
|
|
@@ -742,6 +744,8 @@ class LayerControl {
|
|
|
742
744
|
this.onLayerRename = options.onLayerRename;
|
|
743
745
|
this.onLayerReorder = options.onLayerReorder;
|
|
744
746
|
this.onLayerRemove = options.onLayerRemove;
|
|
747
|
+
this.onBackgroundVisibilityChange = options.onBackgroundVisibilityChange;
|
|
748
|
+
this.onBackgroundOpacityChange = options.onBackgroundOpacityChange;
|
|
745
749
|
this.enableBackgroundPresets = options.enableBackgroundPresets !== false;
|
|
746
750
|
this.backgroundPresetStorageKey = options.backgroundPresetStorageKey || "maplibre-layer-control:background-presets";
|
|
747
751
|
this.onBackgroundPresetsChange = options.onBackgroundPresetsChange;
|
|
@@ -1904,6 +1908,7 @@ class LayerControl {
|
|
|
1904
1908
|
* Toggle visibility for all background layers (basemap layers)
|
|
1905
1909
|
*/
|
|
1906
1910
|
toggleBackgroundVisibility(visible) {
|
|
1911
|
+
var _a;
|
|
1907
1912
|
if (this.state.layerStates["Background"]) {
|
|
1908
1913
|
this.state.layerStates["Background"].visible = visible;
|
|
1909
1914
|
}
|
|
@@ -1931,11 +1936,13 @@ class LayerControl {
|
|
|
1931
1936
|
});
|
|
1932
1937
|
}
|
|
1933
1938
|
}
|
|
1939
|
+
(_a = this.onBackgroundVisibilityChange) == null ? void 0 : _a.call(this, visible);
|
|
1934
1940
|
}
|
|
1935
1941
|
/**
|
|
1936
1942
|
* Change opacity for all background layers (basemap layers)
|
|
1937
1943
|
*/
|
|
1938
1944
|
changeBackgroundOpacity(opacity) {
|
|
1945
|
+
var _a;
|
|
1939
1946
|
if (this.state.layerStates["Background"]) {
|
|
1940
1947
|
this.state.layerStates["Background"].opacity = opacity;
|
|
1941
1948
|
}
|
|
@@ -1948,6 +1955,7 @@ class LayerControl {
|
|
|
1948
1955
|
}
|
|
1949
1956
|
}
|
|
1950
1957
|
});
|
|
1958
|
+
(_a = this.onBackgroundOpacityChange) == null ? void 0 : _a.call(this, opacity);
|
|
1951
1959
|
}
|
|
1952
1960
|
// ===== Background Legend Methods =====
|
|
1953
1961
|
/**
|