Merge pull request #12172 from ahocevar/icon-displacement

Fix icon displacement
This commit is contained in:
Andreas Hocevar
2021-04-01 14:59:40 +02:00
committed by GitHub
5 changed files with 53 additions and 18 deletions

View File

@@ -285,6 +285,10 @@ class Icon extends ImageStyle {
anchor[1] = -anchor[1] + size[1];
}
}
const displacement = this.getDisplacement();
anchor[0] -= displacement[0];
anchor[1] += displacement[1];
this.normalizedAnchor_ = anchor;
return this.normalizedAnchor_;
}
@@ -368,7 +372,6 @@ class Icon extends ImageStyle {
return this.origin_;
}
let offset = this.offset_;
const displacement = this.getDisplacement();
if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {
const size = this.getSize();
@@ -390,8 +393,6 @@ class Icon extends ImageStyle {
offset[1] = iconImageSize[1] - size[1] - offset[1];
}
}
offset[0] += displacement[0];
offset[1] += displacement[1];
this.origin_ = offset;
return this.origin_;
}