mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 07:37:57 +02:00
[Editor] Make stamp annotations editable (bug 1921291)
This commit is contained in:
parent
ebbd019d7d
commit
8410252eb8
11 changed files with 281 additions and 18 deletions
|
@ -4859,14 +4859,34 @@ class StrikeOutAnnotation extends MarkupAnnotation {
|
|||
}
|
||||
|
||||
class StampAnnotation extends MarkupAnnotation {
|
||||
#savedHasOwnCanvas;
|
||||
|
||||
constructor(params) {
|
||||
super(params);
|
||||
|
||||
this.data.annotationType = AnnotationType.STAMP;
|
||||
this.data.hasOwnCanvas = this.data.noRotate;
|
||||
this.#savedHasOwnCanvas = 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;
|
||||
}
|
||||
|
||||
mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
|
||||
if (isEditing) {
|
||||
if (!this.data.isEditable) {
|
||||
return false;
|
||||
}
|
||||
// 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.data.hasOwnCanvas = true;
|
||||
return true;
|
||||
}
|
||||
this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
|
||||
|
||||
return !modifiedIds?.has(this.data.id);
|
||||
}
|
||||
|
||||
static async createImage(bitmap, xref) {
|
||||
// TODO: when printing, we could have a specific internal colorspace
|
||||
// (e.g. something like DeviceRGBA) in order avoid any conversion (i.e. no
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue