@deck.gl/geo-layers 9.0.29 → 9.0.30

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.
@@ -67,7 +67,7 @@ export class Tileset2D {
67
67
  this.setOptions(this.opts);
68
68
  this.onTileLoad = tile => {
69
69
  this.opts.onTileLoad?.(tile);
70
- if (this.opts.maxCacheByteSize) {
70
+ if (this.opts.maxCacheByteSize != null) {
71
71
  this._cacheByteSize += tile.byteLength;
72
72
  this._resizeCache();
73
73
  }
@@ -325,16 +325,16 @@ export class Tileset2D {
325
325
  /* eslint-disable complexity */
326
326
  _resizeCache() {
327
327
  const { _cache, opts } = this;
328
- const maxCacheSize = opts.maxCacheSize ||
328
+ const maxCacheSize = opts.maxCacheSize ??
329
329
  // @ts-expect-error called only when selectedTiles is initialized
330
- (opts.maxCacheByteSize ? Infinity : DEFAULT_CACHE_SCALE * this.selectedTiles.length);
331
- const maxCacheByteSize = opts.maxCacheByteSize || Infinity;
330
+ (opts.maxCacheByteSize != null ? Infinity : DEFAULT_CACHE_SCALE * this.selectedTiles.length);
331
+ const maxCacheByteSize = opts.maxCacheByteSize ?? Infinity;
332
332
  const overflown = _cache.size > maxCacheSize || this._cacheByteSize > maxCacheByteSize;
333
333
  if (overflown) {
334
334
  for (const [id, tile] of _cache) {
335
335
  if (!tile.isVisible && !tile.isSelected) {
336
336
  // delete tile
337
- this._cacheByteSize -= opts.maxCacheByteSize ? tile.byteLength : 0;
337
+ this._cacheByteSize -= opts.maxCacheByteSize != null ? tile.byteLength : 0;
338
338
  _cache.delete(id);
339
339
  this.opts.onTileUnload?.(tile);
340
340
  }