From b4abfad6381e99ab0e1b73f91f3846055e43b8bf Mon Sep 17 00:00:00 2001 From: Alex Kim <45559664+alex-kim-dev@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:22:40 +0500 Subject: [PATCH] fix: bound arrows not updated when rotating multiple elements (#6662) --- src/element/resizeElements.ts | 42 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/element/resizeElements.ts b/src/element/resizeElements.ts index 3610d757..6e49b7e0 100644 --- a/src/element/resizeElements.ts +++ b/src/element/resizeElements.ts @@ -890,26 +890,34 @@ const rotateMultipleElements = ( centerY, centerAngle + origAngle - element.angle, ); - mutateElement(element, { - x: element.x + (rotatedCX - cx), - y: element.y + (rotatedCY - cy), - angle: normalizeAngle(centerAngle + origAngle), - }); - const boundTextElementId = getBoundTextElementId(element); - if (boundTextElementId) { - const textElement = - Scene.getScene(element)?.getElement( - boundTextElementId, - ); - if (textElement && !isArrowElement(element)) { - mutateElement(textElement, { - x: textElement.x + (rotatedCX - cx), - y: textElement.y + (rotatedCY - cy), + + mutateElement( + element, + { + x: element.x + (rotatedCX - cx), + y: element.y + (rotatedCY - cy), + angle: normalizeAngle(centerAngle + origAngle), + }, + false, + ); + + updateBoundElements(element, { simultaneouslyUpdated: elements }); + + const boundText = getBoundTextElement(element); + if (boundText && !isArrowElement(element)) { + mutateElement( + boundText, + { + x: boundText.x + (rotatedCX - cx), + y: boundText.y + (rotatedCY - cy), angle: normalizeAngle(centerAngle + origAngle), - }); - } + }, + false, + ); } }); + + Scene.getScene(elements[0])?.informMutation(); }; export const getResizeOffsetXY = (