mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 17:30:52 +08:00
refactor setCurrent func scroll policy (#14265)
* remove script that should not be added
* dummy
* refactor the scroll logic
* remove kernel binary
* revert 9a4d0b97d1
that casued by unclean git checkout
This commit is contained in:
parent
aa5d257e1d
commit
c1b01b7fbd
@ -1108,13 +1108,14 @@ data-type="navigation-root" data-path="/">
|
||||
liItem.classList.remove("b3-list-item--focus");
|
||||
});
|
||||
target.classList.add("b3-list-item--focus");
|
||||
|
||||
if (isScroll) {
|
||||
let offsetTop = target.offsetTop;
|
||||
// https://github.com/siyuan-note/siyuan/issues/8749
|
||||
if (target.parentElement.classList.contains("file-tree__sliderDown") && target.offsetParent) {
|
||||
offsetTop = (target.offsetParent as HTMLElement).offsetTop;
|
||||
}
|
||||
this.element.scrollTop = offsetTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
||||
const targetRect = target.getBoundingClientRect();
|
||||
const containerRect = this.element.getBoundingClientRect();
|
||||
|
||||
const relativeTop = targetRect.top - containerRect.top + this.element.scrollTop;
|
||||
|
||||
this.element.scrollTop = relativeTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user