1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #19619 from Snuffleupagus/fix-#savedHasOwnCanvas

Fix the `#savedHasOwnCanvas` handling in the `StampAnnotation` class
This commit is contained in:
Jonas Jenwald 2025-03-06 17:59:14 +01:00 committed by GitHub
commit af89e77124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4905,13 +4905,13 @@ class StrikeOutAnnotation extends MarkupAnnotation {
}
class StampAnnotation extends MarkupAnnotation {
#savedHasOwnCanvas;
#savedHasOwnCanvas = null;
constructor(params) {
super(params);
this.data.annotationType = AnnotationType.STAMP;
this.#savedHasOwnCanvas = this.data.hasOwnCanvas = this.data.noRotate;
this.data.hasOwnCanvas = this.data.noRotate;
this.data.isEditable = !this.data.noHTML;
// We want to be able to add mouse listeners to the annotation.
this.data.noHTML = false;
@ -4924,11 +4924,14 @@ class StampAnnotation extends MarkupAnnotation {
}
// When we're editing, we want to ensure that the stamp annotation is
// drawn on a canvas in order to use it in the annotation editor layer.
this.#savedHasOwnCanvas = this.data.hasOwnCanvas;
this.#savedHasOwnCanvas ??= this.data.hasOwnCanvas;
this.data.hasOwnCanvas = true;
return true;
}
this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
if (this.#savedHasOwnCanvas !== null) {
this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
this.#savedHasOwnCanvas = null;
}
return !modifiedIds?.has(this.data.id);
}