mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: refresh text dimensions only after font load done (#5878)
* fix: refresh text dimensions only after font load done * fix snaps
This commit is contained in:
parent
3c0b29d85f
commit
d273acb7e4
4 changed files with 24 additions and 14 deletions
|
@ -139,7 +139,7 @@ const restoreElementWithProperties = <
|
|||
|
||||
const restoreElement = (
|
||||
element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>,
|
||||
refreshDimensions = true,
|
||||
refreshDimensions = false,
|
||||
): typeof element | null => {
|
||||
switch (element.type) {
|
||||
case "text":
|
||||
|
@ -239,7 +239,7 @@ export const restoreElements = (
|
|||
elements: ImportedDataState["elements"],
|
||||
/** NOTE doesn't serve for reconciliation */
|
||||
localElements: readonly ExcalidrawElement[] | null | undefined,
|
||||
refreshDimensions = true,
|
||||
refreshDimensions = false,
|
||||
): ExcalidrawElement[] => {
|
||||
const localElementsMap = localElements ? arrayToMap(localElements) : null;
|
||||
return (elements || []).reduce((elements, element) => {
|
||||
|
@ -387,7 +387,7 @@ export const restore = (
|
|||
localElements: readonly ExcalidrawElement[] | null | undefined,
|
||||
): RestoredDataState => {
|
||||
return {
|
||||
elements: restoreElements(data?.elements, localElements, true),
|
||||
elements: restoreElements(data?.elements, localElements),
|
||||
appState: restoreAppState(data?.appState, localAppState || null),
|
||||
files: data?.files || {},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue