From 2a28064a6808ff0099cde7fde567dd05f140064c Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sat, 22 May 2021 21:35:53 +0100 Subject: [PATCH] Update rectangle.tsx --- lib/shape-utils/rectangle.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/shape-utils/rectangle.tsx b/lib/shape-utils/rectangle.tsx index 375057984..5f8b51e0b 100644 --- a/lib/shape-utils/rectangle.tsx +++ b/lib/shape-utils/rectangle.tsx @@ -95,9 +95,14 @@ const rectangle = registerShapeUtils({ transform(shape, bounds, { initialShape, transformOrigin, scaleX, scaleY }) { if (shape.rotation === 0) { - shape.point = [bounds.minX, bounds.minY] shape.size = [bounds.width, bounds.height] + shape.point = [bounds.minX, bounds.minY] } else { + shape.size = vec.mul( + initialShape.size, + Math.min(Math.abs(scaleX), Math.abs(scaleY)) + ) + shape.point = [ bounds.minX + (bounds.width - shape.size[0]) * @@ -107,11 +112,6 @@ const rectangle = registerShapeUtils({ (scaleY < 0 ? 1 - transformOrigin[1] : transformOrigin[1]), ] - shape.size = vec.mul( - initialShape.size, - Math.min(Math.abs(scaleX), Math.abs(scaleY)) - ) - shape.rotation = (scaleX < 0 && scaleY >= 0) || (scaleY < 0 && scaleX >= 0) ? -initialShape.rotation