From 5f744904ac249e2af38e84fbe9ea96a93d096c82 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 5 Jul 2024 11:34:46 +0200 Subject: [PATCH] Check the relevant parameters inside of the `mustBeViewedWhenEditing` method Similar to the `mustBeViewed` method, we can check the relevant parameters within the `mustBeViewedWhenEditing` method itself since that (in my opinion) slightly helps readability of the code in the `src/core/document.js` file. --- src/core/annotation.js | 4 ++-- src/core/document.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/annotation.js b/src/core/annotation.js index 632112d967ef7..d95a00c7b40f4 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -777,8 +777,8 @@ class Annotation { return this.printable; } - mustBeViewedWhenEditing() { - return !this.data.isEditable; + mustBeViewedWhenEditing(isEditing, modifiedIds = null) { + return isEditing ? !this.data.isEditable : !modifiedIds?.has(this.data.id); } /** diff --git a/src/core/document.js b/src/core/document.js index 163565b328542..ee0aaaa07c432 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -582,8 +582,7 @@ class Page { intentAny || (intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) && - ((isEditing && annotation.mustBeViewedWhenEditing()) || - (!isEditing && !modifiedIds?.has(annotation.data.id)))) || + annotation.mustBeViewedWhenEditing(isEditing, modifiedIds)) || (intentPrint && annotation.mustBePrinted(annotationStorage)) ) { opListPromises.push(