From 626d5ecd32f315426d1db79e16beb3c7dbf0b64d Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 10 Mar 2025 11:45:43 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/pull/14312 --- app/src/layout/dock/Outline.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index 7c3472f6d..ccaa99681 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -485,12 +485,8 @@ export class Outline extends Model { } if (currentElement) { currentElement.classList.add("b3-list-item--focus"); - - 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; + const elementRect = this.element.getBoundingClientRect(); + this.element.scrollTop = this.element.scrollTop + (currentElement.getBoundingClientRect().top - (elementRect.top + elementRect.height / 2)); } }