mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-05 05:47:23 +02:00
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:
parent
17a4d2e123
commit
e89335e776
@ -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",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user