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");
|
liItem.classList.remove("b3-list-item--focus");
|
||||||
});
|
});
|
||||||
target.classList.add("b3-list-item--focus");
|
target.classList.add("b3-list-item--focus");
|
||||||
|
|
||||||
if (isScroll) {
|
if (isScroll) {
|
||||||
let offsetTop = target.offsetTop;
|
const targetRect = target.getBoundingClientRect();
|
||||||
// https://github.com/siyuan-note/siyuan/issues/8749
|
const containerRect = this.element.getBoundingClientRect();
|
||||||
if (target.parentElement.classList.contains("file-tree__sliderDown") && target.offsetParent) {
|
|
||||||
offsetTop = (target.offsetParent as HTMLElement).offsetTop;
|
const relativeTop = targetRect.top - containerRect.top + this.element.scrollTop;
|
||||||
}
|
|
||||||
this.element.scrollTop = offsetTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
this.element.scrollTop = relativeTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user