Skip to content

Commit

Permalink
Merge pull request #19019 from Snuffleupagus/userUnit-shorten
Browse files Browse the repository at this point in the history
Shorten the `Page.prototype.userUnit` getter slightly
  • Loading branch information
timvandermeij authored Nov 10, 2024
2 parents 34e4c4f + 0b864ee commit b9c17ef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ import { writeObject } from "./writer.js";
import { XFAFactory } from "./xfa/factory.js";
import { XRef } from "./xref.js";

const DEFAULT_USER_UNIT = 1.0;
const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];

class Page {
Expand Down Expand Up @@ -195,11 +194,12 @@ class Page {
}

get userUnit() {
let obj = this.pageDict.get("UserUnit");
if (typeof obj !== "number" || obj <= 0) {
obj = DEFAULT_USER_UNIT;
}
return shadow(this, "userUnit", obj);
const obj = this.pageDict.get("UserUnit");
return shadow(
this,
"userUnit",
typeof obj === "number" && obj > 0 ? obj : 1.0
);
}

get view() {
Expand Down

0 comments on commit b9c17ef

Please sign in to comment.