mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
35b5f6dd0d
commit
f2346275ef
4 changed files with 312 additions and 252 deletions
|
@ -10,3 +10,4 @@ export { hitTest } from "./collision";
|
|||
export { resizeTest } from "./resizeTest";
|
||||
export { isTextElement } from "./typeChecks";
|
||||
export { textWysiwyg } from "./textWysiwyg";
|
||||
export { redrawTextBoundingBox } from "./textElement";
|
||||
|
|
9
src/element/textElement.ts
Normal file
9
src/element/textElement.ts
Normal 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue