Skip to content
  • Sponsor siyuan-note/siyuan

  • Notifications You must be signed in to change notification settings
  • Fork 2k

Commit aedbd6b

Browse files
authoredMar 10, 2025
Refactor setCurrentById of Outline func scroll policy (#14312)
* scroll for outline * remove kernel bin * remove debug print * gitignore
1 parent e472f71 commit aedbd6b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ app/stage/build
1414
app/build
1515
app/src/types/dist
1616
app/kernel*
17+
app/SiYuan-Kernel
1718
ios
1819
pprof
1920

‎app/src/layout/dock/Outline.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,12 @@ export class Outline extends Model {
485485
}
486486
if (currentElement) {
487487
currentElement.classList.add("b3-list-item--focus");
488-
this.element.scrollTop = currentElement.offsetTop - this.element.clientHeight / 2 - 30;
488+
489+
const targetRect = currentElement.getBoundingClientRect();
490+
const containerRect = this.element.getBoundingClientRect();
491+
const relativeTop = targetRect.top - containerRect.top + this.element.scrollTop;
492+
493+
this.element.scrollTop = relativeTop - this.element.clientHeight / 2 - 30;
489494
}
490495
}
491496

0 commit comments

Comments
 (0)
Please sign in to comment.