mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Change the getVisibleElements
helper function to take a parameter object
Given the number of parameters, and the fact that many of them are booleans, the call-sites are no longer particularly easy to read and understand. Furthermore, this slightly improves the formatting of the JSDoc-comment, since it needed updating as part of these changes anyway. Finally, this removes an unnecessary `numViews === 0` check from `getVisibleElements`, since that should be *very* rare and more importantly that the `binarySearchFirstItem` function already has a fast-path for that particular case.
This commit is contained in:
parent
4e13559cb0
commit
ba761e42f0
4 changed files with 55 additions and 41 deletions
|
@ -1076,13 +1076,13 @@ class BaseViewer {
|
|||
}
|
||||
|
||||
_getVisiblePages() {
|
||||
return getVisibleElements(
|
||||
this.container,
|
||||
this._pages,
|
||||
true,
|
||||
this._isScrollModeHorizontal,
|
||||
this._isScrollModeHorizontal && this._isContainerRtl
|
||||
);
|
||||
return getVisibleElements({
|
||||
scrollEl: this.container,
|
||||
views: this._pages,
|
||||
sortByVisibility: true,
|
||||
horizontal: this._isScrollModeHorizontal,
|
||||
rtl: this._isScrollModeHorizontal && this._isContainerRtl,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue