Merge pull request #3446 from elemoine/updatewhileinteracting

Add updateWhileInteracting to olx.layer.VectorOptions
This commit is contained in:
Éric Lemoine
2015-04-02 09:14:53 +02:00
5 changed files with 48 additions and 9 deletions

View File

@@ -37,6 +37,7 @@ ol.layer.Vector = function(opt_options) {
delete baseOptions.style;
delete baseOptions.renderBuffer;
delete baseOptions.updateWhileAnimating;
delete baseOptions.updateWhileInteracting;
goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions));
/**
@@ -69,6 +70,13 @@ ol.layer.Vector = function(opt_options) {
this.updateWhileAnimating_ = goog.isDef(options.updateWhileAnimating) ?
options.updateWhileAnimating : false;
/**
* @type {boolean}
* @private
*/
this.updateWhileInteracting_ = goog.isDef(options.updateWhileInteracting) ?
options.updateWhileInteracting : false;
};
goog.inherits(ol.layer.Vector, ol.layer.Layer);
@@ -130,6 +138,15 @@ ol.layer.Vector.prototype.getUpdateWhileAnimating = function() {
};
/**
* @return {boolean} Whether the rendered layer should be updated while
* interacting.
*/
ol.layer.Vector.prototype.getUpdateWhileInteracting = function() {
return this.updateWhileInteracting_;
};
/**
* @param {function(ol.Feature, ol.Feature):number|null|undefined} renderOrder
* Render order.

View File

@@ -169,9 +169,13 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
frameState.attributions, vectorSource.getAttributions());
this.updateLogos(frameState, vectorSource);
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
frameState.viewHints[ol.ViewHint.ANIMATING] ||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
if (!this.dirty_ && (!updateWhileAnimating && animating) ||
(!updateWhileInteracting && interacting)) {
return true;
}

View File

@@ -230,9 +230,13 @@ ol.renderer.dom.VectorLayer.prototype.prepareFrame =
frameState.attributions, vectorSource.getAttributions());
this.updateLogos(frameState, vectorSource);
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
frameState.viewHints[ol.ViewHint.ANIMATING] ||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
if (!this.dirty_ && (!updateWhileAnimating && animating) ||
(!updateWhileInteracting && interacting)) {
return true;
}

View File

@@ -202,9 +202,13 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
frameState.attributions, vectorSource.getAttributions());
this.updateLogos(frameState, vectorSource);
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
frameState.viewHints[ol.ViewHint.ANIMATING] ||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
if (!this.dirty_ && (!updateWhileAnimating && animating) ||
(!updateWhileInteracting && interacting)) {
return true;
}