scroll the closest element to center (#1670)

Co-authored-by: Sanghyeon Lee <yongdamsh@gmail.com>
This commit is contained in:
Aakansha Doshi 2020-05-30 17:32:32 +05:30 committed by GitHub
parent 0db7ac78c4
commit fa359034c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 100 additions and 15 deletions

View file

@ -121,7 +121,10 @@ export const restore = (
}, [] as ExcalidrawElement[]);
if (opts?.scrollToContent && savedState) {
savedState = { ...savedState, ...calculateScrollCenter(elements) };
savedState = {
...savedState,
...calculateScrollCenter(elements, savedState, null),
};
}
return {