Fix scrolling of outline item into view (PR 20495 follow-up)

Clicking on the "Find Current Outline Item" button is (obviously) supposed to scroll that outline item into view, however that seems to have broken accidentally in PR 20495.
This commit is contained in:
Jonas Jenwald 2026-02-26 14:42:52 +01:00
parent 17a4d2e123
commit e89335e776

View File

@ -16,7 +16,6 @@
import { removeNullCharacters } from "./ui_utils.js"; import { removeNullCharacters } from "./ui_utils.js";
import { stopEvent } from "pdfjs-lib"; import { stopEvent } from "pdfjs-lib";
const TREEITEM_OFFSET_TOP = -100; // px
const TREEITEM_SELECTED_CLASS = "selected"; const TREEITEM_SELECTED_CLASS = "selected";
class BaseTreeViewer { class BaseTreeViewer {
@ -185,10 +184,12 @@ class BaseTreeViewer {
this._updateCurrentTreeItem(treeItem); this._updateCurrentTreeItem(treeItem);
this.container.scrollTo( treeItem.scrollIntoView({
treeItem.offsetLeft, behavior: "instant",
treeItem.offsetTop + TREEITEM_OFFSET_TOP block: "center",
); inline: "center",
container: "nearest",
});
} }
} }