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:
David Luzar 2022-11-15 00:15:02 +01:00 committed by GitHub
parent 3c0b29d85f
commit d273acb7e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 14 deletions

View file

@ -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 || {},
};