do not scale displacement

This commit is contained in:
mike-000
2022-08-11 21:31:48 +01:00
parent c327740108
commit 4bc0ce0f03
7 changed files with 88 additions and 3 deletions

View File

@@ -293,7 +293,13 @@ class Icon extends ImageStyle {
this.normalizedAnchor_ = anchor;
}
const displacement = this.getDisplacement();
return [anchor[0] - displacement[0], anchor[1] + displacement[1]];
const scale = this.getScaleArray();
// anchor is scaled by renderer but displacement should not be scaled
// so divide by scale here
return [
anchor[0] - displacement[0] / scale[0],
anchor[1] + displacement[1] / scale[1],
];
}
/**

View File

@@ -179,7 +179,13 @@ class RegularShape extends ImageStyle {
return null;
}
const displacement = this.getDisplacement();
return [size[0] / 2 - displacement[0], size[1] / 2 + displacement[1]];
const scale = this.getScaleArray();
// anchor is scaled by renderer but displacement should not be scaled
// so divide by scale here
return [
size[0] / 2 - displacement[0] / scale[0],
size[1] / 2 + displacement[1] / scale[1],
];
}
/**