mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #14219 from Snuffleupagus/getVisibleElements-ids
Let `getVisibleElements` return a Set containing the visible element `id`s
This commit is contained in:
commit
611627f5a1
5 changed files with 39 additions and 40 deletions
|
@ -497,7 +497,8 @@ describe("ui_utils", function () {
|
|||
// This is a reimplementation of getVisibleElements without the
|
||||
// optimizations.
|
||||
function slowGetVisibleElements(scroll, pages) {
|
||||
const views = [];
|
||||
const views = [],
|
||||
ids = new Set();
|
||||
const { scrollLeft, scrollTop } = scroll;
|
||||
const scrollRight = scrollLeft + scroll.clientWidth;
|
||||
const scrollBottom = scrollTop + scroll.clientHeight;
|
||||
|
@ -535,9 +536,10 @@ describe("ui_utils", function () {
|
|||
percent,
|
||||
widthPercent: (fractionWidth * 100) | 0,
|
||||
});
|
||||
ids.add(view.id);
|
||||
}
|
||||
}
|
||||
return { first: views[0], last: views[views.length - 1], views };
|
||||
return { first: views[0], last: views[views.length - 1], views, ids };
|
||||
}
|
||||
|
||||
// This function takes a fixed layout of pages and compares the system under
|
||||
|
@ -699,6 +701,7 @@ describe("ui_utils", function () {
|
|||
first: undefined,
|
||||
last: undefined,
|
||||
views: [],
|
||||
ids: new Set(),
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -715,6 +718,7 @@ describe("ui_utils", function () {
|
|||
first: undefined,
|
||||
last: undefined,
|
||||
views: [],
|
||||
ids: new Set(),
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue