mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Move the isPortraitOrientation
helper function from web/base_viewer.js
to web/ui_utils.js
A couple of basic unit-tests are added, and a manual `isLandscape` check (in `web/base_viewer.js`) is also converted to use the helper function instead.
This commit is contained in:
parent
5c1a16ba6e
commit
77d025dc14
3 changed files with 33 additions and 11 deletions
|
@ -439,6 +439,10 @@ function isValidRotation(angle) {
|
|||
return Number.isInteger(angle) && angle % 90 === 0;
|
||||
}
|
||||
|
||||
function isPortraitOrientation(size) {
|
||||
return size.width <= size.height;
|
||||
}
|
||||
|
||||
function cloneObj(obj) {
|
||||
let result = Object.create(null);
|
||||
for (let i in obj) {
|
||||
|
@ -642,6 +646,7 @@ export {
|
|||
SCROLLBAR_PADDING,
|
||||
VERTICAL_PADDING,
|
||||
isValidRotation,
|
||||
isPortraitOrientation,
|
||||
isFileSchema,
|
||||
cloneObj,
|
||||
PresentationModeState,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue