mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-03 14:11:47 +01:00
This commit is contained in:
parent
9156aee244
commit
b0f674d84c
1 changed files with 4 additions and 3 deletions
|
|
@ -111,14 +111,15 @@ export const scrollCenter = (
|
|||
}
|
||||
if (position === "nearest") {
|
||||
// 在可视区域内不进行滚动
|
||||
if (elementRect.top < contentRect.top) {
|
||||
if (elementRect.bottom < contentRect.top) {
|
||||
protyle.contentElement.scroll({
|
||||
top: protyle.contentElement.scrollTop + elementRect.top - contentRect.top,
|
||||
behavior
|
||||
});
|
||||
} else if (elementRect.bottom > contentRect.bottom) {
|
||||
} else if (elementRect.top > contentRect.bottom) {
|
||||
protyle.contentElement.scroll({
|
||||
top: protyle.contentElement.scrollTop + elementRect.bottom - contentRect.bottom,
|
||||
top: elementRect.height > contentRect.height ? protyle.contentElement.scrollTop + elementRect.top - contentRect.top :
|
||||
protyle.contentElement.scrollTop + elementRect.bottom - contentRect.bottom,
|
||||
behavior
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue