Merge pull request #3446 from elemoine/updatewhileinteracting
Add updateWhileInteracting to olx.layer.VectorOptions
This commit is contained in:
@@ -3397,6 +3397,7 @@ olx.layer.TileOptions.prototype.useInterimTilesOnError;
|
|||||||
* source: (ol.source.Vector|undefined),
|
* source: (ol.source.Vector|undefined),
|
||||||
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
|
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
|
||||||
* updateWhileAnimating: (boolean|undefined),
|
* updateWhileAnimating: (boolean|undefined),
|
||||||
|
* updateWhileInteracting: (boolean|undefined),
|
||||||
* visible: (boolean|undefined)}}
|
* visible: (boolean|undefined)}}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -3516,6 +3517,15 @@ olx.layer.VectorOptions.prototype.style;
|
|||||||
olx.layer.VectorOptions.prototype.updateWhileAnimating;
|
olx.layer.VectorOptions.prototype.updateWhileAnimating;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When set to `true`, feature batches will be recreated during interactions.
|
||||||
|
* See also `updateWhileInteracting`. Default is `false`.
|
||||||
|
* @type {boolean|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.layer.VectorOptions.prototype.updateWhileInteracting;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visibility. Default is `true` (visible).
|
* Visibility. Default is `true` (visible).
|
||||||
* @type {boolean|undefined}
|
* @type {boolean|undefined}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ ol.layer.Vector = function(opt_options) {
|
|||||||
delete baseOptions.style;
|
delete baseOptions.style;
|
||||||
delete baseOptions.renderBuffer;
|
delete baseOptions.renderBuffer;
|
||||||
delete baseOptions.updateWhileAnimating;
|
delete baseOptions.updateWhileAnimating;
|
||||||
|
delete baseOptions.updateWhileInteracting;
|
||||||
goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions));
|
goog.base(this, /** @type {olx.layer.LayerOptions} */ (baseOptions));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,6 +70,13 @@ ol.layer.Vector = function(opt_options) {
|
|||||||
this.updateWhileAnimating_ = goog.isDef(options.updateWhileAnimating) ?
|
this.updateWhileAnimating_ = goog.isDef(options.updateWhileAnimating) ?
|
||||||
options.updateWhileAnimating : false;
|
options.updateWhileAnimating : false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.updateWhileInteracting_ = goog.isDef(options.updateWhileInteracting) ?
|
||||||
|
options.updateWhileInteracting : false;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.layer.Vector, ol.layer.Layer);
|
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
|
* @param {function(ol.Feature, ol.Feature):number|null|undefined} renderOrder
|
||||||
* Render order.
|
* Render order.
|
||||||
|
|||||||
@@ -169,9 +169,13 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
frameState.attributions, vectorSource.getAttributions());
|
frameState.attributions, vectorSource.getAttributions());
|
||||||
this.updateLogos(frameState, vectorSource);
|
this.updateLogos(frameState, vectorSource);
|
||||||
|
|
||||||
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
|
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
|
||||||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
|
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
||||||
|
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
||||||
|
|
||||||
|
if (!this.dirty_ && (!updateWhileAnimating && animating) ||
|
||||||
|
(!updateWhileInteracting && interacting)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,9 +230,13 @@ ol.renderer.dom.VectorLayer.prototype.prepareFrame =
|
|||||||
frameState.attributions, vectorSource.getAttributions());
|
frameState.attributions, vectorSource.getAttributions());
|
||||||
this.updateLogos(frameState, vectorSource);
|
this.updateLogos(frameState, vectorSource);
|
||||||
|
|
||||||
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
|
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
|
||||||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
|
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
||||||
|
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
||||||
|
|
||||||
|
if (!this.dirty_ && (!updateWhileAnimating && animating) ||
|
||||||
|
(!updateWhileInteracting && interacting)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,9 +202,13 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
|||||||
frameState.attributions, vectorSource.getAttributions());
|
frameState.attributions, vectorSource.getAttributions());
|
||||||
this.updateLogos(frameState, vectorSource);
|
this.updateLogos(frameState, vectorSource);
|
||||||
|
|
||||||
if (!this.dirty_ && (!vectorLayer.getUpdateWhileAnimating() &&
|
var animating = frameState.viewHints[ol.ViewHint.ANIMATING];
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] ||
|
var interacting = frameState.viewHints[ol.ViewHint.INTERACTING];
|
||||||
frameState.viewHints[ol.ViewHint.INTERACTING])) {
|
var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
|
||||||
|
var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
|
||||||
|
|
||||||
|
if (!this.dirty_ && (!updateWhileAnimating && animating) ||
|
||||||
|
(!updateWhileInteracting && interacting)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user