From d783aaa23671b61b247af3b22e5df45ab7117785 Mon Sep 17 00:00:00 2001 From: Ting Lu Date: Tue, 15 Apr 2025 20:31:33 -0400 Subject: [PATCH] implementation of resize --- packages/element/src/resizeElements.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/element/src/resizeElements.ts b/packages/element/src/resizeElements.ts index 3ff405603..1f569b3e3 100644 --- a/packages/element/src/resizeElements.ts +++ b/packages/element/src/resizeElements.ts @@ -1378,8 +1378,21 @@ export const resizeMultipleElements = ( ); if (keepAspectRatio) { - scaleX = scale; - scaleY = scale; + // If the elements are in a group and shouldMaintainAspectRatio is true(meaning user is holding shift), + // we need to adjust the scaleX or scaleY based on the handleDirection + if(targetElements.some(item => isInGroup(item.latest)) && shouldMaintainAspectRatio) { + if(handleDirection.length === 1) { + if(handleDirection.includes("e") || handleDirection.includes("w")) { + scaleX = scale; + } else if (handleDirection.includes("n") || handleDirection.includes("s")) { + scaleY = scale; + } + } + } + else { + scaleX = scale; + scaleY = scale; + } } /**