mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
12 lines
420 B
TypeScript
12 lines
420 B
TypeScript
import { measureText, getFontString } from "../utils";
|
|
import { ExcalidrawTextElement } from "./types";
|
|
import { mutateElement } from "./mutateElement";
|
|
|
|
export const redrawTextBoundingBox = (element: ExcalidrawTextElement) => {
|
|
const metrics = measureText(element.text, getFontString(element));
|
|
mutateElement(element, {
|
|
width: metrics.width,
|
|
height: metrics.height,
|
|
baseline: metrics.baseline,
|
|
});
|
|
};
|