Merge pull request #2385 from ahocevar/update-vectors-while-animating
Option to update vector layers while animating
This commit is contained in:
@@ -36,6 +36,7 @@ ol.layer.Vector = function(opt_options) {
|
||||
|
||||
delete baseOptions.style;
|
||||
delete baseOptions.renderBuffer;
|
||||
delete baseOptions.updateWhileAnimating;
|
||||
goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions));
|
||||
|
||||
/**
|
||||
@@ -61,6 +62,13 @@ ol.layer.Vector = function(opt_options) {
|
||||
|
||||
this.setStyle(options.style);
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.updateWhileAnimating_ = goog.isDef(options.updateWhileAnimating) ?
|
||||
options.updateWhileAnimating : false;
|
||||
|
||||
};
|
||||
goog.inherits(ol.layer.Vector, ol.layer.Layer);
|
||||
|
||||
@@ -113,6 +121,15 @@ ol.layer.Vector.prototype.getStyleFunction = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the rendered layer should be updated while
|
||||
* animating.
|
||||
*/
|
||||
ol.layer.Vector.prototype.getUpdateWhileAnimating = function() {
|
||||
return this.updateWhileAnimating_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {function(ol.Feature, ol.Feature):number|null|undefined} renderOrder
|
||||
* Render order.
|
||||
|
||||
@@ -169,7 +169,8 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
||||
frameState.attributions, vectorSource.getAttributions());
|
||||
this.updateLogos(frameState, vectorSource);
|
||||
|
||||
if (!this.dirty_ && (frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
||||
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
|
||||
frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
||||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,8 @@ ol.renderer.dom.VectorLayer.prototype.prepareFrame =
|
||||
frameState.attributions, vectorSource.getAttributions());
|
||||
this.updateLogos(frameState, vectorSource);
|
||||
|
||||
if (!this.dirty_ && (frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
||||
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
|
||||
frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
||||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,8 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
||||
frameState.attributions, vectorSource.getAttributions());
|
||||
this.updateLogos(frameState, vectorSource);
|
||||
|
||||
if (!this.dirty_ && (frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
||||
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
|
||||
frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
||||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user