maplibre-gl-raster 0.1.1 → 0.1.3
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.
|
@@ -18470,7 +18470,7 @@ var RasterControl = class {
|
|
|
18470
18470
|
this._mapContainer.appendChild(this._panel);
|
|
18471
18471
|
this._layerManager = new LayerManager(map, { interleaved: this._options.interleaved });
|
|
18472
18472
|
this._forwardLayerManagerEvents(this._layerManager);
|
|
18473
|
-
const content = this._panel.querySelector(".
|
|
18473
|
+
const content = this._panel.querySelector(".mlr-control-content");
|
|
18474
18474
|
const autoLoading = this._options.autoLoad && !!this._options.defaultUrl;
|
|
18475
18475
|
if (content) this._panelUI = new PanelUI(content, this._layerManager, { defaultUrl: autoLoading ? "" : this._options.defaultUrl });
|
|
18476
18476
|
if (autoLoading) this._layerManager.addRaster(this._options.defaultUrl).catch(() => {});
|
|
@@ -18720,13 +18720,13 @@ var RasterControl = class {
|
|
|
18720
18720
|
*/
|
|
18721
18721
|
_createContainer() {
|
|
18722
18722
|
const container = document.createElement("div");
|
|
18723
|
-
container.className = `maplibregl-ctrl maplibregl-ctrl-group
|
|
18723
|
+
container.className = `maplibregl-ctrl maplibregl-ctrl-group mlr-control${this._options.className ? ` ${this._options.className}` : ""}`;
|
|
18724
18724
|
const toggleBtn = document.createElement("button");
|
|
18725
|
-
toggleBtn.className = "
|
|
18725
|
+
toggleBtn.className = "mlr-control-toggle";
|
|
18726
18726
|
toggleBtn.type = "button";
|
|
18727
18727
|
toggleBtn.setAttribute("aria-label", this._options.title);
|
|
18728
18728
|
toggleBtn.innerHTML = `
|
|
18729
|
-
<span class="
|
|
18729
|
+
<span class="mlr-control-icon">
|
|
18730
18730
|
<svg viewBox="0 0 24 24" width="22" height="22" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
18731
18731
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
|
|
18732
18732
|
<circle cx="8.5" cy="8.5" r="1.5"/>
|
|
@@ -18746,15 +18746,15 @@ var RasterControl = class {
|
|
|
18746
18746
|
*/
|
|
18747
18747
|
_createPanel() {
|
|
18748
18748
|
const panel = document.createElement("div");
|
|
18749
|
-
panel.className = "
|
|
18749
|
+
panel.className = "mlr-control-panel";
|
|
18750
18750
|
panel.style.width = `${this._options.panelWidth}px`;
|
|
18751
18751
|
const header = document.createElement("div");
|
|
18752
|
-
header.className = "
|
|
18752
|
+
header.className = "mlr-control-header";
|
|
18753
18753
|
const title = document.createElement("span");
|
|
18754
|
-
title.className = "
|
|
18754
|
+
title.className = "mlr-control-title";
|
|
18755
18755
|
title.textContent = this._options.title;
|
|
18756
18756
|
const closeBtn = document.createElement("button");
|
|
18757
|
-
closeBtn.className = "
|
|
18757
|
+
closeBtn.className = "mlr-control-close";
|
|
18758
18758
|
closeBtn.type = "button";
|
|
18759
18759
|
closeBtn.setAttribute("aria-label", "Close panel");
|
|
18760
18760
|
closeBtn.innerHTML = "×";
|
|
@@ -18762,7 +18762,7 @@ var RasterControl = class {
|
|
|
18762
18762
|
header.appendChild(title);
|
|
18763
18763
|
header.appendChild(closeBtn);
|
|
18764
18764
|
const content = document.createElement("div");
|
|
18765
|
-
content.className = "
|
|
18765
|
+
content.className = "mlr-control-content";
|
|
18766
18766
|
panel.appendChild(header);
|
|
18767
18767
|
panel.appendChild(content);
|
|
18768
18768
|
return panel;
|
|
@@ -18806,7 +18806,7 @@ var RasterControl = class {
|
|
|
18806
18806
|
*/
|
|
18807
18807
|
_updatePanelPosition() {
|
|
18808
18808
|
if (!this._container || !this._panel || !this._mapContainer) return;
|
|
18809
|
-
const button = this._container.querySelector(".
|
|
18809
|
+
const button = this._container.querySelector(".mlr-control-toggle");
|
|
18810
18810
|
if (!button) return;
|
|
18811
18811
|
const buttonRect = button.getBoundingClientRect();
|
|
18812
18812
|
const mapRect = this._mapContainer.getBoundingClientRect();
|
|
@@ -18816,31 +18816,35 @@ var RasterControl = class {
|
|
|
18816
18816
|
const buttonLeft = buttonRect.left - mapRect.left;
|
|
18817
18817
|
const buttonRight = mapRect.right - buttonRect.right;
|
|
18818
18818
|
const panelGap = 5;
|
|
18819
|
+
const edgeMargin = 10;
|
|
18819
18820
|
this._panel.style.top = "";
|
|
18820
18821
|
this._panel.style.bottom = "";
|
|
18821
18822
|
this._panel.style.left = "";
|
|
18822
18823
|
this._panel.style.right = "";
|
|
18824
|
+
const anchorOffset = (position === "top-left" || position === "top-right" ? buttonTop : buttonBottom) + buttonRect.height + panelGap;
|
|
18823
18825
|
switch (position) {
|
|
18824
18826
|
case "top-left":
|
|
18825
|
-
this._panel.style.top = `${
|
|
18827
|
+
this._panel.style.top = `${anchorOffset}px`;
|
|
18826
18828
|
this._panel.style.left = `${buttonLeft}px`;
|
|
18827
18829
|
break;
|
|
18828
18830
|
case "top-right":
|
|
18829
|
-
this._panel.style.top = `${
|
|
18831
|
+
this._panel.style.top = `${anchorOffset}px`;
|
|
18830
18832
|
this._panel.style.right = `${buttonRight}px`;
|
|
18831
18833
|
break;
|
|
18832
18834
|
case "bottom-left":
|
|
18833
|
-
this._panel.style.bottom = `${
|
|
18835
|
+
this._panel.style.bottom = `${anchorOffset}px`;
|
|
18834
18836
|
this._panel.style.left = `${buttonLeft}px`;
|
|
18835
18837
|
break;
|
|
18836
18838
|
case "bottom-right":
|
|
18837
|
-
this._panel.style.bottom = `${
|
|
18839
|
+
this._panel.style.bottom = `${anchorOffset}px`;
|
|
18838
18840
|
this._panel.style.right = `${buttonRight}px`;
|
|
18839
18841
|
break;
|
|
18840
18842
|
}
|
|
18843
|
+
const available = Math.max(160, mapRect.height - anchorOffset - edgeMargin);
|
|
18844
|
+
this._panel.style.maxHeight = `min(80vh, 720px, ${available}px)`;
|
|
18841
18845
|
}
|
|
18842
18846
|
};
|
|
18843
18847
|
//#endregion
|
|
18844
18848
|
export { colormaps_default as _, debounce as a, throttle as c, percentileFromHistogram as d, readBandNames as f, COLORMAP_ROW_COUNT as g, COLORMAP_OPTIONS as h, classNames as i, MAX_SAMPLE_TILES as l, COLORMAP_NAMES as m, PALETTE_COLORMAP as n, formatNumericValue as o, loadGeoTIFF as p, clamp as r, generateId as s, RasterControl as t, computeAutoStats as u };
|
|
18845
18849
|
|
|
18846
|
-
//# sourceMappingURL=RasterControl-
|
|
18850
|
+
//# sourceMappingURL=RasterControl-D2NAn2EJ.js.map
|