Merge pull request #10257 from brianhelba/patch-1

Allow View.adjust* methods to take a null opt_anchor
This commit is contained in:
Olivier Guyot
2019-11-07 09:10:11 +01:00
committed by GitHub
+2 -2
View File
@@ -1252,7 +1252,7 @@ class View extends BaseObject {
const size = this.getSizeFromViewport_(this.getRotation()); const size = this.getSizeFromViewport_(this.getRotation());
const newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving); const newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);
if (opt_anchor !== undefined) { if (opt_anchor) {
this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor); this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);
} }
@@ -1292,7 +1292,7 @@ class View extends BaseObject {
adjustRotationInternal(delta, opt_anchor) { adjustRotationInternal(delta, opt_anchor) {
const isMoving = this.getAnimating() || this.getInteracting(); const isMoving = this.getAnimating() || this.getInteracting();
const newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving); const newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);
if (opt_anchor !== undefined) { if (opt_anchor) {
this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor); this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);
} }
this.targetRotation_ += delta; this.targetRotation_ += delta;