mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-11 01:59:58 +02:00
refactor: decoupling global Scene state part-1 (#7577)
This commit is contained in:
@@ -31,7 +31,6 @@ import { getElementAbsoluteCoords } from ".";
|
||||
import { adjustXYWithRotation } from "../math";
|
||||
import { getResizedElementAbsoluteCoords } from "./bounds";
|
||||
import {
|
||||
getContainerElement,
|
||||
measureText,
|
||||
normalizeText,
|
||||
wrapText,
|
||||
@@ -333,12 +332,12 @@ const getAdjustedDimensions = (
|
||||
|
||||
export const refreshTextDimensions = (
|
||||
textElement: ExcalidrawTextElement,
|
||||
container: ExcalidrawTextContainer | null,
|
||||
text = textElement.text,
|
||||
) => {
|
||||
if (textElement.isDeleted) {
|
||||
return;
|
||||
}
|
||||
const container = getContainerElement(textElement);
|
||||
if (container) {
|
||||
text = wrapText(
|
||||
text,
|
||||
@@ -352,6 +351,7 @@ export const refreshTextDimensions = (
|
||||
|
||||
export const updateTextElement = (
|
||||
textElement: ExcalidrawTextElement,
|
||||
container: ExcalidrawTextContainer | null,
|
||||
{
|
||||
text,
|
||||
isDeleted,
|
||||
@@ -365,7 +365,7 @@ export const updateTextElement = (
|
||||
return newElementWith(textElement, {
|
||||
originalText,
|
||||
isDeleted: isDeleted ?? textElement.isDeleted,
|
||||
...refreshTextDimensions(textElement, originalText),
|
||||
...refreshTextDimensions(textElement, container, originalText),
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user