ensure restored elements are normalized before filter (#844)

This commit is contained in:
David Luzar 2020-02-27 17:37:43 +01:00 committed by GitHub
parent a8a5733e50
commit 7e0e885417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,7 +343,6 @@ function restore(
opts?: { scrollToContent: boolean },
): DataState {
const elements = savedElements
.filter(el => !isInvisiblySmallElement(el))
.map(element => {
let points: Point[] = [];
if (element.type === "arrow") {
@ -392,7 +391,8 @@ function restore(
canvasOffsetX: element.canvasOffsetX || 0,
canvasOffsetY: element.canvasOffsetY || 0,
};
});
})
.filter(el => !isInvisiblySmallElement(el));
if (opts?.scrollToContent && savedState) {
savedState = { ...savedState, ...calculateScrollCenter(elements) };