diff --git a/.gitignore b/.gitignore index bc4045800..1ceb3fe86 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ app/stage/build app/build app/src/types/dist app/kernel* +app/SiYuan-Kernel ios pprof diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index b1afbe83a..7c3472f6d 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -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; } }