Skip to content

Commit

Permalink
Split translation to make flip work better with rotated rects
Browse files Browse the repository at this point in the history
  • Loading branch information
MadeByMike committed Oct 30, 2023
1 parent 63924bc commit 4224b41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/shapes/Transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,12 @@ export class Transformer extends Group {
const newScaleY = newAttrs.height / baseSize;

if (this.flipEnabled() === false) {
newTr.translate(newAttrs.x, newAttrs.y);
newTr.rotate(newAttrs.rotation);
newTr.translate(
newAttrs.x + (newAttrs.width < 0 ? newAttrs.width : 0),
newAttrs.y + (newAttrs.height < 0 ? newAttrs.height : 0)
newAttrs.width < 0 ? newAttrs.width : 0,
newAttrs.height < 0 ? newAttrs.height : 0
);
newTr.rotate(newAttrs.rotation);
newTr.scale(Math.abs(newScaleX), Math.abs(newScaleY));
} else {
newTr.translate(newAttrs.x, newAttrs.y);
Expand Down

0 comments on commit 4224b41

Please sign in to comment.