mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Split translation to make flip work better with rotated rects
This commit is contained in:
parent
63924bceee
commit
4224b41c5a
@ -1060,11 +1060,12 @@ export class Transformer extends Group {
|
|||||||
const newScaleY = newAttrs.height / baseSize;
|
const newScaleY = newAttrs.height / baseSize;
|
||||||
|
|
||||||
if (this.flipEnabled() === false) {
|
if (this.flipEnabled() === false) {
|
||||||
newTr.translate(
|
newTr.translate(newAttrs.x, newAttrs.y);
|
||||||
newAttrs.x + (newAttrs.width < 0 ? newAttrs.width : 0),
|
|
||||||
newAttrs.y + (newAttrs.height < 0 ? newAttrs.height : 0)
|
|
||||||
);
|
|
||||||
newTr.rotate(newAttrs.rotation);
|
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));
|
newTr.scale(Math.abs(newScaleX), Math.abs(newScaleY));
|
||||||
} else {
|
} else {
|
||||||
newTr.translate(newAttrs.x, newAttrs.y);
|
newTr.translate(newAttrs.x, newAttrs.y);
|
||||||
|
Loading…
Reference in New Issue
Block a user