excalidraw/src/element/textElement.ts
Gasim Gasimzada f2346275ef
Extract Side Panel from App component (#295)
* Extract Side Panel from App component

* Refactor SidePanel component

- Remove unnecessary props (we are already passing appState as a prop)
- Remove unnecessary allback (we are already passing setState)
2020-01-10 18:00:19 +04:00

10 lines
334 B
TypeScript

import { measureText } from "../utils";
import { ExcalidrawTextElement } from "./types";
export const redrawTextBoundingBox = (element: ExcalidrawTextElement) => {
const metrics = measureText(element.text, element.font);
element.width = metrics.width;
element.height = metrics.height;
element.baseline = metrics.baseline;
};