Grow cache size dynamically
This commit is contained in:
@@ -27,7 +27,7 @@ import {toSize} from '../size.js';
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
||||
* @property {number} [cacheSize=128] Cache size.
|
||||
* @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least twice the number of tiles in the viewport.
|
||||
* @property {import("../extent.js").Extent} [extent]
|
||||
* @property {import("../format/Feature.js").default} [format] Feature format for tiles. Used and required by the default.
|
||||
* @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this
|
||||
@@ -509,6 +509,15 @@ class VectorTile extends UrlTile {
|
||||
Math.round(tileSize[1] * pixelRatio),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases the cache size if needed
|
||||
* @param {number} tileCount Minimum number of tiles needed.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
*/
|
||||
updateCacheSize(tileCount, projection) {
|
||||
super.updateCacheSize(tileCount * 2, projection);
|
||||
}
|
||||
}
|
||||
|
||||
export default VectorTile;
|
||||
|
||||
Reference in New Issue
Block a user