From a2e8806f57d2fcc641539cf1c4f7f7aa516af43d Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Tue, 4 Jan 2022 18:03:24 +0530 Subject: [PATCH] fix: rotate bounded text when container is rotated before typing (#4535) --- src/element/textWysiwyg.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/element/textWysiwyg.tsx b/src/element/textWysiwyg.tsx index 276d8b51..272d2781 100644 --- a/src/element/textWysiwyg.tsx +++ b/src/element/textWysiwyg.tsx @@ -163,8 +163,7 @@ export const textWysiwyg = ({ } } const [viewportX, viewportY] = getViewportCoords(coordX, coordY); - const { textAlign, angle } = updatedElement; - + const { textAlign } = updatedElement; editable.value = updatedElement.originalText || updatedElement.text; const lines = updatedElement.originalText.split("\n"); const lineHeight = updatedElement.containerId @@ -194,6 +193,7 @@ export const textWysiwyg = ({ ? ((appState.zoom.value * 100 - 100) / 10) * 14 : 0)) / appState.zoom.value; + const angle = container ? container.angle : updatedElement.angle; Object.assign(editable.style, { font: getFontString(updatedElement), // must be defined *after* font ¯\_(ツ)_/¯ @@ -460,6 +460,7 @@ export const textWysiwyg = ({ width: Number(editable.style.width.slice(0, -2)), // preserve padding x: container.x + BOUND_TEXT_PADDING, + angle: container.angle, }); const boundTextElementId = getBoundTextElementId(container); if (!boundTextElementId || boundTextElementId !== element.id) {