Skip to content

Commit e89335e

Browse files
committed
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.
1 parent 17a4d2e commit e89335e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

web/base_tree_viewer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import { removeNullCharacters } from "./ui_utils.js";
1717
import { stopEvent } from "pdfjs-lib";
1818

19-
const TREEITEM_OFFSET_TOP = -100; // px
2019
const TREEITEM_SELECTED_CLASS = "selected";
2120

2221
class BaseTreeViewer {
@@ -185,10 +184,12 @@ class BaseTreeViewer {
185184

186185
this._updateCurrentTreeItem(treeItem);
187186

188-
this.container.scrollTo(
189-
treeItem.offsetLeft,
190-
treeItem.offsetTop + TREEITEM_OFFSET_TOP
191-
);
187+
treeItem.scrollIntoView({
188+
behavior: "instant",
189+
block: "center",
190+
inline: "center",
191+
container: "nearest",
192+
});
192193
}
193194
}
194195

0 commit comments

Comments
 (0)