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:
sommermorgentraum 2025-03-03 18:49:27 +08:00 committed by GitHub
parent aa5d257e1d
commit c1b01b7fbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}
}