fix: bound arrows not updated when rotating multiple elements (#6662)

This commit is contained in:
Alex Kim 2023-06-09 16:22:40 +05:00 committed by GitHub
parent a39640ead1
commit b4abfad638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -890,26 +890,34 @@ const rotateMultipleElements = (
centerY, centerY,
centerAngle + origAngle - element.angle, centerAngle + origAngle - element.angle,
); );
mutateElement(element, {
mutateElement(
element,
{
x: element.x + (rotatedCX - cx), x: element.x + (rotatedCX - cx),
y: element.y + (rotatedCY - cy), y: element.y + (rotatedCY - cy),
angle: normalizeAngle(centerAngle + origAngle), angle: normalizeAngle(centerAngle + origAngle),
}); },
const boundTextElementId = getBoundTextElementId(element); false,
if (boundTextElementId) {
const textElement =
Scene.getScene(element)?.getElement<ExcalidrawTextElementWithContainer>(
boundTextElementId,
); );
if (textElement && !isArrowElement(element)) {
mutateElement(textElement, { updateBoundElements(element, { simultaneouslyUpdated: elements });
x: textElement.x + (rotatedCX - cx),
y: textElement.y + (rotatedCY - cy), const boundText = getBoundTextElement(element);
if (boundText && !isArrowElement(element)) {
mutateElement(
boundText,
{
x: boundText.x + (rotatedCX - cx),
y: boundText.y + (rotatedCY - cy),
angle: normalizeAngle(centerAngle + origAngle), angle: normalizeAngle(centerAngle + origAngle),
}); },
} false,
);
} }
}); });
Scene.getScene(elements[0])?.informMutation();
}; };
export const getResizeOffsetXY = ( export const getResizeOffsetXY = (