@mapwhit/tilerenderer 1.1.0 → 1.1.1

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.
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.1.0",
2
+ "version": "1.1.1",
3
3
  "type": "module"
4
4
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mapwhit/tilerenderer",
3
3
  "description": "A WebGL interactive maps library",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./src/index.js",
@@ -75,10 +75,14 @@ class SourceCache extends Evented {
75
75
  }
76
76
 
77
77
  /**
78
- * Return true if no tile data is pending, tiles will not change unless
78
+ * Return `true` if no tile data is pending, tiles will not change unless
79
79
  * an additional API call is received.
80
+ * If `ignoreTilesLoading` is set, return `true` even when tiles are pending,
81
+ * otherwise there is no way to check that source is ready after loading style.
82
+ * Without `ignoreTilesLoading` the state of style being loaded or not depends on
83
+ * the tiles being in the process of loading or not.
80
84
  */
81
- loaded() {
85
+ loaded(ignoreTilesLoading) {
82
86
  if (this.#sourceErrored) {
83
87
  return true;
84
88
  }
@@ -87,6 +91,9 @@ class SourceCache extends Evented {
87
91
  return false;
88
92
  }
89
93
 
94
+ if (ignoreTilesLoading) {
95
+ return true;
96
+ }
90
97
  for (const tile of this._tiles.values()) {
91
98
  if (tile.state !== 'loaded' && tile.state !== 'errored') {
92
99
  return false;
@@ -244,7 +244,12 @@ class Style extends Evented {
244
244
  }
245
245
  }
246
246
 
247
- loaded() {
247
+ /**
248
+ * Returns `true` when style is loaded.
249
+ * @param {Boolean} ignoreTilesLoading set to `true` to check that style is loaded
250
+ * even when sources are loading tiles
251
+ */
252
+ loaded(ignoreTilesLoading) {
248
253
  if (!this._loaded) {
249
254
  return false;
250
255
  }
@@ -254,7 +259,7 @@ class Style extends Evented {
254
259
  }
255
260
 
256
261
  for (const id in this._sources) {
257
- if (!this._sources[id].loaded()) {
262
+ if (!this._sources[id].loaded(ignoreTilesLoading)) {
258
263
  return false;
259
264
  }
260
265
  }
package/src/ui/map.js CHANGED
@@ -696,7 +696,7 @@ class Map extends Camera {
696
696
  if (!this.style) {
697
697
  return warn.once('There is no style added to the map.');
698
698
  }
699
- return this.style.loaded();
699
+ return this.style.loaded(true);
700
700
  }
701
701
 
702
702
  /**