Merge pull request #7831 from fredj/maxTilesLoading

Add new maxTilesLoading option to ol/PluggableMap
This commit is contained in:
Frédéric Junod
2018-02-15 15:57:20 +01:00
committed by GitHub
2 changed files with 16 additions and 1 deletions

View File

@@ -3649,6 +3649,7 @@ olx.layer.TileOptions.prototype.zIndex;
* map: (ol.PluggableMap|undefined),
* declutter: (boolean|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* maxTilesLoading: (number|undefined),
* updateWhileAnimating: (boolean|undefined),
* updateWhileInteracting: (boolean|undefined),
* visible: (boolean|undefined),
@@ -3763,6 +3764,12 @@ olx.layer.VectorOptions.prototype.declutter;
olx.layer.VectorOptions.prototype.style;
/**
* Maximum number tiles to load simultaneously. Default is `16`.
* @type {number|undefined}
*/
olx.layer.VectorOptions.prototype.maxTilesLoading;
/**
* When set to `true`, feature batches will be recreated during animations.
* This means that no vectors will be shown clipped, but the setting will have a

View File

@@ -76,6 +76,8 @@ export let MapOptions;
* Note that layers are rendered in the order supplied, so if you want, for
* example, a vector layer to appear on top of a tile layer, it must come
* after the tile layer.
* @param {number|undefined} options.maxTilesLoading Maximum number tiles to load
* simultaneously. Default is `16`.
* @param {boolean|undefined} options.loadTilesWhileAnimating When set to true,
* tiles will be loaded during animations. This may improve the user
* experience, but can also make animations stutter on devices with slow
@@ -115,6 +117,12 @@ const PluggableMap = function(options) {
const optionsInternal = createOptionsInternal(options);
/**
* @type {number}
* @private
*/
this.maxTilesLoading_ = options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;
/**
* @type {boolean}
* @private
@@ -945,7 +953,7 @@ PluggableMap.prototype.handlePostRender = function() {
// loading tiles that will quickly disappear from view.
const tileQueue = this.tileQueue_;
if (!tileQueue.isEmpty()) {
let maxTotalLoading = 16;
let maxTotalLoading = this.maxTilesLoading_;
let maxNewLoads = maxTotalLoading;
if (frameState) {
const hints = frameState.viewHints;