Skip to content

Commit

Permalink
Shorten the Page.prototype.userUnit getter slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Snuffleupagus committed Nov 10, 2024
1 parent bff6738 commit 0b864ee
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 0b864ee

Please sign in to comment.