Merge pull request #10865 from jahow/view-animate-updatesize-fix

View / avoid solving constraints related to map size during animation
This commit is contained in:
Olivier Guyot
2020-04-03 13:55:54 +02:00
committed by GitHub
3 changed files with 53 additions and 2 deletions

View File

@@ -989,7 +989,7 @@ class PluggableMap extends BaseObject {
* @private
*/
handleSizeChanged_() {
if (this.getView()) {
if (this.getView() && !this.getView().getAnimating()) {
this.getView().resolveConstraints(0);
}

View File

@@ -762,11 +762,14 @@ class View extends BaseObject {
* Stores the viewport size on the view. The viewport size is not read every time from the DOM
* to avoid performance hit and layout reflow.
* This should be done on map size change.
* Note: the constraints are not resolved during an animation to avoid stopping it
* @param {import("./size.js").Size=} opt_size Viewport size; if undefined, [100, 100] is assumed
*/
setViewportSize(opt_size) {
this.viewportSize_ = Array.isArray(opt_size) ? opt_size.slice() : [100, 100];
this.resolveConstraints(0);
if (!this.getAnimating()) {
this.resolveConstraints(0);
}
}
/**