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)
This commit is contained in:
Gasim Gasimzada 2020-01-10 18:00:19 +04:00 committed by GitHub
parent 35b5f6dd0d
commit f2346275ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 312 additions and 252 deletions

View file

@ -10,3 +10,4 @@ export { hitTest } from "./collision";
export { resizeTest } from "./resizeTest";
export { isTextElement } from "./typeChecks";
export { textWysiwyg } from "./textWysiwyg";
export { redrawTextBoundingBox } from "./textElement";

View file

@ -0,0 +1,9 @@
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;
};