ensure restored elements are normalized before filter (#844)
This commit is contained in:
parent
a8a5733e50
commit
7e0e885417
@ -343,7 +343,6 @@ function restore(
|
|||||||
opts?: { scrollToContent: boolean },
|
opts?: { scrollToContent: boolean },
|
||||||
): DataState {
|
): DataState {
|
||||||
const elements = savedElements
|
const elements = savedElements
|
||||||
.filter(el => !isInvisiblySmallElement(el))
|
|
||||||
.map(element => {
|
.map(element => {
|
||||||
let points: Point[] = [];
|
let points: Point[] = [];
|
||||||
if (element.type === "arrow") {
|
if (element.type === "arrow") {
|
||||||
@ -392,7 +391,8 @@ function restore(
|
|||||||
canvasOffsetX: element.canvasOffsetX || 0,
|
canvasOffsetX: element.canvasOffsetX || 0,
|
||||||
canvasOffsetY: element.canvasOffsetY || 0,
|
canvasOffsetY: element.canvasOffsetY || 0,
|
||||||
};
|
};
|
||||||
});
|
})
|
||||||
|
.filter(el => !isInvisiblySmallElement(el));
|
||||||
|
|
||||||
if (opts?.scrollToContent && savedState) {
|
if (opts?.scrollToContent && savedState) {
|
||||||
savedState = { ...savedState, ...calculateScrollCenter(elements) };
|
savedState = { ...savedState, ...calculateScrollCenter(elements) };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user