Add a method goToXY in PDFLinkService in order to scroll the document at a given location
This function is required for the commenting feature: the user will be able to click on a comment in the sidebar and the document will be scrolled accordingly.
This commit is contained in:
parent
649a03f817
commit
1678782680
@ -73,6 +73,14 @@ class IPDFLinkService {
|
||||
*/
|
||||
goToPage(val) {}
|
||||
|
||||
/**
|
||||
* Scrolls to a specific location in the PDF document.
|
||||
* @param {number} pageNumber - The page number to scroll to.
|
||||
* @param {number} x - The x-coordinate to scroll to in page coordinates.
|
||||
* @param {number} y - The y-coordinate to scroll to in page coordinates.
|
||||
*/
|
||||
goToXY(pageNumber, x, y) {}
|
||||
|
||||
/**
|
||||
* @param {HTMLAnchorElement} link
|
||||
* @param {string} url
|
||||
|
||||
@ -239,6 +239,20 @@ class PDFLinkService {
|
||||
this.pdfViewer.scrollPageIntoView({ pageNumber });
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls to a specific location in the PDF document.
|
||||
* @param {number} pageNumber - The page number to scroll to.
|
||||
* @param {number} x - The x-coordinate to scroll to in page coordinates.
|
||||
* @param {number} y - The y-coordinate to scroll to in page coordinates.
|
||||
*/
|
||||
goToXY(pageNumber, x, y) {
|
||||
this.pdfViewer.scrollPageIntoView({
|
||||
pageNumber,
|
||||
destArray: [null, { name: "XYZ" }, x, y],
|
||||
ignoreDestinationZoom: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds various attributes (href, title, target, rel) to hyperlinks.
|
||||
* @param {HTMLAnchorElement} link
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user