maplibre-gl-raster 0.1.0 → 0.1.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.
@@ -16777,6 +16777,9 @@ function toLayerInfo(layer) {
16777
16777
  bandCount: layer.bandCount,
16778
16778
  bandNames: layer.bandNames ? new Map(layer.bandNames) : null,
16779
16779
  beforeId: layer.beforeId,
16780
+ bounds: layer.bounds ? { ...layer.bounds } : null,
16781
+ loading: layer.loading,
16782
+ error: layer.error,
16780
16783
  state: { ...layer.state }
16781
16784
  };
16782
16785
  }
@@ -17215,11 +17218,16 @@ var LayerManager = class {
17215
17218
  renderTile,
17216
17219
  beforeId: this._resolveBeforeId(layer.beforeId),
17217
17220
  onGeoTIFFLoad: (_tiff, options) => {
17221
+ const boundsArrived = !layer.bounds;
17218
17222
  layer.bounds = options.geographicBounds;
17219
17223
  if (layer.zoomTo) {
17220
17224
  layer.zoomTo = false;
17221
17225
  this._fitBounds(layer.bounds);
17222
17226
  }
17227
+ if (boundsArrived) this._emit({
17228
+ type: "rasterchange",
17229
+ layerId: layer.id
17230
+ });
17223
17231
  }
17224
17232
  });
17225
17233
  }
@@ -18462,7 +18470,7 @@ var RasterControl = class {
18462
18470
  this._mapContainer.appendChild(this._panel);
18463
18471
  this._layerManager = new LayerManager(map, { interleaved: this._options.interleaved });
18464
18472
  this._forwardLayerManagerEvents(this._layerManager);
18465
- const content = this._panel.querySelector(".plugin-control-content");
18473
+ const content = this._panel.querySelector(".mlr-control-content");
18466
18474
  const autoLoading = this._options.autoLoad && !!this._options.defaultUrl;
18467
18475
  if (content) this._panelUI = new PanelUI(content, this._layerManager, { defaultUrl: autoLoading ? "" : this._options.defaultUrl });
18468
18476
  if (autoLoading) this._layerManager.addRaster(this._options.defaultUrl).catch(() => {});
@@ -18712,13 +18720,13 @@ var RasterControl = class {
18712
18720
  */
18713
18721
  _createContainer() {
18714
18722
  const container = document.createElement("div");
18715
- container.className = `maplibregl-ctrl maplibregl-ctrl-group plugin-control${this._options.className ? ` ${this._options.className}` : ""}`;
18723
+ container.className = `maplibregl-ctrl maplibregl-ctrl-group mlr-control${this._options.className ? ` ${this._options.className}` : ""}`;
18716
18724
  const toggleBtn = document.createElement("button");
18717
- toggleBtn.className = "plugin-control-toggle";
18725
+ toggleBtn.className = "mlr-control-toggle";
18718
18726
  toggleBtn.type = "button";
18719
18727
  toggleBtn.setAttribute("aria-label", this._options.title);
18720
18728
  toggleBtn.innerHTML = `
18721
- <span class="plugin-control-icon">
18729
+ <span class="mlr-control-icon">
18722
18730
  <svg viewBox="0 0 24 24" width="22" height="22" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
18723
18731
  <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
18724
18732
  <circle cx="8.5" cy="8.5" r="1.5"/>
@@ -18738,15 +18746,15 @@ var RasterControl = class {
18738
18746
  */
18739
18747
  _createPanel() {
18740
18748
  const panel = document.createElement("div");
18741
- panel.className = "plugin-control-panel";
18749
+ panel.className = "mlr-control-panel";
18742
18750
  panel.style.width = `${this._options.panelWidth}px`;
18743
18751
  const header = document.createElement("div");
18744
- header.className = "plugin-control-header";
18752
+ header.className = "mlr-control-header";
18745
18753
  const title = document.createElement("span");
18746
- title.className = "plugin-control-title";
18754
+ title.className = "mlr-control-title";
18747
18755
  title.textContent = this._options.title;
18748
18756
  const closeBtn = document.createElement("button");
18749
- closeBtn.className = "plugin-control-close";
18757
+ closeBtn.className = "mlr-control-close";
18750
18758
  closeBtn.type = "button";
18751
18759
  closeBtn.setAttribute("aria-label", "Close panel");
18752
18760
  closeBtn.innerHTML = "&times;";
@@ -18754,7 +18762,7 @@ var RasterControl = class {
18754
18762
  header.appendChild(title);
18755
18763
  header.appendChild(closeBtn);
18756
18764
  const content = document.createElement("div");
18757
- content.className = "plugin-control-content";
18765
+ content.className = "mlr-control-content";
18758
18766
  panel.appendChild(header);
18759
18767
  panel.appendChild(content);
18760
18768
  return panel;
@@ -18798,7 +18806,7 @@ var RasterControl = class {
18798
18806
  */
18799
18807
  _updatePanelPosition() {
18800
18808
  if (!this._container || !this._panel || !this._mapContainer) return;
18801
- const button = this._container.querySelector(".plugin-control-toggle");
18809
+ const button = this._container.querySelector(".mlr-control-toggle");
18802
18810
  if (!button) return;
18803
18811
  const buttonRect = button.getBoundingClientRect();
18804
18812
  const mapRect = this._mapContainer.getBoundingClientRect();
@@ -18835,4 +18843,4 @@ var RasterControl = class {
18835
18843
  //#endregion
18836
18844
  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 };
18837
18845
 
18838
- //# sourceMappingURL=RasterControl-B7XdXYSu.js.map
18846
+ //# sourceMappingURL=RasterControl-C8Znszmf.js.map