maplibre-gl-raster 0.14.8 → 0.14.9

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.
@@ -18316,7 +18316,8 @@ var CogTilerEngine = class {
18316
18316
  _applied = /* @__PURE__ */ new Map();
18317
18317
  /** Monotonic tile-URL version per layer, bumped to refetch on settings edits. */
18318
18318
  _versions = /* @__PURE__ */ new Map();
18319
- _onStyleData = null;
18319
+ _onStyleReady = null;
18320
+ _onStyleLoading = null;
18320
18321
  /** Latches true once the style has loaded. After that, `isStyleLoaded()` may
18321
18322
  * dip false again while sources load - which must NOT re-gate later syncs, or
18322
18323
  * stats-driven re-renders would be lost. */
@@ -18358,9 +18359,14 @@ var CogTilerEngine = class {
18358
18359
  /** Tears the engine down: removes its layers, the protocol, and all caches. */
18359
18360
  destroy() {
18360
18361
  this._destroyed = true;
18361
- if (this._onStyleData) {
18362
- this._map.off("styledata", this._onStyleData);
18363
- this._onStyleData = null;
18362
+ if (this._onStyleReady) {
18363
+ this._map.off("styledata", this._onStyleReady);
18364
+ this._map.off("style.load", this._onStyleReady);
18365
+ this._onStyleReady = null;
18366
+ }
18367
+ if (this._onStyleLoading) {
18368
+ this._map.off("styledataloading", this._onStyleLoading);
18369
+ this._onStyleLoading = null;
18364
18370
  }
18365
18371
  this.clear();
18366
18372
  if (this._protocolRegistered) {
@@ -18373,25 +18379,33 @@ var CogTilerEngine = class {
18373
18379
  this._assetSources.clear();
18374
18380
  this._versions.clear();
18375
18381
  }
18376
- /** Reconciles the map with {@link _layers}, deferring until the style is
18377
- * loaded and the wasm module is ready. */
18382
+ /** Reconciles the map with {@link _layers}. COGs open as soon as the wasm
18383
+ * module is ready so their bounds are available even while the map style is
18384
+ * loading; only MapLibre source/layer mutations wait for the style. */
18378
18385
  _apply() {
18379
18386
  if (this._destroyed) return;
18380
- if (!this._onStyleData) {
18381
- this._onStyleData = () => {
18387
+ if (!this._onStyleReady) {
18388
+ this._onStyleReady = () => {
18382
18389
  if (this._destroyed || !this._map.isStyleLoaded()) return;
18383
18390
  this._styleReady = true;
18384
18391
  this._apply();
18385
18392
  };
18386
- this._map.on("styledata", this._onStyleData);
18393
+ this._map.on("styledata", this._onStyleReady);
18394
+ this._map.on("style.load", this._onStyleReady);
18395
+ this._onStyleLoading = () => {
18396
+ this._styleReady = false;
18397
+ };
18398
+ this._map.on("styledataloading", this._onStyleLoading);
18387
18399
  }
18388
- if (!this._styleReady) if (this._map.isStyleLoaded()) this._styleReady = true;
18389
- else return;
18400
+ const desired = this._layers;
18401
+ const desiredIds = new Set(desired.map((layer) => layer.id));
18402
+ for (const id of this._sources.keys()) if (!desiredIds.has(id)) this._sources.delete(id);
18390
18403
  const mod = this._ensureModule();
18391
18404
  if (!mod) return;
18405
+ for (const layer of desired) if (!layer.assets) this._ensureSource(layer, mod);
18406
+ if (!this._styleReady) if (this._map.isStyleLoaded()) this._styleReady = true;
18407
+ else return;
18392
18408
  this._ensureProtocol();
18393
- const desired = this._layers;
18394
- const desiredIds = new Set(desired.map((l) => l.id));
18395
18409
  for (const id of [...this._registry.keys()]) if (!desiredIds.has(id)) this._dropLayer(id);
18396
18410
  for (const layer of desired) this._applyLayer(layer, mod);
18397
18411
  this._reorder(desired);
@@ -23193,4 +23207,4 @@ var RasterControl = class {
23193
23207
  //#endregion
23194
23208
  export { Photometric as $, DEFAULT_TITILER_ENDPOINT as A, COLORMAP_ROW_COUNT as B, throttle as C, loadVrt as D, isVrtUrl as E, loadColormapSprite as F, statsForBand as G, colormaps_default as H, sampleColormapStops as I, mergeAutoStats as J, MAX_SAMPLE_TILES as K, COLORMAP_DISPLAY_NAMES as L, isMosaicJsonUrl as M, PALETTE_COLORMAP as N, parseVrt as O, isKnownColormap as P, Compression as Q, COLORMAP_NAMES as R, generateId as S, isVrtFile as T, DEFAULT_INDEX_RANGE as U, colormapDisplayName as V, autoRangeFor as W, percentileFromHistogram as X, mergeBandStats as Y, readBandNames as Z, parseMosaic as _, NORMALIZED_DIFFERENCE_INDICES as a, debounce as b, readPixelValues as c, MAX_MOSAIC_ASSETS as d, PlanarConfiguration as et, MosaicUnsupportedError as f, mosaicMinZoom as g, mosaicInitialView as h, CUSTOM_NORMALIZED_DIFFERENCE as i, createResilientEpsgResolver as it, TITILER_TMS as j, loadGeoTIFF as k, DEFAULT_ENGINE as l, loadMosaic as m, Colorbar as n, SampleFormat as nt, guessBandForRole as o, assetUrlToHttps as p, computeAutoStats as q, CUSTOM_INDEX_ID as r, TiffTag as rt, indexById as s, RasterControl as t, Predictor as tt, LayerManager as u, clamp as v, VrtUnsupportedError as w, formatNumericValue as x, classNames as y, COLORMAP_OPTIONS as z };
23195
23209
 
23196
- //# sourceMappingURL=RasterControl-BiPVKYvs.js.map
23210
+ //# sourceMappingURL=RasterControl-CPtuFlxg.js.map