mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
[Editor] Add a basic stamp editor (bug 1790255)
For now it allows to add a stamp annotation with an image selected from the file system.
This commit is contained in:
parent
2a837ba0b5
commit
37bd78c707
19 changed files with 754 additions and 39 deletions
|
@ -90,6 +90,18 @@ class Toolbar {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
element: options.editorStampButton,
|
||||
eventName: "switchannotationeditormode",
|
||||
eventDetails: {
|
||||
get mode() {
|
||||
const { classList } = options.editorStampButton;
|
||||
return classList.contains("toggled")
|
||||
? AnnotationEditorType.NONE
|
||||
: AnnotationEditorType.STAMP;
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||
this.buttons.push({ element: options.openFile, eventName: "openfile" });
|
||||
|
@ -205,6 +217,7 @@ class Toolbar {
|
|||
editorFreeTextParamsToolbar,
|
||||
editorInkButton,
|
||||
editorInkParamsToolbar,
|
||||
editorStampButton,
|
||||
}) {
|
||||
const editorModeChanged = ({ mode }) => {
|
||||
toggleCheckedBtn(
|
||||
|
@ -217,10 +230,12 @@ class Toolbar {
|
|||
mode === AnnotationEditorType.INK,
|
||||
editorInkParamsToolbar
|
||||
);
|
||||
toggleCheckedBtn(editorStampButton, mode === AnnotationEditorType.STAMP);
|
||||
|
||||
const isDisable = mode === AnnotationEditorType.DISABLE;
|
||||
editorFreeTextButton.disabled = isDisable;
|
||||
editorInkButton.disabled = isDisable;
|
||||
editorStampButton.disabled = isDisable;
|
||||
};
|
||||
this.eventBus._on("annotationeditormodechanged", editorModeChanged);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue