Split translation to make flip work better with rotated rects

This commit is contained in:
Mike 2023-10-30 22:46:38 +00:00 committed by GitHub
parent 63924bceee
commit 4224b41c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1060,11 +1060,12 @@ export class Transformer extends Group {
const newScaleY = newAttrs.height / baseSize;
if (this.flipEnabled() === false) {
newTr.translate(
newAttrs.x + (newAttrs.width < 0 ? newAttrs.width : 0),
newAttrs.y + (newAttrs.height < 0 ? newAttrs.height : 0)
);
newTr.translate(newAttrs.x, newAttrs.y);
newTr.rotate(newAttrs.rotation);
newTr.translate(
newAttrs.width < 0 ? newAttrs.width : 0,
newAttrs.height < 0 ? newAttrs.height : 0
);
newTr.scale(Math.abs(newScaleX), Math.abs(newScaleY));
} else {
newTr.translate(newAttrs.x, newAttrs.y);