mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 11:30:42 +08:00
This commit is contained in:
parent
aedbd6bee8
commit
626d5ecd32
@ -485,12 +485,8 @@ export class Outline extends Model {
|
|||||||
}
|
}
|
||||||
if (currentElement) {
|
if (currentElement) {
|
||||||
currentElement.classList.add("b3-list-item--focus");
|
currentElement.classList.add("b3-list-item--focus");
|
||||||
|
const elementRect = this.element.getBoundingClientRect();
|
||||||
const targetRect = currentElement.getBoundingClientRect();
|
this.element.scrollTop = this.element.scrollTop + (currentElement.getBoundingClientRect().top - (elementRect.top + elementRect.height / 2));
|
||||||
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