mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-04 07:20:28 +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/build
|
||||||
app/src/types/dist
|
app/src/types/dist
|
||||||
app/kernel*
|
app/kernel*
|
||||||
|
app/SiYuan-Kernel
|
||||||
ios
|
ios
|
||||||
pprof
|
pprof
|
||||||
|
|
||||||
|
@ -485,7 +485,12 @@ export class Outline extends Model {
|
|||||||
}
|
}
|
||||||
if (currentElement) {
|
if (currentElement) {
|
||||||
currentElement.classList.add("b3-list-item--focus");
|
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