Переглянути джерело

fix: rotate bounded text when container is rotated before typing (#4535)

Aakansha Doshi 3 роки тому
батько
коміт
a2e8806f57
1 змінених файлів з 3 додано та 2 видалено
  1. 3 2
      src/element/textWysiwyg.tsx

+ 3 - 2
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) {