1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | "use strict";
|
23 |
|
24 | Object.defineProperty(exports, "__esModule", {
|
25 | value: true
|
26 | });
|
27 | exports.AnnotationEditorParams = void 0;
|
28 |
|
29 | var _pdf = require("../pdf");
|
30 |
|
31 | class AnnotationEditorParams {
|
32 | constructor(options, eventBus) {
|
33 | this.eventBus = eventBus;
|
34 | this.#bindListeners(options);
|
35 | }
|
36 |
|
37 | #bindListeners({
|
38 | editorFreeTextFontSize,
|
39 | editorFreeTextColor,
|
40 | editorInkColor,
|
41 | editorInkThickness,
|
42 | editorInkOpacity
|
43 | }) {
|
44 | editorFreeTextFontSize.addEventListener("input", evt => {
|
45 | this.eventBus.dispatch("switchannotationeditorparams", {
|
46 | source: this,
|
47 | type: _pdf.AnnotationEditorParamsType.FREETEXT_SIZE,
|
48 | value: editorFreeTextFontSize.valueAsNumber
|
49 | });
|
50 | });
|
51 | editorFreeTextColor.addEventListener("input", evt => {
|
52 | this.eventBus.dispatch("switchannotationeditorparams", {
|
53 | source: this,
|
54 | type: _pdf.AnnotationEditorParamsType.FREETEXT_COLOR,
|
55 | value: editorFreeTextColor.value
|
56 | });
|
57 | });
|
58 | editorInkColor.addEventListener("input", evt => {
|
59 | this.eventBus.dispatch("switchannotationeditorparams", {
|
60 | source: this,
|
61 | type: _pdf.AnnotationEditorParamsType.INK_COLOR,
|
62 | value: editorInkColor.value
|
63 | });
|
64 | });
|
65 | editorInkThickness.addEventListener("input", evt => {
|
66 | this.eventBus.dispatch("switchannotationeditorparams", {
|
67 | source: this,
|
68 | type: _pdf.AnnotationEditorParamsType.INK_THICKNESS,
|
69 | value: editorInkThickness.valueAsNumber
|
70 | });
|
71 | });
|
72 | editorInkOpacity.addEventListener("input", evt => {
|
73 | this.eventBus.dispatch("switchannotationeditorparams", {
|
74 | source: this,
|
75 | type: _pdf.AnnotationEditorParamsType.INK_OPACITY,
|
76 | value: editorInkOpacity.valueAsNumber
|
77 | });
|
78 | });
|
79 |
|
80 | this.eventBus._on("annotationeditorparamschanged", evt => {
|
81 | for (const [type, value] of evt.details) {
|
82 | switch (type) {
|
83 | case _pdf.AnnotationEditorParamsType.FREETEXT_SIZE:
|
84 | editorFreeTextFontSize.value = value;
|
85 | break;
|
86 |
|
87 | case _pdf.AnnotationEditorParamsType.FREETEXT_COLOR:
|
88 | editorFreeTextColor.value = value;
|
89 | break;
|
90 |
|
91 | case _pdf.AnnotationEditorParamsType.INK_COLOR:
|
92 | editorInkColor.value = value;
|
93 | break;
|
94 |
|
95 | case _pdf.AnnotationEditorParamsType.INK_THICKNESS:
|
96 | editorInkThickness.value = value;
|
97 | break;
|
98 |
|
99 | case _pdf.AnnotationEditorParamsType.INK_OPACITY:
|
100 | editorInkOpacity.value = value;
|
101 | break;
|
102 | }
|
103 | }
|
104 | });
|
105 | }
|
106 |
|
107 | }
|
108 |
|
109 | exports.AnnotationEditorParams = AnnotationEditorParams; |
\ | No newline at end of file |