mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 01:21:08 +08:00
Refactor setCurrentById of Outline func scroll policy (#14312)
* scroll for outline * remove kernel bin * remove debug print * gitignore
This commit is contained in:
parent
e472f71ebd
commit
aedbd6bee8
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,6 +14,7 @@ app/stage/build
|
||||
app/build
|
||||
app/src/types/dist
|
||||
app/kernel*
|
||||
app/SiYuan-Kernel
|
||||
ios
|
||||
pprof
|
||||
|
||||
|
@ -485,7 +485,12 @@ export class Outline extends Model {
|
||||
}
|
||||
if (currentElement) {
|
||||
currentElement.classList.add("b3-list-item--focus");
|
||||
this.element.scrollTop = currentElement.offsetTop - this.element.clientHeight / 2 - 30;
|
||||
|
||||
const targetRect = currentElement.getBoundingClientRect();
|
||||
const containerRect = this.element.getBoundingClientRect();
|
||||
const relativeTop = targetRect.top - containerRect.top + this.element.scrollTop;
|
||||
|
||||
this.element.scrollTop = relativeTop - this.element.clientHeight / 2 - 30;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user