From 0b864ee7d542baefccfd552a864c89b950a206df Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 10 Nov 2024 16:27:19 +0100 Subject: [PATCH] Shorten the `Page.prototype.userUnit` getter slightly --- src/core/document.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index 25952d0016979..ba17fdc2ab082 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -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 { @@ -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() {