Fix the #savedHasOwnCanvas handling in the StampAnnotation class
This may not be possible to trigger in practice, however it seems that if `StampAnnotation.prototype.mustBeViewedWhenEditing` is called back-to-back with `isEditing === true` set then the second invocation could overwrite the `#savedHasOwnCanvas`-field and thus lose its initial state.
This commit is contained in:
parent
dea35aed4a
commit
08fa4eba20
@ -4905,13 +4905,13 @@ class StrikeOutAnnotation extends MarkupAnnotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class StampAnnotation extends MarkupAnnotation {
|
class StampAnnotation extends MarkupAnnotation {
|
||||||
#savedHasOwnCanvas;
|
#savedHasOwnCanvas = null;
|
||||||
|
|
||||||
constructor(params) {
|
constructor(params) {
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
this.data.annotationType = AnnotationType.STAMP;
|
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;
|
this.data.isEditable = !this.data.noHTML;
|
||||||
// We want to be able to add mouse listeners to the annotation.
|
// We want to be able to add mouse listeners to the annotation.
|
||||||
this.data.noHTML = false;
|
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
|
// 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.
|
// 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;
|
this.data.hasOwnCanvas = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (this.#savedHasOwnCanvas !== null) {
|
||||||
this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
|
this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
|
||||||
|
this.#savedHasOwnCanvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
return !modifiedIds?.has(this.data.id);
|
return !modifiedIds?.has(this.data.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user