mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #12870 from Snuffleupagus/page-advance
Add previous/next-page functionality that takes scroll/spread-modes into account (issue 11946)
This commit is contained in:
commit
d4c4f5d4e5
8 changed files with 178 additions and 56 deletions
|
@ -650,11 +650,21 @@ describe("ui_utils", function () {
|
|||
const hiddenWidth =
|
||||
Math.max(0, scrollLeft - viewLeft) +
|
||||
Math.max(0, viewRight - scrollRight);
|
||||
const visibleArea =
|
||||
(div.clientHeight - hiddenHeight) * (div.clientWidth - hiddenWidth);
|
||||
const percent =
|
||||
((visibleArea * 100) / div.clientHeight / div.clientWidth) | 0;
|
||||
views.push({ id: view.id, x: viewLeft, y: viewTop, view, percent });
|
||||
|
||||
const fractionHeight =
|
||||
(div.clientHeight - hiddenHeight) / div.clientHeight;
|
||||
const fractionWidth =
|
||||
(div.clientWidth - hiddenWidth) / div.clientWidth;
|
||||
const percent = (fractionHeight * fractionWidth * 100) | 0;
|
||||
|
||||
views.push({
|
||||
id: view.id,
|
||||
x: viewLeft,
|
||||
y: viewTop,
|
||||
view,
|
||||
percent,
|
||||
widthPercent: (fractionWidth * 100) | 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
return { first: views[0], last: views[views.length - 1], views };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue