feat: change boundElementIdsboundElements (#4404)

This commit is contained in:
David Luzar 2021-12-14 16:07:01 +01:00 committed by GitHub
parent 104664cb9e
commit 390da3fd0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 589 additions and 555 deletions

View file

@ -64,7 +64,10 @@ const restoreElementWithProperties = <
T extends ExcalidrawElement,
K extends Pick<T, keyof Omit<Required<T>, keyof ExcalidrawElement>>,
>(
element: Required<T>,
element: Required<T> & {
/** @deprecated */
boundElementIds?: readonly ExcalidrawElement["id"][];
},
extra: Pick<
T,
// This extra Pick<T, keyof K> ensure no excess properties are passed.
@ -98,7 +101,9 @@ const restoreElementWithProperties = <
strokeSharpness:
element.strokeSharpness ??
(isLinearElementType(element.type) ? "round" : "sharp"),
boundElementIds: element.boundElementIds ?? [],
boundElements: element.boundElementIds
? element.boundElementIds.map((id) => ({ type: "arrow", id }))
: element.boundElements ?? [],
updated: element.updated ?? getUpdatedTimestamp(),
};