2020-01-10 18:00:19 +04:00
|
|
|
import { measureText } from "../utils";
|
2020-03-09 22:34:50 -07:00
|
|
|
import { MutableExcalidrawTextElement } from "./types";
|
2020-01-10 18:00:19 +04:00
|
|
|
|
2020-03-09 22:34:50 -07:00
|
|
|
export const redrawTextBoundingBox = (
|
|
|
|
element: MutableExcalidrawTextElement,
|
|
|
|
) => {
|
2020-01-10 18:00:19 +04:00
|
|
|
const metrics = measureText(element.text, element.font);
|
|
|
|
element.width = metrics.width;
|
|
|
|
element.height = metrics.height;
|
|
|
|
element.baseline = metrics.baseline;
|
|
|
|
};
|