@syncfusion/ej2-image-editor 21.2.10 → 22.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -0
- package/CHANGELOG.md +6 -38
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +19163 -12410
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +19198 -12414
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/image-editor/action/crop.d.ts +35 -0
- package/src/image-editor/action/crop.js +818 -0
- package/src/image-editor/action/draw.d.ts +122 -0
- package/src/image-editor/action/draw.js +3253 -0
- package/src/image-editor/action/export.d.ts +23 -0
- package/src/image-editor/action/export.js +364 -0
- package/src/image-editor/action/filter.d.ts +35 -0
- package/src/image-editor/action/filter.js +699 -0
- package/src/image-editor/action/freehand-draw.d.ts +61 -0
- package/src/image-editor/action/freehand-draw.js +1015 -0
- package/src/image-editor/action/index.d.ts +9 -0
- package/src/image-editor/action/index.js +9 -0
- package/src/image-editor/action/selection.d.ts +140 -0
- package/src/image-editor/action/selection.js +4689 -0
- package/src/image-editor/action/shape.d.ts +93 -0
- package/src/image-editor/action/shape.js +2657 -0
- package/src/image-editor/action/transform.d.ts +67 -0
- package/src/image-editor/action/transform.js +1670 -0
- package/src/image-editor/action/undo-redo.d.ts +43 -0
- package/src/image-editor/action/undo-redo.js +800 -0
- package/src/image-editor/base/enum.d.ts +189 -0
- package/src/image-editor/base/enum.js +198 -0
- package/src/image-editor/{image-editor-model.d.ts → base/image-editor-model.d.ts} +131 -43
- package/src/image-editor/{image-editor.d.ts → base/image-editor.d.ts} +425 -1108
- package/src/image-editor/base/image-editor.js +2458 -0
- package/src/image-editor/base/index.d.ts +4 -0
- package/src/image-editor/base/index.js +2 -0
- package/src/image-editor/base/interface.d.ts +1120 -0
- package/src/image-editor/base/interface.js +1 -0
- package/src/image-editor/index.d.ts +3 -5
- package/src/image-editor/index.js +3 -4
- package/src/image-editor/renderer/index.d.ts +1 -0
- package/src/image-editor/renderer/index.js +1 -0
- package/src/image-editor/renderer/toolbar.d.ts +105 -0
- package/src/image-editor/renderer/toolbar.js +3019 -0
- package/styles/bootstrap-dark.css +69 -3
- package/styles/bootstrap.css +69 -3
- package/styles/bootstrap4.css +69 -3
- package/styles/bootstrap5-dark.css +69 -3
- package/styles/bootstrap5.css +69 -3
- package/styles/fabric-dark.css +69 -3
- package/styles/fabric.css +69 -3
- package/styles/fluent-dark.css +69 -3
- package/styles/fluent.css +69 -3
- package/styles/highcontrast-light.css +69 -3
- package/styles/highcontrast.css +69 -7
- package/styles/image-editor/_layout.scss +21 -7
- package/styles/image-editor/_material3-dark-definition.scss +1 -0
- package/styles/image-editor/_material3-definition.scss +11 -0
- package/styles/image-editor/_theme.scss +9 -2
- package/styles/image-editor/bootstrap-dark.css +69 -3
- package/styles/image-editor/bootstrap.css +69 -3
- package/styles/image-editor/bootstrap4.css +69 -3
- package/styles/image-editor/bootstrap5-dark.css +69 -3
- package/styles/image-editor/bootstrap5.css +69 -3
- package/styles/image-editor/fabric-dark.css +69 -3
- package/styles/image-editor/fabric.css +69 -3
- package/styles/image-editor/fluent-dark.css +69 -3
- package/styles/image-editor/fluent.css +69 -3
- package/styles/image-editor/highcontrast-light.css +69 -3
- package/styles/image-editor/highcontrast.css +69 -7
- package/styles/image-editor/icons/_bootstrap-dark.scss +132 -0
- package/styles/image-editor/icons/_bootstrap.scss +132 -0
- package/styles/image-editor/icons/_bootstrap4.scss +132 -0
- package/styles/image-editor/icons/_bootstrap5.scss +132 -0
- package/styles/image-editor/icons/_fabric-dark.scss +132 -0
- package/styles/image-editor/icons/_fabric.scss +132 -0
- package/styles/image-editor/icons/_fluent.scss +132 -0
- package/styles/image-editor/icons/_fusionnew.scss +132 -0
- package/styles/image-editor/icons/_highcontrast-light.scss +132 -0
- package/styles/image-editor/icons/_highcontrast.scss +132 -0
- package/styles/image-editor/icons/_material-dark.scss +132 -0
- package/styles/image-editor/icons/_material.scss +132 -0
- package/styles/image-editor/icons/_material3-dark.scss +1 -0
- package/styles/image-editor/icons/_material3.scss +133 -1
- package/styles/image-editor/icons/_tailwind.scss +132 -0
- package/styles/image-editor/material-dark.css +69 -3
- package/styles/image-editor/material.css +69 -3
- package/styles/image-editor/material3-dark.css +453 -0
- package/styles/image-editor/material3-dark.scss +14 -0
- package/styles/image-editor/material3.css +509 -0
- package/styles/image-editor/material3.scss +14 -0
- package/styles/image-editor/tailwind-dark.css +69 -3
- package/styles/image-editor/tailwind.css +69 -3
- package/styles/material-dark.css +69 -3
- package/styles/material.css +69 -3
- package/styles/material3-dark.css +453 -0
- package/styles/material3-dark.scss +3 -0
- package/styles/material3.css +509 -0
- package/styles/material3.scss +3 -0
- package/styles/tailwind-dark.css +69 -3
- package/styles/tailwind.css +69 -3
- package/src/image-editor/image-editor.js +0 -14827
|
@@ -0,0 +1,3019 @@
|
|
|
1
|
+
import { extend, Browser, detach, select } from '@syncfusion/ej2-base';
|
|
2
|
+
import { EventHandler, getComponent, isNullOrUndefined, L10n } from '@syncfusion/ej2-base';
|
|
3
|
+
import { Toolbar } from '@syncfusion/ej2-navigations';
|
|
4
|
+
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
5
|
+
import { ColorPicker, Uploader, Slider } from '@syncfusion/ej2-inputs';
|
|
6
|
+
import { ZoomTrigger } from '../index';
|
|
7
|
+
import { hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
|
|
8
|
+
var ToolbarModule = /** @class */ (function () {
|
|
9
|
+
function ToolbarModule(parent) {
|
|
10
|
+
this.defToolbarItems = [];
|
|
11
|
+
this.toolbarHeight = 46;
|
|
12
|
+
this.currToolbar = '';
|
|
13
|
+
this.preventZoomBtn = false;
|
|
14
|
+
this.currentToolbar = 'main';
|
|
15
|
+
this.selFhdColor = '#42a5f5';
|
|
16
|
+
this.preventEnableDisableUr = false;
|
|
17
|
+
this.parent = parent;
|
|
18
|
+
this.addEventListener();
|
|
19
|
+
this.initLocale();
|
|
20
|
+
}
|
|
21
|
+
ToolbarModule.prototype.destroy = function () {
|
|
22
|
+
if (this.parent.isDestroyed) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.removeEventListener();
|
|
26
|
+
};
|
|
27
|
+
ToolbarModule.prototype.addEventListener = function () {
|
|
28
|
+
this.parent.on('toolbar', this.toolbar, this);
|
|
29
|
+
this.parent.on('destroyed', this.destroy, this);
|
|
30
|
+
};
|
|
31
|
+
ToolbarModule.prototype.removeEventListener = function () {
|
|
32
|
+
this.parent.off('toolbar', this.toolbar);
|
|
33
|
+
this.parent.off('destroyed', this.destroy);
|
|
34
|
+
};
|
|
35
|
+
ToolbarModule.prototype.initLocale = function () {
|
|
36
|
+
this.defaultLocale = {
|
|
37
|
+
Crop: 'Crop',
|
|
38
|
+
ZoomIn: 'Zoom In',
|
|
39
|
+
ZoomOut: 'Zoom Out',
|
|
40
|
+
Undo: 'Undo',
|
|
41
|
+
Redo: 'Redo',
|
|
42
|
+
Transform: 'Transform',
|
|
43
|
+
Annotation: 'Annotation',
|
|
44
|
+
Finetune: 'Finetune',
|
|
45
|
+
Brightness: 'Brightness',
|
|
46
|
+
Contrast: 'Contrast',
|
|
47
|
+
Hue: 'Hue',
|
|
48
|
+
Saturation: 'Saturation',
|
|
49
|
+
Opacity: 'Opacity',
|
|
50
|
+
Blur: 'Blur',
|
|
51
|
+
Sharpen: 'Sharpen',
|
|
52
|
+
Exposure: 'Exposure',
|
|
53
|
+
Filter: 'Filter',
|
|
54
|
+
Default: 'Default',
|
|
55
|
+
Chrome: 'Chrome',
|
|
56
|
+
Cold: 'Cold',
|
|
57
|
+
Warm: 'Warm',
|
|
58
|
+
Grayscale: 'Grayscale',
|
|
59
|
+
BlackAndWhite: 'Black and White',
|
|
60
|
+
Sepia: 'Sepia',
|
|
61
|
+
Invert: 'Invert',
|
|
62
|
+
Text: 'Add Text',
|
|
63
|
+
Pen: 'Pen',
|
|
64
|
+
Reset: 'Reset',
|
|
65
|
+
Save: 'Save',
|
|
66
|
+
Select: 'Select',
|
|
67
|
+
RotateLeft: 'Rotate Left',
|
|
68
|
+
RotateRight: 'Rotate Right',
|
|
69
|
+
HorizontalFlip: 'Horizontal Flip',
|
|
70
|
+
VerticalFlip: 'Vertical Flip',
|
|
71
|
+
OK: 'OK',
|
|
72
|
+
Cancel: 'Cancel',
|
|
73
|
+
FillColor: 'Fill Color',
|
|
74
|
+
StrokeColor: 'Stroke Color',
|
|
75
|
+
StrokeWidth: 'Stroke Width',
|
|
76
|
+
FontFamily: 'Font Family',
|
|
77
|
+
FontStyle: 'Font Style',
|
|
78
|
+
FontSize: 'Font Size',
|
|
79
|
+
FontColor: 'Font Color',
|
|
80
|
+
Pan: 'Pan',
|
|
81
|
+
Move: 'Move',
|
|
82
|
+
Load: 'Load',
|
|
83
|
+
Custom: 'Custom',
|
|
84
|
+
Square: 'Square',
|
|
85
|
+
Circle: 'Circle',
|
|
86
|
+
Ellipse: 'Ellipse',
|
|
87
|
+
Rectangle: 'Rectangle',
|
|
88
|
+
Line: 'Line',
|
|
89
|
+
Arrow: 'Arrow',
|
|
90
|
+
Path: 'Path',
|
|
91
|
+
Bold: 'Bold',
|
|
92
|
+
Italic: 'Italic',
|
|
93
|
+
BoldItalic: 'Bold Italic',
|
|
94
|
+
XSmall: 'X-Small',
|
|
95
|
+
Small: 'Small',
|
|
96
|
+
Medium: 'Medium',
|
|
97
|
+
Large: 'Large',
|
|
98
|
+
XLarge: 'X-Large',
|
|
99
|
+
ABC: 'ABC',
|
|
100
|
+
Browse: 'Browse',
|
|
101
|
+
Duplicate: 'Duplicate',
|
|
102
|
+
Remove: 'Remove',
|
|
103
|
+
EditText: 'Edit Text',
|
|
104
|
+
Start: 'Start',
|
|
105
|
+
End: 'End',
|
|
106
|
+
Bar: 'Bar',
|
|
107
|
+
ArrowSolid: 'Arrow Solid',
|
|
108
|
+
CircleSolid: 'Circle Solid',
|
|
109
|
+
SquareSolid: 'Square Solid',
|
|
110
|
+
None: 'None',
|
|
111
|
+
CropAndTransform: 'Crop and Transform',
|
|
112
|
+
CropSelection: 'Crop Selection'
|
|
113
|
+
};
|
|
114
|
+
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
115
|
+
};
|
|
116
|
+
ToolbarModule.prototype.toolbar = function (args) {
|
|
117
|
+
this.updatePrivateVariables();
|
|
118
|
+
switch (args.prop) {
|
|
119
|
+
case 'create-toolbar':
|
|
120
|
+
this.createToolbar();
|
|
121
|
+
break;
|
|
122
|
+
case 'create-contextual-toolbar':
|
|
123
|
+
this.createContextualToolbar();
|
|
124
|
+
break;
|
|
125
|
+
case 'update-toolbar-items':
|
|
126
|
+
this.updateToolbarItems();
|
|
127
|
+
break;
|
|
128
|
+
case 'refresh-toolbar':
|
|
129
|
+
this.refreshToolbar(args.value['type'], args.value['isApplyBtn'], args.value['isCropping'], args.value['isZooming'], args.value['cType']);
|
|
130
|
+
break;
|
|
131
|
+
case 'renderQAT':
|
|
132
|
+
this.renderQAT(args.value['isPenEdit']);
|
|
133
|
+
break;
|
|
134
|
+
case 'enable-disable-btns':
|
|
135
|
+
this.enableDisableTbrBtn();
|
|
136
|
+
break;
|
|
137
|
+
case 'init-main-toolbar':
|
|
138
|
+
this.initMainToolbar(args.value['isApplyBtn'], args.value['isDevice'], args.value['isOkBtn']);
|
|
139
|
+
break;
|
|
140
|
+
case 'create-bottom-toolbar':
|
|
141
|
+
this.createBottomToolbar();
|
|
142
|
+
break;
|
|
143
|
+
case 'refresh-main-toolbar':
|
|
144
|
+
this.refreshMainToolbar();
|
|
145
|
+
break;
|
|
146
|
+
case 'create-qa-toolbar':
|
|
147
|
+
this.createQuickAccessToolbar();
|
|
148
|
+
break;
|
|
149
|
+
case 'destroy-qa-toolbar':
|
|
150
|
+
this.destroyQuickAccessToolbar();
|
|
151
|
+
break;
|
|
152
|
+
case 'zoom-up-handler':
|
|
153
|
+
this.zoomBtnMouseUpHandler();
|
|
154
|
+
break;
|
|
155
|
+
case 'refresh-dropdown-btn':
|
|
156
|
+
this.refreshDropDownBtn(args.value['isDisabled']);
|
|
157
|
+
break;
|
|
158
|
+
case 'close-contextual-toolbar':
|
|
159
|
+
this.closeContextualToolbar();
|
|
160
|
+
break;
|
|
161
|
+
case 'destroy-bottom-toolbar':
|
|
162
|
+
this.destroyBottomToolbar();
|
|
163
|
+
break;
|
|
164
|
+
case 'destroy-top-toolbar':
|
|
165
|
+
this.destroyTopToolbar();
|
|
166
|
+
break;
|
|
167
|
+
case 'destroySubComponents':
|
|
168
|
+
this.destroySubComponents();
|
|
169
|
+
break;
|
|
170
|
+
case 'setLocale':
|
|
171
|
+
this.l10n.setLocale(args.value['locale']);
|
|
172
|
+
break;
|
|
173
|
+
case 'setPreventZoomBtn':
|
|
174
|
+
this.preventZoomBtn = args.value['isPrevent'];
|
|
175
|
+
break;
|
|
176
|
+
case 'getToolbarHeight':
|
|
177
|
+
args.value['obj']['toolbarHeight'] = this.toolbarHeight;
|
|
178
|
+
break;
|
|
179
|
+
case 'setToolbarHeight':
|
|
180
|
+
this.toolbarHeight = args.value['height'];
|
|
181
|
+
break;
|
|
182
|
+
case 'setCurrentToolbar':
|
|
183
|
+
this.currentToolbar = args.value['type'];
|
|
184
|
+
break;
|
|
185
|
+
case 'setSelectedFreehandColor':
|
|
186
|
+
this.selFhdColor = args.value['color'];
|
|
187
|
+
break;
|
|
188
|
+
case 'getCurrentFilter':
|
|
189
|
+
args.value['obj']['currentFilter'] = this.parent.currentFilter;
|
|
190
|
+
break;
|
|
191
|
+
case 'setCurrentFilter':
|
|
192
|
+
this.parent.currentFilter = args.value['filter'];
|
|
193
|
+
break;
|
|
194
|
+
case 'setInitialAdjustmentValue':
|
|
195
|
+
this.parent.initialAdjustmentValue = args.value['value'];
|
|
196
|
+
break;
|
|
197
|
+
case 'getCanvasFilter':
|
|
198
|
+
args.value['obj']['canvasFilter'] = this.parent.canvasFilter;
|
|
199
|
+
break;
|
|
200
|
+
case 'setCanvasFilter':
|
|
201
|
+
this.parent.canvasFilter = args.value['filter'];
|
|
202
|
+
break;
|
|
203
|
+
case 'getDefToolbarItems':
|
|
204
|
+
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
205
|
+
break;
|
|
206
|
+
case 'getPenStroke':
|
|
207
|
+
this.getPenStroke(args.value['value']);
|
|
208
|
+
break;
|
|
209
|
+
case 'performDefToolbarClickAction':
|
|
210
|
+
this.performDefTbrClick(args.value['type'], args.value['isContextualToolbar'], args.value['isDisabledAdjustment'], args.value['isDisabledFilter'], args.value['isFilterFinetune']);
|
|
211
|
+
break;
|
|
212
|
+
case 'setTempFilterProperties':
|
|
213
|
+
this.parent.setTempFilterProperties();
|
|
214
|
+
break;
|
|
215
|
+
case 'refreshSlider':
|
|
216
|
+
this.refreshSlider();
|
|
217
|
+
break;
|
|
218
|
+
case 'renderSlider':
|
|
219
|
+
this.renderSlider(args.value['type']);
|
|
220
|
+
break;
|
|
221
|
+
case 'getCurrAdjustmentValue':
|
|
222
|
+
this.parent.getCurrAdjustmentValue(args.value['type']);
|
|
223
|
+
break;
|
|
224
|
+
case 'setCurrAdjustmentValue':
|
|
225
|
+
this.parent.setCurrAdjustmentValue(args.value['type'], args.value['value']);
|
|
226
|
+
break;
|
|
227
|
+
case 'refreshShapeDrawing':
|
|
228
|
+
this.refreshShapeDrawing();
|
|
229
|
+
break;
|
|
230
|
+
case 'getSquarePointForRotatedShape':
|
|
231
|
+
this.parent.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
|
|
232
|
+
break;
|
|
233
|
+
case 'getCropToolbar':
|
|
234
|
+
args.value['obj']['isCropToolbar'] = this.parent.isCropToolbar;
|
|
235
|
+
break;
|
|
236
|
+
case 'getPrevCurrSelectionPoint':
|
|
237
|
+
args.value['obj']['prevCurrSelectionPoint'] = this.parent.prevCurrSelectionPoint;
|
|
238
|
+
break;
|
|
239
|
+
case 'setPrevCurrSelectionPoint':
|
|
240
|
+
this.parent.prevCurrSelectionPoint = args.value['point'];
|
|
241
|
+
break;
|
|
242
|
+
case 'updateCropTransformItems':
|
|
243
|
+
this.parent.updateCropTransformItems();
|
|
244
|
+
break;
|
|
245
|
+
case 'setEnableDisableUndoRedo':
|
|
246
|
+
this.preventEnableDisableUr = args.value['isPrevent'];
|
|
247
|
+
break;
|
|
248
|
+
case 'reset':
|
|
249
|
+
this.reset();
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
ToolbarModule.prototype.updatePrivateVariables = function () {
|
|
254
|
+
var parent = this.parent;
|
|
255
|
+
this.inMemoryCanvas = parent.inMemoryCanvas;
|
|
256
|
+
if (!isNullOrUndefined(parent.lowerCanvas)) {
|
|
257
|
+
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
258
|
+
}
|
|
259
|
+
if (!isNullOrUndefined(parent.upperCanvas)) {
|
|
260
|
+
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
261
|
+
}
|
|
262
|
+
if (!isNullOrUndefined(this.inMemoryCanvas)) {
|
|
263
|
+
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
ToolbarModule.prototype.reset = function () {
|
|
267
|
+
this.defToolbarItems = [];
|
|
268
|
+
this.toolbarHeight = 46;
|
|
269
|
+
this.parent.prevCurrSelectionPoint = null;
|
|
270
|
+
this.zoomBtnHold = null;
|
|
271
|
+
this.currToolbar = '';
|
|
272
|
+
this.currentToolbar = 'main';
|
|
273
|
+
this.selFhdColor = '#42a5f5';
|
|
274
|
+
this.parent.currentFilter = '';
|
|
275
|
+
this.preventZoomBtn = this.parent.isCropToolbar = this.preventEnableDisableUr = false;
|
|
276
|
+
this.parent.initialAdjustmentValue = this.parent.canvasFilter =
|
|
277
|
+
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
278
|
+
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
279
|
+
};
|
|
280
|
+
ToolbarModule.prototype.destroyTopToolbar = function () {
|
|
281
|
+
var parent = this.parent;
|
|
282
|
+
if (this.isToolbar() && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar'))) &&
|
|
283
|
+
(!isNullOrUndefined(getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar')))) {
|
|
284
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
ToolbarModule.prototype.destroyBottomToolbar = function () {
|
|
288
|
+
var parent = this.parent;
|
|
289
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar')) &&
|
|
290
|
+
(!isNullOrUndefined(getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar')))) {
|
|
291
|
+
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
ToolbarModule.prototype.isToolbar = function () {
|
|
295
|
+
return (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.length > 0)
|
|
296
|
+
|| !isNullOrUndefined(this.parent.toolbarTemplate));
|
|
297
|
+
};
|
|
298
|
+
ToolbarModule.prototype.createToolbar = function () {
|
|
299
|
+
var _this = this;
|
|
300
|
+
var parent = this.parent;
|
|
301
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
|
|
302
|
+
parent.element.appendChild(parent.createElement('div', {
|
|
303
|
+
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
304
|
+
}));
|
|
305
|
+
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
306
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
307
|
+
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
308
|
+
this.defToolbarItems = [];
|
|
309
|
+
}
|
|
310
|
+
this.defToolbarItems.push(toolbarItems);
|
|
311
|
+
var toolbarArea = document.getElementById(parent.element.id + '_toolbarArea');
|
|
312
|
+
var toolbar_1 = parent.createElement('div', {
|
|
313
|
+
id: parent.element.id + '_toolbar'
|
|
314
|
+
});
|
|
315
|
+
toolbarArea.appendChild(toolbar_1);
|
|
316
|
+
var uploadItems = [
|
|
317
|
+
{
|
|
318
|
+
cssClass: 'e-image-upload',
|
|
319
|
+
align: 'Left', type: 'Input',
|
|
320
|
+
tooltipText: this.l10n.getConstant('Browse'),
|
|
321
|
+
template: new Uploader({
|
|
322
|
+
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
323
|
+
selected: function () {
|
|
324
|
+
if (!parent.disabled) {
|
|
325
|
+
if (Browser.isDevice) {
|
|
326
|
+
if (_this.defToolbarItems.length > 0 &&
|
|
327
|
+
(!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
328
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
329
|
+
}
|
|
330
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar'))) {
|
|
331
|
+
getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
332
|
+
}
|
|
333
|
+
_this.initMainToolbar(false, Browser.isDevice, null);
|
|
334
|
+
_this.createBottomToolbar();
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
if (_this.defToolbarItems.length > 0 &&
|
|
338
|
+
(!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
339
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
340
|
+
}
|
|
341
|
+
_this.initMainToolbar(false, false, null);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
];
|
|
348
|
+
var toolbarObj = new Toolbar({ items: uploadItems, width: '100%',
|
|
349
|
+
created: function () {
|
|
350
|
+
parent.trigger('toolbarCreated', { toolbarType: 'main' });
|
|
351
|
+
},
|
|
352
|
+
clicked: this.defToolbarClicked.bind(this) });
|
|
353
|
+
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
354
|
+
this.createLeftToolbarControls();
|
|
355
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar'))) {
|
|
356
|
+
this.toolbarHeight = document.getElementById(parent.element.id + '_toolbar').clientHeight;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
this.toolbarHeight = 0;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
ToolbarModule.prototype.createContextualToolbar = function () {
|
|
364
|
+
var parent = this.parent;
|
|
365
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
|
|
366
|
+
parent.element.appendChild(parent.createElement('div', { id: parent.element.id + '_contextualToolbarArea',
|
|
367
|
+
className: 'e-contextual-toolbar-wrapper e-hide', attrs: { style: 'position: absolute;' }
|
|
368
|
+
}));
|
|
369
|
+
var toolbarArea = document.getElementById(parent.element.id + '_contextualToolbarArea');
|
|
370
|
+
var toolbar_2 = parent.createElement('div', { id: parent.element.id + '_contextualToolbar' });
|
|
371
|
+
toolbarArea.appendChild(toolbar_2);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
ToolbarModule.prototype.createBottomToolbar = function () {
|
|
375
|
+
var parent = this.parent;
|
|
376
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
|
|
377
|
+
parent.element.appendChild(parent.createElement('div', {
|
|
378
|
+
id: parent.element.id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
|
|
379
|
+
}));
|
|
380
|
+
if (!parent.toolbarTemplate) {
|
|
381
|
+
document.getElementById(parent.element.id + '_canvasWrapper').style.height = (parent.element.offsetHeight
|
|
382
|
+
- this.toolbarHeight * 2) - 3 + 'px';
|
|
383
|
+
var toolbarArea = document.getElementById(parent.element.id + '_bottomToolbarArea');
|
|
384
|
+
var toolbarElem = parent.createElement('div', {
|
|
385
|
+
id: parent.element.id + '_bottomToolbar'
|
|
386
|
+
});
|
|
387
|
+
toolbarArea.appendChild(toolbarElem);
|
|
388
|
+
}
|
|
389
|
+
this.initBottomToolbar();
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
ToolbarModule.prototype.createQuickAccessToolbar = function () {
|
|
393
|
+
var parent = this.parent;
|
|
394
|
+
if (parent.showQuickAccessToolbar) {
|
|
395
|
+
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
396
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
397
|
+
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
398
|
+
this.defToolbarItems = [];
|
|
399
|
+
}
|
|
400
|
+
this.defToolbarItems.push(toolbarItems);
|
|
401
|
+
var toolbarArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
402
|
+
var toolbar_3 = parent.createElement('div', {
|
|
403
|
+
id: parent.element.id + '_quickAccessToolbar'
|
|
404
|
+
});
|
|
405
|
+
toolbarArea.appendChild(toolbar_3);
|
|
406
|
+
var toolbarObj = new Toolbar({ clicked: this.defToolbarClicked.bind(this) });
|
|
407
|
+
toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
ToolbarModule.prototype.initMainToolbar = function (isApplyOption, isDevice, isOkBtn) {
|
|
411
|
+
var _this = this;
|
|
412
|
+
var parent = this.parent;
|
|
413
|
+
if (this.isToolbar()) {
|
|
414
|
+
var leftItem = this.getLeftToolbarItem(isOkBtn);
|
|
415
|
+
var rightItem = this.getRightToolbarItem(isOkBtn);
|
|
416
|
+
var mainItem = this.getMainToolbarItem(isApplyOption);
|
|
417
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
418
|
+
if (isDevice) {
|
|
419
|
+
this.defToolbarItems = leftItem.concat(rightItem);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
this.defToolbarItems = leftItem.concat(mainItem, rightItem, zoomItem);
|
|
423
|
+
}
|
|
424
|
+
var toolbarObj = new Toolbar({
|
|
425
|
+
width: '100%',
|
|
426
|
+
items: this.defToolbarItems,
|
|
427
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
428
|
+
created: function () {
|
|
429
|
+
if (!isDevice) {
|
|
430
|
+
_this.renderAnnotationBtn();
|
|
431
|
+
}
|
|
432
|
+
_this.wireZoomBtnEvents();
|
|
433
|
+
_this.renderSaveBtn();
|
|
434
|
+
parent.trigger('toolbarCreated', { toolbarType: 'main' });
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
438
|
+
this.createLeftToolbarControls();
|
|
439
|
+
this.enableDisableTbrBtn();
|
|
440
|
+
if (this.isToolbar() && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
441
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
442
|
+
var toolbar_4 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
443
|
+
toolbar_4.refreshOverflow();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
ToolbarModule.prototype.initBottomToolbar = function () {
|
|
448
|
+
var _this = this;
|
|
449
|
+
var parent = this.parent;
|
|
450
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
|
|
451
|
+
var items = this.getMainToolbarItem();
|
|
452
|
+
var toolbarObj = new Toolbar({ items: items, width: '100%',
|
|
453
|
+
created: function () {
|
|
454
|
+
_this.renderAnnotationBtn();
|
|
455
|
+
_this.renderCropBtn();
|
|
456
|
+
_this.renderTransformBtn();
|
|
457
|
+
parent.trigger('toolbarCreated', { toolbarType: 'main' });
|
|
458
|
+
},
|
|
459
|
+
clicked: this.defToolbarClicked.bind(this)
|
|
460
|
+
});
|
|
461
|
+
toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
462
|
+
if (this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar')))) {
|
|
463
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
464
|
+
var toolbar_5 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
465
|
+
toolbar_5.refreshOverflow();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
ToolbarModule.prototype.getLeftToolbarItem = function (isOkBtn) {
|
|
470
|
+
var parent = this.parent;
|
|
471
|
+
var toolbarItems = [];
|
|
472
|
+
if (!isOkBtn) {
|
|
473
|
+
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) });
|
|
474
|
+
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
475
|
+
}
|
|
476
|
+
if (parent.allowUndoRedo) {
|
|
477
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Undo') > -1)) {
|
|
478
|
+
toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
|
|
479
|
+
tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
|
|
480
|
+
}
|
|
481
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Redo') > -1)) {
|
|
482
|
+
toolbarItems.push({ id: parent.element.id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
|
|
483
|
+
tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
487
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('ZoomOut') > -1)) {
|
|
488
|
+
toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
|
|
489
|
+
tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
|
|
490
|
+
}
|
|
491
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('ZoomIn') > -1)) {
|
|
492
|
+
toolbarItems.push({ id: parent.element.id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
|
|
493
|
+
tooltipText: this.l10n.getConstant('ZoomIn'), align: 'Left' });
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
var tempToolbarItems = this.processToolbar('left');
|
|
497
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
498
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
499
|
+
}
|
|
500
|
+
return toolbarItems;
|
|
501
|
+
};
|
|
502
|
+
ToolbarModule.prototype.getRightToolbarItem = function (isOkBtn) {
|
|
503
|
+
var parent = this.parent;
|
|
504
|
+
var toolbarItems = [];
|
|
505
|
+
if (isOkBtn) {
|
|
506
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
507
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
508
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
509
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
510
|
+
}
|
|
511
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Reset') > -1)) {
|
|
512
|
+
toolbarItems.push({ id: parent.element.id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
|
|
513
|
+
tooltipText: this.l10n.getConstant('Reset'), align: 'Right' });
|
|
514
|
+
}
|
|
515
|
+
if (!isOkBtn) {
|
|
516
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Save') > -1)) {
|
|
517
|
+
toolbarItems.push({ id: parent.element.id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
|
|
518
|
+
tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + parent.element.id + '_saveBtn"></button>' });
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
var tempToolbarItems = this.processToolbar('right');
|
|
522
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
523
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
524
|
+
}
|
|
525
|
+
return toolbarItems;
|
|
526
|
+
};
|
|
527
|
+
ToolbarModule.prototype.getMainToolbarItem = function (isApplyOption) {
|
|
528
|
+
var parent = this.parent;
|
|
529
|
+
var toolbarItems = [];
|
|
530
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Crop') > -1)) {
|
|
531
|
+
toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
|
|
532
|
+
tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
|
|
533
|
+
}
|
|
534
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Annotate') > -1)) {
|
|
535
|
+
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
536
|
+
template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
|
|
537
|
+
}
|
|
538
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Finetune') > -1)) {
|
|
539
|
+
toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
|
|
540
|
+
tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
|
|
541
|
+
}
|
|
542
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Filter') > -1)) {
|
|
543
|
+
toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
|
|
544
|
+
tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
|
|
545
|
+
}
|
|
546
|
+
var tempToolbarItems = this.processToolbar('center');
|
|
547
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
548
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
549
|
+
}
|
|
550
|
+
if (isApplyOption) {
|
|
551
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
552
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
553
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
554
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
555
|
+
}
|
|
556
|
+
return toolbarItems;
|
|
557
|
+
};
|
|
558
|
+
ToolbarModule.prototype.getZoomToolbarItem = function () {
|
|
559
|
+
var toolbarItems = [];
|
|
560
|
+
return toolbarItems;
|
|
561
|
+
};
|
|
562
|
+
ToolbarModule.prototype.updateContextualToolbar = function (type, cType) {
|
|
563
|
+
var parent = this.parent;
|
|
564
|
+
var toolbarArea = parent.element.querySelector('#' + parent.element.id + '_toolbarArea');
|
|
565
|
+
var contextualToolbarArea = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
|
|
566
|
+
contextualToolbarArea.classList.remove('e-hide');
|
|
567
|
+
contextualToolbarArea.style.left = toolbarArea.offsetLeft + 'px';
|
|
568
|
+
if (type === 'filter') {
|
|
569
|
+
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
570
|
+
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
571
|
+
}
|
|
572
|
+
if (Browser.isDevice) {
|
|
573
|
+
this.initMainToolbar(false, true, true);
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
this.initMainToolbar(true, null, null);
|
|
577
|
+
}
|
|
578
|
+
this.refreshSlider();
|
|
579
|
+
this.initFilterToolbarItem();
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
|
|
583
|
+
getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
|
|
584
|
+
}
|
|
585
|
+
this.refreshSlider();
|
|
586
|
+
this.renderSlider(cType);
|
|
587
|
+
}
|
|
588
|
+
if (Browser.isDevice) {
|
|
589
|
+
var cHt = contextualToolbarArea.offsetHeight;
|
|
590
|
+
var ht = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper').offsetHeight;
|
|
591
|
+
contextualToolbarArea.style.top = this.toolbarHeight + ht - cHt + 'px';
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
contextualToolbarArea.style.top = this.toolbarHeight + 'px';
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
ToolbarModule.prototype.processToolbar = function (position) {
|
|
598
|
+
var parent = this.parent;
|
|
599
|
+
var toolbarItems = [];
|
|
600
|
+
if (parent.toolbar) {
|
|
601
|
+
for (var i = 0, len = parent.toolbar.length; i < len; i++) {
|
|
602
|
+
if (typeof (parent.toolbar[i]) === 'object') {
|
|
603
|
+
if (isNullOrUndefined(parent.toolbar[i].align)) {
|
|
604
|
+
if (position === 'left') {
|
|
605
|
+
toolbarItems.push(this.parent.toolbar[i]);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
else if (parent.toolbar[i].align.toLowerCase() === position) {
|
|
609
|
+
toolbarItems.push(parent.toolbar[i]);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return toolbarItems;
|
|
615
|
+
};
|
|
616
|
+
ToolbarModule.prototype.processSubToolbar = function (items) {
|
|
617
|
+
var toolbarItems = [];
|
|
618
|
+
if (items) {
|
|
619
|
+
for (var i = 0, len = items.length; i < len; i++) {
|
|
620
|
+
if (typeof (items[i]) === 'object') {
|
|
621
|
+
items[i].align = 'Center';
|
|
622
|
+
toolbarItems.push(items[i]);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return toolbarItems;
|
|
627
|
+
};
|
|
628
|
+
ToolbarModule.prototype.wireZoomBtnEvents = function () {
|
|
629
|
+
var zoomIn = document.querySelector('#' + this.parent.element.id + '_zoomIn');
|
|
630
|
+
var zoomOut = document.querySelector('#' + this.parent.element.id + '_zoomOut');
|
|
631
|
+
if (!isNullOrUndefined(zoomIn)) {
|
|
632
|
+
zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
|
|
633
|
+
zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
634
|
+
zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
|
|
635
|
+
zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
|
|
636
|
+
}
|
|
637
|
+
if (!isNullOrUndefined(zoomOut)) {
|
|
638
|
+
zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
|
|
639
|
+
zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
|
|
640
|
+
zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
|
|
641
|
+
zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
ToolbarModule.prototype.enableDisableTbrBtn = function () {
|
|
645
|
+
var parent = this.parent;
|
|
646
|
+
if (!this.preventEnableDisableUr) {
|
|
647
|
+
var object = { appliedUndoRedoColl: [] };
|
|
648
|
+
parent.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
|
|
649
|
+
var undoRedoObj = { undoRedoStep: null };
|
|
650
|
+
parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
651
|
+
var undo = document.querySelector('#' + parent.element.id + '_undo');
|
|
652
|
+
if (!isNullOrUndefined(undo) && undoRedoObj['undoRedoStep'] === 0) {
|
|
653
|
+
undo.classList.add('e-disabled');
|
|
654
|
+
undo.parentElement.classList.add('e-overlay');
|
|
655
|
+
}
|
|
656
|
+
else if (!isNullOrUndefined(undo) && undoRedoObj['undoRedoStep'] > 0) {
|
|
657
|
+
undo.classList.remove('e-disabled');
|
|
658
|
+
undo.parentElement.classList.remove('e-overlay');
|
|
659
|
+
}
|
|
660
|
+
var redo = document.querySelector('#' + parent.element.id + '_redo');
|
|
661
|
+
if (!isNullOrUndefined(redo) && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
|
|
662
|
+
redo.classList.add('e-disabled');
|
|
663
|
+
redo.parentElement.classList.add('e-overlay');
|
|
664
|
+
}
|
|
665
|
+
else if (!isNullOrUndefined(redo) && (undoRedoObj['undoRedoStep'] === 0 && object['appliedUndoRedoColl'].length > 0)) {
|
|
666
|
+
redo.classList.remove('e-disabled');
|
|
667
|
+
redo.parentElement.classList.remove('e-overlay');
|
|
668
|
+
}
|
|
669
|
+
else if (!isNullOrUndefined(redo) && undoRedoObj['undoRedoStep'] > 0) {
|
|
670
|
+
redo.classList.remove('e-disabled');
|
|
671
|
+
redo.parentElement.classList.remove('e-overlay');
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
var zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
|
|
675
|
+
if (!isNullOrUndefined(zoomIn) && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
676
|
+
zoomIn.classList.add('e-disabled');
|
|
677
|
+
zoomIn.parentElement.classList.add('e-overlay');
|
|
678
|
+
}
|
|
679
|
+
else if (!isNullOrUndefined(zoomIn)) {
|
|
680
|
+
zoomIn.classList.remove('e-disabled');
|
|
681
|
+
zoomIn.parentElement.classList.remove('e-overlay');
|
|
682
|
+
}
|
|
683
|
+
var zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
|
|
684
|
+
if (!isNullOrUndefined(zoomOut) && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
685
|
+
zoomOut.classList.add('e-disabled');
|
|
686
|
+
zoomOut.parentElement.classList.add('e-overlay');
|
|
687
|
+
}
|
|
688
|
+
else if (!isNullOrUndefined(zoomOut)) {
|
|
689
|
+
zoomOut.classList.remove('e-disabled');
|
|
690
|
+
zoomOut.parentElement.classList.remove('e-overlay');
|
|
691
|
+
}
|
|
692
|
+
var pan = document.querySelector('#' + parent.element.id + '_pan');
|
|
693
|
+
if (!isNullOrUndefined(pan) && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
|
|
694
|
+
pan.style.display = 'none';
|
|
695
|
+
}
|
|
696
|
+
else if (!isNullOrUndefined(pan)) {
|
|
697
|
+
pan.style.display = 'block';
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
ToolbarModule.prototype.createLeftToolbarControls = function () {
|
|
701
|
+
var parent = this.parent;
|
|
702
|
+
if (this.defToolbarItems !== undefined && this.defToolbarItems.length > 0 &&
|
|
703
|
+
(!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
704
|
+
var uploadDiv = document.getElementById(parent.element.id + '_toolbar')
|
|
705
|
+
.querySelector('.e-image-upload');
|
|
706
|
+
if (uploadDiv) {
|
|
707
|
+
var uploadElem = uploadDiv.getElementsByTagName('input')[0];
|
|
708
|
+
var uploadBtnElem = uploadDiv.getElementsByTagName('button')[0];
|
|
709
|
+
uploadBtnElem.className = 'e-tbar-btn e-tbtn-txt top-icon';
|
|
710
|
+
uploadBtnElem.innerHTML = '';
|
|
711
|
+
uploadBtnElem.appendChild(parent.createElement('span', {
|
|
712
|
+
className: 'e-btn-icon e-icons e-upload-icon e-icon-left'
|
|
713
|
+
}));
|
|
714
|
+
uploadElem.onchange = this.fileSelect.bind(this, uploadElem);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
ToolbarModule.prototype.fileSelect = function (inputElement, args) {
|
|
719
|
+
this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
|
|
720
|
+
};
|
|
721
|
+
ToolbarModule.prototype.renderAnnotationBtn = function (isContextualToolbar) {
|
|
722
|
+
var _this = this;
|
|
723
|
+
var parent = this.parent;
|
|
724
|
+
var items = [];
|
|
725
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Pen') > -1)) {
|
|
726
|
+
items.push({ text: this.l10n.getConstant('Pen'), id: 'pen', iconCss: 'e-icons e-free-pen' });
|
|
727
|
+
}
|
|
728
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && parent.toolbar.indexOf('Line') > -1)) {
|
|
729
|
+
items.push({ text: this.l10n.getConstant('Line'), id: 'line', iconCss: 'e-icons e-line' });
|
|
730
|
+
}
|
|
731
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Rectangle') > -1)) {
|
|
732
|
+
items.push({ text: this.l10n.getConstant('Rectangle'), id: 'rectangle', iconCss: 'e-icons e-rectangle' });
|
|
733
|
+
}
|
|
734
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Ellipse') > -1)) {
|
|
735
|
+
items.push({ text: this.l10n.getConstant('Ellipse'), id: 'ellipse', iconCss: 'e-icons e-circle' });
|
|
736
|
+
}
|
|
737
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(toolbar) && parent.toolbar.indexOf('Arrow') > -1)) {
|
|
738
|
+
items.push({ text: this.l10n.getConstant('Arrow'), id: 'arrow', iconCss: 'e-icons e-arrow-right-up' });
|
|
739
|
+
}
|
|
740
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Path') > -1)) {
|
|
741
|
+
items.push({ text: this.l10n.getConstant('Path'), id: 'path', iconCss: 'e-icons e-critical-path' });
|
|
742
|
+
}
|
|
743
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Text') > -1)) {
|
|
744
|
+
items.push({ text: this.l10n.getConstant('Text'), id: 'text', iconCss: 'e-icons e-add-text' });
|
|
745
|
+
}
|
|
746
|
+
var obj = { freehandDrawSelectedId: null };
|
|
747
|
+
parent.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: obj } });
|
|
748
|
+
var duplicateElement = document.querySelector('#' + parent.element.id + '_duplicate');
|
|
749
|
+
var removeElement = document.querySelector('#' + parent.element.id + '_remove');
|
|
750
|
+
var editTextElement = document.querySelector('#' + parent.element.id + '_editText');
|
|
751
|
+
if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
|
|
752
|
+
(isNullOrUndefined(parent.activeObj.pointColl) || (!isNullOrUndefined(parent.activeObj.pointColl)
|
|
753
|
+
&& parent.activeObj.pointColl.length === 0)) &&
|
|
754
|
+
isNullOrUndefined(obj['freehandDrawSelectedId'])) {
|
|
755
|
+
if (duplicateElement) {
|
|
756
|
+
duplicateElement.classList.add('e-disabled');
|
|
757
|
+
}
|
|
758
|
+
if (removeElement) {
|
|
759
|
+
removeElement.classList.add('e-disabled');
|
|
760
|
+
}
|
|
761
|
+
if (editTextElement) {
|
|
762
|
+
editTextElement.classList.add('e-disabled');
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
if (duplicateElement) {
|
|
767
|
+
duplicateElement.classList.remove('e-disabled');
|
|
768
|
+
}
|
|
769
|
+
if (removeElement) {
|
|
770
|
+
removeElement.classList.remove('e-disabled');
|
|
771
|
+
}
|
|
772
|
+
if (editTextElement) {
|
|
773
|
+
editTextElement.classList.remove('e-disabled');
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
var iconCss = isContextualToolbar ? this.getCurrentShapeIcon(parent.activeObj.shape) : 'e-annotation';
|
|
777
|
+
var drpDownBtn = new DropDownButton({ items: items, iconCss: 'e-icons ' + iconCss,
|
|
778
|
+
cssClass: 'e-image-popup',
|
|
779
|
+
open: function (args) {
|
|
780
|
+
if (Browser.isDevice) {
|
|
781
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
782
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
783
|
+
}
|
|
784
|
+
if (!isNullOrUndefined(_this.parent.activeObj.shape)) {
|
|
785
|
+
document.getElementById(_this.parent.activeObj.shape).classList.add('e-selected');
|
|
786
|
+
}
|
|
787
|
+
else if (_this.parent.togglePen) {
|
|
788
|
+
document.getElementById('pen').classList.add('e-selected');
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
select: function (args) {
|
|
792
|
+
parent.okBtn();
|
|
793
|
+
var isCropSelection = false;
|
|
794
|
+
var splitWords;
|
|
795
|
+
if (parent.activeObj.shape !== undefined) {
|
|
796
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
797
|
+
}
|
|
798
|
+
if (splitWords === undefined && parent.currObjType.isCustomCrop) {
|
|
799
|
+
isCropSelection = true;
|
|
800
|
+
}
|
|
801
|
+
else if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
802
|
+
isCropSelection = true;
|
|
803
|
+
}
|
|
804
|
+
parent.currObjType.isCustomCrop = false;
|
|
805
|
+
if (isCropSelection || parent.togglePan) {
|
|
806
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
807
|
+
_this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
808
|
+
_this.refreshToolbar('main');
|
|
809
|
+
}
|
|
810
|
+
var obj = { currentFreehandDrawIndex: null };
|
|
811
|
+
parent.notify('freehand-draw', { prop: 'getCurrentFreehandDrawIndex', value: { obj: obj } });
|
|
812
|
+
drpDownBtn.iconCss = 'e-icons ' + _this.getCurrentShapeIcon(args.item.id);
|
|
813
|
+
switch (args.item.id) {
|
|
814
|
+
case 'pen':
|
|
815
|
+
parent.notify('draw', { prop: 'setTempFreehandCounter', value: { tempFreehandCounter: parent.freehandCounter } });
|
|
816
|
+
parent.notify('draw', { prop: 'setTempCurrentFreehandDrawIndex', value: { tempCurrentFreehandDrawIndex: obj['currentFreehandDrawIndex'] } });
|
|
817
|
+
_this.currentToolbar = 'pen';
|
|
818
|
+
parent.freeHandDraw(true);
|
|
819
|
+
break;
|
|
820
|
+
case 'text':
|
|
821
|
+
_this.currentToolbar = 'text';
|
|
822
|
+
parent.notify('shape', { prop: 'draw-shape-text' });
|
|
823
|
+
// this.setInitialShapeSettings(args);
|
|
824
|
+
// parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
825
|
+
// parent.notify('selection', {prop: 'annotate', value: {shape: args.item.id }});
|
|
826
|
+
// parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: {type: 'text',
|
|
827
|
+
// isApplyBtn: null, isCropping: null, isZooming: null, cType: null}});
|
|
828
|
+
break;
|
|
829
|
+
default:
|
|
830
|
+
_this.currentToolbar = 'shapes';
|
|
831
|
+
/// parent.notify('shape', { prop: 'draw-shape', value: {obj: (args.item.id).toLowerCase()}});
|
|
832
|
+
_this.setInitialShapeSettings(args);
|
|
833
|
+
parent.notify('selection', { prop: 'annotate', value: { shape: args.item.id } });
|
|
834
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
|
|
835
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
_this.updateToolbarItems();
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
// Render initialized DropDownButton.
|
|
842
|
+
drpDownBtn.appendTo('#' + this.parent.element.id + '_annotationBtn');
|
|
843
|
+
};
|
|
844
|
+
ToolbarModule.prototype.renderCropBtn = function () {
|
|
845
|
+
var _this = this;
|
|
846
|
+
var parent = this.parent;
|
|
847
|
+
var items = [];
|
|
848
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('CustomSelection') > -1)) {
|
|
849
|
+
items.push({ text: this.l10n.getConstant('Custom'), id: 'custom', iconCss: 'e-icons e-custom' });
|
|
850
|
+
}
|
|
851
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('CircleSelection') > -1)) {
|
|
852
|
+
items.push({ text: this.l10n.getConstant('Circle'), id: 'circle', iconCss: 'e-icons e-circle' });
|
|
853
|
+
}
|
|
854
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('SquareSelection') > -1)) {
|
|
855
|
+
items.push({ text: this.l10n.getConstant('Square'), id: 'square', iconCss: 'e-icons e-square' });
|
|
856
|
+
}
|
|
857
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('RatioSelection') > -1)) {
|
|
858
|
+
items.push({ text: '3:2', id: '3:2', iconCss: 'e-icons e-custom-a' });
|
|
859
|
+
items.push({ text: '4:3', id: '4:3', iconCss: 'e-icons e-custom-b' });
|
|
860
|
+
items.push({ text: '5:4', id: '5:4', iconCss: 'e-icons e-custom-c' });
|
|
861
|
+
items.push({ text: '7:5', id: '7:5', iconCss: 'e-icons e-custom-d' });
|
|
862
|
+
items.push({ text: '16:9', id: '16:9', iconCss: 'e-icons e-custom-e' });
|
|
863
|
+
}
|
|
864
|
+
var iconCss;
|
|
865
|
+
var shape;
|
|
866
|
+
if (!isNullOrUndefined(parent.activeObj.shape)) {
|
|
867
|
+
iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
|
|
868
|
+
shape = parent.activeObj.shape;
|
|
869
|
+
}
|
|
870
|
+
else if (!isNullOrUndefined(parent.currSelectionPoint)) {
|
|
871
|
+
iconCss = this.getCurrentShapeIcon(parent.currSelectionPoint.shape);
|
|
872
|
+
shape = parent.currSelectionPoint.shape;
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
iconCss = 'e-custom';
|
|
876
|
+
shape = 'custom';
|
|
877
|
+
}
|
|
878
|
+
var drpDownBtn = new DropDownButton({
|
|
879
|
+
open: function (args) {
|
|
880
|
+
if (parent.togglePan) {
|
|
881
|
+
_this.cancelPan();
|
|
882
|
+
}
|
|
883
|
+
if (Browser.isDevice) {
|
|
884
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
885
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
886
|
+
}
|
|
887
|
+
if (!isNullOrUndefined(_this.parent.activeObj.shape) && _this.parent.activeObj.shape.split('-').length > 1) {
|
|
888
|
+
document.getElementById(_this.parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
889
|
+
}
|
|
890
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
891
|
+
},
|
|
892
|
+
items: items,
|
|
893
|
+
select: function (args) {
|
|
894
|
+
_this.cropSelect(args);
|
|
895
|
+
drpDownBtn.iconCss = 'e-icons ' + _this.getCurrentShapeIcon('crop-' + args.item.id);
|
|
896
|
+
drpDownBtn.content = parent.toPascalCase(args.item.id);
|
|
897
|
+
},
|
|
898
|
+
iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup',
|
|
899
|
+
content: parent.toPascalCase(shape.replace('crop-', ''))
|
|
900
|
+
});
|
|
901
|
+
drpDownBtn.appendTo('#' + this.parent.element.id + '_cropBtn');
|
|
902
|
+
};
|
|
903
|
+
ToolbarModule.prototype.renderTransformBtn = function () {
|
|
904
|
+
var parent = this.parent;
|
|
905
|
+
var items = [];
|
|
906
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('RotateLeft') > -1)) {
|
|
907
|
+
items.push({ text: this.l10n.getConstant('RotateLeft'), id: 'rotateleft', iconCss: 'e-icons e-anti-clock-wise' });
|
|
908
|
+
}
|
|
909
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('RotateRight') > -1)) {
|
|
910
|
+
items.push({ text: this.l10n.getConstant('RotateRight'), id: 'rotateright', iconCss: 'e-icons e-clock-wise' });
|
|
911
|
+
}
|
|
912
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('FlipHorizontal') > -1)) {
|
|
913
|
+
items.push({ text: this.l10n.getConstant('HorizontalFlip'), id: 'horizontalflip', iconCss: 'e-icons e-horizontal-flip' });
|
|
914
|
+
}
|
|
915
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('FlipVertical') > -1)) {
|
|
916
|
+
items.push({ text: this.l10n.getConstant('VerticalFlip'), id: 'verticalflip', iconCss: 'e-icons e-vertical-flip' });
|
|
917
|
+
}
|
|
918
|
+
var drpDownBtn = new DropDownButton({
|
|
919
|
+
open: function (args) {
|
|
920
|
+
if (Browser.isDevice) {
|
|
921
|
+
var ht = args.element.parentElement.offsetHeight;
|
|
922
|
+
args.element.parentElement.style.display = 'none';
|
|
923
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
924
|
+
ht + 'px';
|
|
925
|
+
args.element.parentElement.style.display = 'block';
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
items: items, select: this.parent.transformSelect.bind(this),
|
|
929
|
+
iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
|
|
930
|
+
});
|
|
931
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
|
|
932
|
+
};
|
|
933
|
+
ToolbarModule.prototype.renderSaveBtn = function () {
|
|
934
|
+
var imageEditorObj = this.parent;
|
|
935
|
+
var saveItems = [
|
|
936
|
+
{ text: 'JPEG', id: 'jpeg' },
|
|
937
|
+
{ text: 'PNG', id: 'png' },
|
|
938
|
+
{ text: 'SVG', id: 'svg' }
|
|
939
|
+
];
|
|
940
|
+
var ddbElem = document.getElementById(this.parent.element.id + '_saveBtn');
|
|
941
|
+
if (ddbElem) {
|
|
942
|
+
// Initialize the DropDownButton component.
|
|
943
|
+
var saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
|
|
944
|
+
select: function (args) {
|
|
945
|
+
imageEditorObj.export(args.item.text);
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
saveDrpDownBtn.appendTo('#' + this.parent.element.id + '_saveBtn');
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
ToolbarModule.prototype.getCropTransformToolbarItem = function () {
|
|
952
|
+
var parent = this.parent;
|
|
953
|
+
var toolbarItems = [];
|
|
954
|
+
toolbarItems.push({ id: parent.element.id + '_crop', tooltipText: this.l10n.getConstant('CropSelection'), align: 'Center',
|
|
955
|
+
template: '<button id="' + parent.element.id + '_cropBtn"></button>'
|
|
956
|
+
});
|
|
957
|
+
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
958
|
+
toolbarItems.push({ id: this.parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
|
|
959
|
+
tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
960
|
+
toolbarItems.push({ id: this.parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
|
|
961
|
+
tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
962
|
+
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
963
|
+
toolbarItems.push({ id: this.parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
|
|
964
|
+
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
965
|
+
toolbarItems.push({ id: this.parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
|
|
966
|
+
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
967
|
+
if (!Browser.isDevice) {
|
|
968
|
+
toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
969
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
970
|
+
toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
971
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
972
|
+
}
|
|
973
|
+
return toolbarItems;
|
|
974
|
+
};
|
|
975
|
+
ToolbarModule.prototype.getShapesToolbarItem = function (items) {
|
|
976
|
+
var parent = this.parent;
|
|
977
|
+
var toolbarItems = [];
|
|
978
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar))) {
|
|
979
|
+
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
980
|
+
template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
|
|
981
|
+
}
|
|
982
|
+
if (items.indexOf('fillColor') > -1) {
|
|
983
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: this.parent.element.id + '_fillcolor',
|
|
984
|
+
cssClass: 'top-icon e-fill', tooltipText: this.l10n.getConstant('FillColor'), align: 'Center', type: 'Input',
|
|
985
|
+
template: '<button id="' + this.parent.element.id + '_fillColorBtn"></button>' });
|
|
986
|
+
}
|
|
987
|
+
if (items.indexOf('strokeColor') > -1) {
|
|
988
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: this.parent.element.id + '_strokecolor',
|
|
989
|
+
cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
990
|
+
template: '<button id="' + this.parent.element.id + '_borderColorBtn"></button>' });
|
|
991
|
+
}
|
|
992
|
+
if (items.indexOf('strokeWidth') > -1) {
|
|
993
|
+
toolbarItems.push({ id: this.parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
|
|
994
|
+
type: 'Input', template: '<button id="' + this.parent.element.id + '_borderWidthBtn"></button>' });
|
|
995
|
+
}
|
|
996
|
+
if (items.indexOf('start') > -1) {
|
|
997
|
+
toolbarItems.push({ id: this.parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
|
|
998
|
+
type: 'Input', template: '<button id="' + this.parent.element.id + '_startBtn"></button>' });
|
|
999
|
+
}
|
|
1000
|
+
if (items.indexOf('end') > -1) {
|
|
1001
|
+
toolbarItems.push({ id: this.parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
|
|
1002
|
+
type: 'Input', template: '<button id="' + this.parent.element.id + '_endBtn"></button>' });
|
|
1003
|
+
}
|
|
1004
|
+
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
1005
|
+
if (items.indexOf('duplicate') > -1) {
|
|
1006
|
+
toolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
|
|
1007
|
+
tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center' });
|
|
1008
|
+
}
|
|
1009
|
+
if (items.indexOf('remove') > -1) {
|
|
1010
|
+
toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
|
|
1011
|
+
tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
|
|
1012
|
+
}
|
|
1013
|
+
if (items.indexOf('text') > -1) {
|
|
1014
|
+
toolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
|
|
1015
|
+
tooltipText: this.l10n.getConstant('EditText'), align: 'Center' });
|
|
1016
|
+
}
|
|
1017
|
+
var tempToolbarItems = this.processSubToolbar(items);
|
|
1018
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
1019
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
1020
|
+
}
|
|
1021
|
+
if (!Browser.isDevice) {
|
|
1022
|
+
var obj = { shape: null };
|
|
1023
|
+
parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
|
|
1024
|
+
if (obj['shape'] !== 'path') {
|
|
1025
|
+
toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
1026
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
1027
|
+
toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
1028
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
return toolbarItems;
|
|
1032
|
+
};
|
|
1033
|
+
ToolbarModule.prototype.initCropTransformToolbar = function () {
|
|
1034
|
+
var _this = this;
|
|
1035
|
+
var leftItem = this.getLeftToolbarItem();
|
|
1036
|
+
var rightItem = this.getRightToolbarItem();
|
|
1037
|
+
var mainItem = this.getCropTransformToolbarItem();
|
|
1038
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
1039
|
+
if (Browser.isDevice) {
|
|
1040
|
+
this.defToolbarItems = mainItem;
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
|
|
1044
|
+
}
|
|
1045
|
+
var toolbar = new Toolbar({
|
|
1046
|
+
width: '100%',
|
|
1047
|
+
items: this.defToolbarItems,
|
|
1048
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
1049
|
+
created: function () {
|
|
1050
|
+
_this.renderCropBtn();
|
|
1051
|
+
_this.wireZoomBtnEvents();
|
|
1052
|
+
if (!Browser.isDevice) {
|
|
1053
|
+
_this.renderSaveBtn();
|
|
1054
|
+
}
|
|
1055
|
+
_this.parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
1056
|
+
if (Browser.isDevice) {
|
|
1057
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar')))) {
|
|
1058
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1059
|
+
toolbar.refreshOverflow();
|
|
1060
|
+
toolbar.refreshOverflow();
|
|
1061
|
+
toolbar.refreshOverflow();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
_this.createLeftToolbarControls();
|
|
1066
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
|
|
1067
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1068
|
+
toolbar.refreshOverflow();
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
_this.parent.select('custom');
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
if (Browser.isDevice) {
|
|
1075
|
+
toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
|
|
1076
|
+
}
|
|
1077
|
+
else {
|
|
1078
|
+
toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
|
|
1079
|
+
}
|
|
1080
|
+
this.enableDisableTbrBtn();
|
|
1081
|
+
this.parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
1082
|
+
};
|
|
1083
|
+
ToolbarModule.prototype.getCurrentShapeIcon = function (shape) {
|
|
1084
|
+
var icon = '';
|
|
1085
|
+
switch (shape) {
|
|
1086
|
+
case 'rectangle':
|
|
1087
|
+
icon = 'e-rectangle';
|
|
1088
|
+
break;
|
|
1089
|
+
case 'ellipse':
|
|
1090
|
+
icon = 'e-circle';
|
|
1091
|
+
break;
|
|
1092
|
+
case 'triangle':
|
|
1093
|
+
icon = 'e-triangle';
|
|
1094
|
+
break;
|
|
1095
|
+
case 'line':
|
|
1096
|
+
icon = 'e-line';
|
|
1097
|
+
break;
|
|
1098
|
+
case 'arrow':
|
|
1099
|
+
icon = 'e-arrow-right-up';
|
|
1100
|
+
break;
|
|
1101
|
+
case 'path':
|
|
1102
|
+
icon = 'e-critical-path';
|
|
1103
|
+
break;
|
|
1104
|
+
case 'text':
|
|
1105
|
+
icon = 'e-add-text';
|
|
1106
|
+
break;
|
|
1107
|
+
case 'pen':
|
|
1108
|
+
icon = 'e-free-pen';
|
|
1109
|
+
break;
|
|
1110
|
+
case 'crop-custom':
|
|
1111
|
+
icon = 'e-custom';
|
|
1112
|
+
break;
|
|
1113
|
+
case 'crop-circle':
|
|
1114
|
+
icon = 'e-circle';
|
|
1115
|
+
break;
|
|
1116
|
+
case 'crop-square':
|
|
1117
|
+
icon = 'e-square';
|
|
1118
|
+
break;
|
|
1119
|
+
case 'crop-3:2':
|
|
1120
|
+
icon = 'e-custom-a';
|
|
1121
|
+
break;
|
|
1122
|
+
case 'crop-4:3':
|
|
1123
|
+
icon = 'e-custom-b';
|
|
1124
|
+
break;
|
|
1125
|
+
case 'crop-5:4':
|
|
1126
|
+
icon = 'e-custom-c';
|
|
1127
|
+
break;
|
|
1128
|
+
case 'crop-7:5':
|
|
1129
|
+
icon = 'e-custom-d';
|
|
1130
|
+
break;
|
|
1131
|
+
case 'crop-16:9':
|
|
1132
|
+
icon = 'e-custom-e';
|
|
1133
|
+
break;
|
|
1134
|
+
default:
|
|
1135
|
+
icon = 'e-free-pen';
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
return icon;
|
|
1139
|
+
};
|
|
1140
|
+
ToolbarModule.prototype.initShapesToolbarItem = function (items) {
|
|
1141
|
+
var _this = this;
|
|
1142
|
+
var leftItem = this.getLeftToolbarItem();
|
|
1143
|
+
var rightItem = this.getRightToolbarItem();
|
|
1144
|
+
var mainItem = this.getShapesToolbarItem(items);
|
|
1145
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
1146
|
+
if (Browser.isDevice) {
|
|
1147
|
+
this.defToolbarItems = mainItem;
|
|
1148
|
+
}
|
|
1149
|
+
else {
|
|
1150
|
+
this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
|
|
1151
|
+
}
|
|
1152
|
+
var toolbar = new Toolbar({
|
|
1153
|
+
width: '100%',
|
|
1154
|
+
items: this.defToolbarItems,
|
|
1155
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
1156
|
+
created: function () {
|
|
1157
|
+
_this.renderAnnotationBtn(true);
|
|
1158
|
+
_this.createShapeColor(items);
|
|
1159
|
+
_this.createShapeBtn(items);
|
|
1160
|
+
if (_this.parent.activeObj.shape === 'arrow') {
|
|
1161
|
+
_this.createStartBtn();
|
|
1162
|
+
_this.createEndBtn();
|
|
1163
|
+
}
|
|
1164
|
+
_this.wireZoomBtnEvents();
|
|
1165
|
+
if (!Browser.isDevice) {
|
|
1166
|
+
_this.renderSaveBtn();
|
|
1167
|
+
}
|
|
1168
|
+
_this.parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
1169
|
+
if (Browser.isDevice) {
|
|
1170
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar')))) {
|
|
1171
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1172
|
+
toolbar.refreshOverflow();
|
|
1173
|
+
toolbar.refreshOverflow();
|
|
1174
|
+
toolbar.refreshOverflow();
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
_this.createLeftToolbarControls();
|
|
1179
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
|
|
1180
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1181
|
+
toolbar.refreshOverflow();
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
if (Browser.isDevice) {
|
|
1187
|
+
toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
|
|
1188
|
+
}
|
|
1189
|
+
else {
|
|
1190
|
+
toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
|
|
1191
|
+
}
|
|
1192
|
+
this.enableDisableTbrBtn();
|
|
1193
|
+
};
|
|
1194
|
+
ToolbarModule.prototype.createShapeColor = function (items) {
|
|
1195
|
+
var _this = this;
|
|
1196
|
+
var parent = this.parent;
|
|
1197
|
+
if (items.indexOf('fillColor') > -1) {
|
|
1198
|
+
parent.element.querySelector('.e-template.e-fill').appendChild(parent.createElement('input', {
|
|
1199
|
+
id: parent.element.id + '_shape_fill'
|
|
1200
|
+
}));
|
|
1201
|
+
var fillColor = new ColorPicker({
|
|
1202
|
+
modeSwitcher: false, noColor: true, value: '',
|
|
1203
|
+
showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
|
|
1204
|
+
change: function (args) {
|
|
1205
|
+
_this.parent.updateFillColor(args.currentValue.hex);
|
|
1206
|
+
if (args.currentValue.rgba === '') {
|
|
1207
|
+
fillDDB_1.element.children[0].classList.add('e-nocolor-item');
|
|
1208
|
+
}
|
|
1209
|
+
else {
|
|
1210
|
+
fillDDB_1.element.children[0].classList.remove('e-nocolor-item');
|
|
1211
|
+
fillDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
1212
|
+
}
|
|
1213
|
+
fillDDB_1.toggle();
|
|
1214
|
+
}
|
|
1215
|
+
}, '#' + parent.element.id + '_shape_fill');
|
|
1216
|
+
var fillDDB_1 = new DropDownButton({
|
|
1217
|
+
open: function (args) {
|
|
1218
|
+
if (Browser.isDevice) {
|
|
1219
|
+
args.element.parentElement.style.top = fillDDB_1.element.getBoundingClientRect().top -
|
|
1220
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1221
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1224
|
+
target: '.e-shape-fill-color',
|
|
1225
|
+
iconCss: 'e-dropdownbtn-preview'
|
|
1226
|
+
}, '#' + this.parent.element.id + '_fillColorBtn');
|
|
1227
|
+
fillColor.inline = true;
|
|
1228
|
+
parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
|
|
1229
|
+
}
|
|
1230
|
+
if (items.indexOf('strokeColor') > -1) {
|
|
1231
|
+
parent.element.querySelector('.e-template.e-stroke').appendChild(parent.createElement('input', {
|
|
1232
|
+
id: parent.element.id + '_shape_stroke'
|
|
1233
|
+
}));
|
|
1234
|
+
var strokeColor = new ColorPicker({
|
|
1235
|
+
modeSwitcher: false, noColor: false, value: '#fff',
|
|
1236
|
+
showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
|
|
1237
|
+
change: function (args) {
|
|
1238
|
+
_this.parent.updateStrokeColor(args.currentValue.hex);
|
|
1239
|
+
strokeDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
1240
|
+
strokeDDB_1.toggle();
|
|
1241
|
+
}
|
|
1242
|
+
}, '#' + parent.element.id + '_shape_stroke');
|
|
1243
|
+
var strokeDDB_1 = new DropDownButton({
|
|
1244
|
+
open: function (args) {
|
|
1245
|
+
if (Browser.isDevice) {
|
|
1246
|
+
args.element.parentElement.style.top = strokeDDB_1.element.getBoundingClientRect().top -
|
|
1247
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1248
|
+
args.element.parentElement.style.left = _this.parent.element.offsetLeft + 'px';
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
target: '.e-shape-stroke-color',
|
|
1252
|
+
iconCss: 'e-dropdownbtn-preview'
|
|
1253
|
+
}, '#' + parent.element.id + '_borderColorBtn');
|
|
1254
|
+
strokeColor.inline = true;
|
|
1255
|
+
parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview').style.background = '#fff';
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
ToolbarModule.prototype.createShapeBtn = function (items) {
|
|
1259
|
+
var _this = this;
|
|
1260
|
+
var parent = this.parent;
|
|
1261
|
+
var strokeWidthItems = [
|
|
1262
|
+
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
1263
|
+
{ id: '2', text: this.l10n.getConstant('Small') },
|
|
1264
|
+
{ id: '3', text: this.l10n.getConstant('Medium') },
|
|
1265
|
+
{ id: '4', text: this.l10n.getConstant('Large') },
|
|
1266
|
+
{ id: '5', text: this.l10n.getConstant('XLarge') }
|
|
1267
|
+
];
|
|
1268
|
+
if (items.indexOf('strokeWidth') > -1) {
|
|
1269
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_borderWidthBtn');
|
|
1270
|
+
var spanElem_1 = document.createElement('span');
|
|
1271
|
+
spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
|
|
1272
|
+
spanElem_1.className = 'e-shape-stroke-width';
|
|
1273
|
+
strokeWidthBtn.appendChild(spanElem_1);
|
|
1274
|
+
// Initialize the DropDownButton component.
|
|
1275
|
+
var drpDownBtn_1 = new DropDownButton({ items: strokeWidthItems,
|
|
1276
|
+
open: function (args) {
|
|
1277
|
+
if (Browser.isDevice) {
|
|
1278
|
+
args.element.parentElement.style.top = drpDownBtn_1.element.getBoundingClientRect().top -
|
|
1279
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1280
|
+
}
|
|
1281
|
+
var activeBtn = spanElem_1.innerHTML;
|
|
1282
|
+
if (activeBtn !== '') {
|
|
1283
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
select: function (args) {
|
|
1287
|
+
spanElem_1.textContent = args.item.text;
|
|
1288
|
+
_this.parent.updateStrokeWidth(args.item.id);
|
|
1289
|
+
if (Browser.isDevice) {
|
|
1290
|
+
if (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar'))) {
|
|
1291
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1292
|
+
var toolbar_6 = getComponent(_this.parent.element.id + '_bottomToolbar', 'toolbar');
|
|
1293
|
+
toolbar_6.refreshOverflow();
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
else {
|
|
1297
|
+
if (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar'))) {
|
|
1298
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1299
|
+
var toolbar_7 = getComponent(_this.parent.element.id + '_toolbar', 'toolbar');
|
|
1300
|
+
toolbar_7.refreshOverflow();
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
// Render initialized DropDownButton.
|
|
1306
|
+
drpDownBtn_1.appendTo('#' + parent.element.id + '_borderWidthBtn');
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
ToolbarModule.prototype.createStartBtn = function () {
|
|
1310
|
+
var parent = this.parent;
|
|
1311
|
+
var strokeWidthItems = [
|
|
1312
|
+
{ id: '1', text: this.l10n.getConstant('None') },
|
|
1313
|
+
{ id: '2', text: this.l10n.getConstant('Bar') },
|
|
1314
|
+
{ id: '3', text: this.l10n.getConstant('Arrow') },
|
|
1315
|
+
{ id: '4', text: this.l10n.getConstant('ArrowSolid') },
|
|
1316
|
+
{ id: '5', text: this.l10n.getConstant('Circle') },
|
|
1317
|
+
{ id: '6', text: this.l10n.getConstant('CircleSolid') },
|
|
1318
|
+
{ id: '7', text: this.l10n.getConstant('Square') },
|
|
1319
|
+
{ id: '8', text: this.l10n.getConstant('SquareSolid') }
|
|
1320
|
+
];
|
|
1321
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_startBtn');
|
|
1322
|
+
var spanElem = document.createElement('span');
|
|
1323
|
+
if (isNullOrUndefined(this.parent.activeObj.start)) {
|
|
1324
|
+
this.parent.activeObj.start = 'none';
|
|
1325
|
+
}
|
|
1326
|
+
spanElem.innerHTML = this.parent.pascalToSplitWords(this.parent.activeObj.start);
|
|
1327
|
+
spanElem.className = 'e-shape-start';
|
|
1328
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
1329
|
+
// Initialize the DropDownButton component.
|
|
1330
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
1331
|
+
open: function (args) {
|
|
1332
|
+
if (Browser.isDevice) {
|
|
1333
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
1334
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1335
|
+
}
|
|
1336
|
+
var activeBtn = spanElem.innerHTML;
|
|
1337
|
+
if (activeBtn !== '') {
|
|
1338
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
select: function (args) {
|
|
1342
|
+
spanElem.textContent = args.item.text;
|
|
1343
|
+
parent.updateArrow('startArrow', args.item.id);
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
// Render initialized DropDownButton.
|
|
1347
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_startBtn');
|
|
1348
|
+
};
|
|
1349
|
+
ToolbarModule.prototype.createEndBtn = function () {
|
|
1350
|
+
var parent = this.parent;
|
|
1351
|
+
var strokeWidthItems = [
|
|
1352
|
+
{ id: '1', text: this.l10n.getConstant('None') },
|
|
1353
|
+
{ id: '2', text: this.l10n.getConstant('Bar') },
|
|
1354
|
+
{ id: '3', text: this.l10n.getConstant('Arrow') },
|
|
1355
|
+
{ id: '4', text: this.l10n.getConstant('ArrowSolid') },
|
|
1356
|
+
{ id: '5', text: this.l10n.getConstant('Circle') },
|
|
1357
|
+
{ id: '6', text: this.l10n.getConstant('CircleSolid') },
|
|
1358
|
+
{ id: '7', text: this.l10n.getConstant('Square') },
|
|
1359
|
+
{ id: '8', text: this.l10n.getConstant('SquareSolid') }
|
|
1360
|
+
];
|
|
1361
|
+
var strokeEndBtn = document.getElementById(parent.element.id + '_endBtn');
|
|
1362
|
+
var spanElem = document.createElement('span');
|
|
1363
|
+
if (isNullOrUndefined(this.parent.activeObj.end)) {
|
|
1364
|
+
this.parent.activeObj.end = 'arrowSolid';
|
|
1365
|
+
}
|
|
1366
|
+
spanElem.innerHTML = this.parent.pascalToSplitWords(this.parent.activeObj.end);
|
|
1367
|
+
spanElem.className = 'e-shape-end';
|
|
1368
|
+
strokeEndBtn.appendChild(spanElem);
|
|
1369
|
+
// Initialize the DropDownButton component.
|
|
1370
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
1371
|
+
open: function (args) {
|
|
1372
|
+
if (Browser.isDevice) {
|
|
1373
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
1374
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1375
|
+
}
|
|
1376
|
+
var activeBtn = spanElem.innerHTML;
|
|
1377
|
+
if (activeBtn !== '') {
|
|
1378
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
select: function (args) {
|
|
1382
|
+
spanElem.textContent = args.item.text;
|
|
1383
|
+
parent.updateArrow('endArrow', args.item.id);
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
// Render initialized DropDownButton.
|
|
1387
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_endBtn');
|
|
1388
|
+
};
|
|
1389
|
+
ToolbarModule.prototype.getTextToolbarItem = function (items) {
|
|
1390
|
+
var parent = this.parent;
|
|
1391
|
+
var toolbarItems = [];
|
|
1392
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar))) {
|
|
1393
|
+
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
1394
|
+
template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
|
|
1395
|
+
}
|
|
1396
|
+
if (items.indexOf('fontFamily') > -1) {
|
|
1397
|
+
toolbarItems.push({ id: parent.element.id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
|
|
1398
|
+
tooltipText: this.l10n.getConstant('FontFamily'), align: 'Center',
|
|
1399
|
+
template: '<button id="' + parent.element.id + '_fontFamilyBtn"></button>' });
|
|
1400
|
+
}
|
|
1401
|
+
if (items.indexOf('fontSize') > -1) {
|
|
1402
|
+
toolbarItems.push({ id: parent.element.id + '_fontSize', cssClass: 'top-icon e-img-font-size',
|
|
1403
|
+
tooltipText: this.l10n.getConstant('FontSize'), align: 'Center',
|
|
1404
|
+
template: '<button id="' + parent.element.id + '_fontSizeBtn"></button>' });
|
|
1405
|
+
}
|
|
1406
|
+
if (items.indexOf('fontColor') > -1) {
|
|
1407
|
+
toolbarItems.push({ cssClass: 'top-icon e-text-font-color', id: parent.element.id + '_text_strokecolor',
|
|
1408
|
+
tooltipText: this.l10n.getConstant('FontColor'), align: 'Center',
|
|
1409
|
+
type: 'Input', template: '<button id="' + parent.element.id + '_fontColorBtn"></button>' });
|
|
1410
|
+
}
|
|
1411
|
+
if (items.indexOf('bold') > -1) {
|
|
1412
|
+
toolbarItems.push({ id: parent.element.id + '_bold', prefixIcon: 'e-icons e-bold', cssClass: 'top-icon e-bold',
|
|
1413
|
+
tooltipText: this.l10n.getConstant('Bold'), align: 'Center' });
|
|
1414
|
+
}
|
|
1415
|
+
if (items.indexOf('italic') > -1) {
|
|
1416
|
+
toolbarItems.push({ id: parent.element.id + '_italic', prefixIcon: 'e-icons e-italic', cssClass: 'top-icon e-italic',
|
|
1417
|
+
tooltipText: this.l10n.getConstant('Italic'), align: 'Center' });
|
|
1418
|
+
}
|
|
1419
|
+
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
1420
|
+
if (items.indexOf('duplicate') > -1) {
|
|
1421
|
+
toolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
|
|
1422
|
+
tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center' });
|
|
1423
|
+
}
|
|
1424
|
+
if (items.indexOf('remove') > -1) {
|
|
1425
|
+
toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
|
|
1426
|
+
tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
|
|
1427
|
+
}
|
|
1428
|
+
if (items.indexOf('text') > -1) {
|
|
1429
|
+
toolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
|
|
1430
|
+
tooltipText: this.l10n.getConstant('EditText'), align: 'Center' });
|
|
1431
|
+
}
|
|
1432
|
+
var tempToolbarItems = this.processSubToolbar(items);
|
|
1433
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
1434
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
1435
|
+
}
|
|
1436
|
+
if (!Browser.isDevice) {
|
|
1437
|
+
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
1438
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
1439
|
+
toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
1440
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
1441
|
+
}
|
|
1442
|
+
return toolbarItems;
|
|
1443
|
+
};
|
|
1444
|
+
ToolbarModule.prototype.getFontFamilyItems = function () {
|
|
1445
|
+
if (Browser.isDevice) {
|
|
1446
|
+
return [{ id: 'arial', text: 'ABC' }, { id: 'calibri', text: 'ABC' }, { id: 'georgia', text: 'ABC' },
|
|
1447
|
+
{ id: 'roboto', text: 'ABC' }, { id: 'tahoma', text: 'ABC' }];
|
|
1448
|
+
}
|
|
1449
|
+
return [{ id: 'arial', text: 'Arial' }, { id: 'calibri', text: 'Calibri' }, { id: 'georgia', text: 'Georgia' },
|
|
1450
|
+
{ id: 'roboto', text: 'Roboto' }, { id: 'tahoma', text: 'Tahoma' }];
|
|
1451
|
+
};
|
|
1452
|
+
ToolbarModule.prototype.initTextToolbarItem = function (items) {
|
|
1453
|
+
var _this = this;
|
|
1454
|
+
var parent = this.parent;
|
|
1455
|
+
var leftItem = this.getLeftToolbarItem();
|
|
1456
|
+
var rightItem = this.getRightToolbarItem();
|
|
1457
|
+
var mainItem = this.getTextToolbarItem(items);
|
|
1458
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
1459
|
+
if (Browser.isDevice) {
|
|
1460
|
+
this.defToolbarItems = mainItem;
|
|
1461
|
+
}
|
|
1462
|
+
else {
|
|
1463
|
+
this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
|
|
1464
|
+
}
|
|
1465
|
+
var toolbar = new Toolbar({
|
|
1466
|
+
width: '100%',
|
|
1467
|
+
items: this.defToolbarItems,
|
|
1468
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
1469
|
+
created: function () {
|
|
1470
|
+
_this.renderAnnotationBtn(true);
|
|
1471
|
+
_this.createTextColor(items);
|
|
1472
|
+
_this.createTextBtn(items);
|
|
1473
|
+
_this.wireZoomBtnEvents();
|
|
1474
|
+
if (!Browser.isDevice) {
|
|
1475
|
+
_this.renderSaveBtn();
|
|
1476
|
+
}
|
|
1477
|
+
parent.trigger('toolbarCreated', { toolbarType: 'text' });
|
|
1478
|
+
if (Browser.isDevice) {
|
|
1479
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar')))) {
|
|
1480
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1481
|
+
toolbar.refreshOverflow();
|
|
1482
|
+
toolbar.refreshOverflow();
|
|
1483
|
+
toolbar.refreshOverflow();
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
_this.createLeftToolbarControls();
|
|
1488
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
1489
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1490
|
+
toolbar.refreshOverflow();
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
if (Browser.isDevice) {
|
|
1496
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1499
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
1500
|
+
}
|
|
1501
|
+
this.enableDisableTbrBtn();
|
|
1502
|
+
};
|
|
1503
|
+
ToolbarModule.prototype.createTextColor = function (items) {
|
|
1504
|
+
var _this = this;
|
|
1505
|
+
var parent = this.parent;
|
|
1506
|
+
if (items.indexOf('fontColor') > -1 && !isNullOrUndefined(parent.element.querySelector('.e-template.e-text-font-color'))) {
|
|
1507
|
+
parent.element.querySelector('.e-template.e-text-font-color').appendChild(parent.createElement('input', {
|
|
1508
|
+
id: parent.element.id + '_text_font'
|
|
1509
|
+
}));
|
|
1510
|
+
var fontColor = new ColorPicker({
|
|
1511
|
+
modeSwitcher: false, value: '#fff',
|
|
1512
|
+
showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
|
|
1513
|
+
change: function (args) {
|
|
1514
|
+
_this.parent.updateFontColor(args.currentValue.hex);
|
|
1515
|
+
strokeDDB_2.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
1516
|
+
strokeDDB_2.toggle();
|
|
1517
|
+
}
|
|
1518
|
+
}, '#' + parent.element.id + '_text_font');
|
|
1519
|
+
var strokeDDB_2 = new DropDownButton({
|
|
1520
|
+
open: function (args) {
|
|
1521
|
+
if (Browser.isDevice) {
|
|
1522
|
+
args.element.parentElement.style.top = strokeDDB_2.element.getBoundingClientRect().top -
|
|
1523
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1524
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
target: '.e-text-fontt-color',
|
|
1528
|
+
iconCss: 'e-dropdownbtn-preview'
|
|
1529
|
+
}, '#' + parent.element.id + '_fontColorBtn');
|
|
1530
|
+
fontColor.inline = true;
|
|
1531
|
+
parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview').style.background
|
|
1532
|
+
= '#fff';
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
ToolbarModule.prototype.createTextBtn = function (items) {
|
|
1536
|
+
var parent = this.parent;
|
|
1537
|
+
if (items.indexOf('fontFamily') > -1) {
|
|
1538
|
+
var fontNameBtn = document.getElementById(parent.element.id + '_fontFamilyBtn');
|
|
1539
|
+
var spanElem_2 = document.createElement('span');
|
|
1540
|
+
if (Browser.isDevice) {
|
|
1541
|
+
spanElem_2.innerHTML = 'ABC';
|
|
1542
|
+
spanElem_2.setAttribute('style', 'font-family: arial');
|
|
1543
|
+
}
|
|
1544
|
+
else {
|
|
1545
|
+
spanElem_2.innerHTML = 'Arial';
|
|
1546
|
+
}
|
|
1547
|
+
spanElem_2.className = 'e-text-font-family';
|
|
1548
|
+
if (!isNullOrUndefined(fontNameBtn)) {
|
|
1549
|
+
fontNameBtn.appendChild(spanElem_2);
|
|
1550
|
+
}
|
|
1551
|
+
var fontFamilyBtn_1 = new DropDownButton({ items: this.getFontFamilyItems(),
|
|
1552
|
+
cssClass: 'e-font-family',
|
|
1553
|
+
createPopupOnClick: true,
|
|
1554
|
+
beforeItemRender: function (args) {
|
|
1555
|
+
args.element.setAttribute('style', 'font-family:' + args.element.id);
|
|
1556
|
+
},
|
|
1557
|
+
open: function (args) {
|
|
1558
|
+
if (Browser.isDevice) {
|
|
1559
|
+
args.element.parentElement.style.top = fontFamilyBtn_1.element.getBoundingClientRect().top -
|
|
1560
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1561
|
+
}
|
|
1562
|
+
var fontFamily;
|
|
1563
|
+
if (parent.textArea.style.display === 'block') {
|
|
1564
|
+
fontFamily = parent.textArea.style.fontFamily;
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
fontFamily = parent.activeObj.textSettings.fontFamily;
|
|
1568
|
+
}
|
|
1569
|
+
args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase()
|
|
1570
|
+
+ '"' + ']').classList.add('e-selected-btn');
|
|
1571
|
+
},
|
|
1572
|
+
select: function (args) {
|
|
1573
|
+
spanElem_2.textContent = args.item.text;
|
|
1574
|
+
if (Browser.isDevice) {
|
|
1575
|
+
spanElem_2.setAttribute('style', 'font-family:' + args.item.id);
|
|
1576
|
+
}
|
|
1577
|
+
parent.updateFontFamily(args.item.id);
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
fontFamilyBtn_1.appendTo('#' + parent.element.id + '_fontFamilyBtn');
|
|
1581
|
+
}
|
|
1582
|
+
if (items.indexOf('fontSize') > -1) {
|
|
1583
|
+
var fontSizeBtnElem = document.getElementById(parent.element.id + '_fontSizeBtn');
|
|
1584
|
+
var fontSizeSpanElem_1 = document.createElement('span');
|
|
1585
|
+
var fontSizes = parent.getFontSizes();
|
|
1586
|
+
fontSizeSpanElem_1.innerHTML = fontSizes[0].text;
|
|
1587
|
+
fontSizeSpanElem_1.className = 'e-text-font-size';
|
|
1588
|
+
fontSizeBtnElem.appendChild(fontSizeSpanElem_1);
|
|
1589
|
+
var fontSizeBtn_1 = new DropDownButton({
|
|
1590
|
+
cssClass: 'e-font-size',
|
|
1591
|
+
items: fontSizes,
|
|
1592
|
+
open: function (args) {
|
|
1593
|
+
if (Browser.isDevice) {
|
|
1594
|
+
args.element.parentElement.style.top = fontSizeBtn_1.element.getBoundingClientRect().top -
|
|
1595
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1596
|
+
}
|
|
1597
|
+
var activeBtn = fontSizeSpanElem_1.innerHTML;
|
|
1598
|
+
args.element.querySelector('[aria-label *= ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
1599
|
+
},
|
|
1600
|
+
select: function (args) {
|
|
1601
|
+
fontSizeSpanElem_1.textContent = args.item.text;
|
|
1602
|
+
parent.updateFontSize(args.item.text);
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
fontSizeBtn_1.appendTo('#' + parent.element.id + '_fontSizeBtn');
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType) {
|
|
1609
|
+
if (!this.parent.isImageLoaded || this.parent.isCropToolbar) {
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
var args = { toolbarType: type };
|
|
1613
|
+
if (type !== 'filter' && type !== 'color') {
|
|
1614
|
+
if (document.getElementById(this.parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
1615
|
+
getComponent(document.getElementById(this.parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
1616
|
+
document.getElementById(this.parent.element.id + '_toolbar').innerHTML = '';
|
|
1617
|
+
}
|
|
1618
|
+
if (document.getElementById(this.parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
|
|
1619
|
+
if (document.getElementById(this.parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
|
|
1620
|
+
getComponent(document.getElementById(this.parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
1621
|
+
document.getElementById(this.parent.element.id + '_bottomToolbar').innerHTML = '';
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
this.refreshSlider();
|
|
1626
|
+
this.parent.isCropTab = false;
|
|
1627
|
+
switch (type) {
|
|
1628
|
+
case 'main':
|
|
1629
|
+
if (Browser.isDevice) {
|
|
1630
|
+
if (isCropping) {
|
|
1631
|
+
this.initMainToolbar(false, true, true);
|
|
1632
|
+
}
|
|
1633
|
+
else {
|
|
1634
|
+
this.initMainToolbar(false, true, null);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
else if (!Browser.isDevice || isZooming) {
|
|
1638
|
+
if (isZooming) {
|
|
1639
|
+
this.initMainToolbar(isApplyBtn, Browser.isDevice, null);
|
|
1640
|
+
}
|
|
1641
|
+
else {
|
|
1642
|
+
this.initMainToolbar(isApplyBtn, Browser.isDevice, null);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
if (Browser.isDevice) {
|
|
1646
|
+
this.initBottomToolbar();
|
|
1647
|
+
}
|
|
1648
|
+
break;
|
|
1649
|
+
case 'shapes':
|
|
1650
|
+
if (Browser.isDevice) {
|
|
1651
|
+
this.initMainToolbar(false, true, true);
|
|
1652
|
+
}
|
|
1653
|
+
if (this.parent.activeObj.shape === 'line' || this.parent.activeObj.shape === 'path') {
|
|
1654
|
+
args.toolbarItems = ['strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
1655
|
+
}
|
|
1656
|
+
else if (this.parent.activeObj.shape === 'arrow') {
|
|
1657
|
+
args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
|
|
1658
|
+
}
|
|
1659
|
+
else {
|
|
1660
|
+
args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
1661
|
+
}
|
|
1662
|
+
this.parent.trigger('toolbarUpdating', args);
|
|
1663
|
+
this.initShapesToolbarItem(args.toolbarItems);
|
|
1664
|
+
break;
|
|
1665
|
+
case 'text':
|
|
1666
|
+
if (Browser.isDevice) {
|
|
1667
|
+
this.initMainToolbar(false, true, true);
|
|
1668
|
+
}
|
|
1669
|
+
args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
|
|
1670
|
+
this.parent.trigger('toolbarUpdating', args);
|
|
1671
|
+
this.initTextToolbarItem(args.toolbarItems);
|
|
1672
|
+
break;
|
|
1673
|
+
case 'pen':
|
|
1674
|
+
if (Browser.isDevice) {
|
|
1675
|
+
this.initMainToolbar(false, true, true);
|
|
1676
|
+
}
|
|
1677
|
+
args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove'];
|
|
1678
|
+
this.parent.trigger('toolbarUpdating', args);
|
|
1679
|
+
this.initPenToolbarItem(args.toolbarItems);
|
|
1680
|
+
break;
|
|
1681
|
+
case 'adjustment':
|
|
1682
|
+
if (Browser.isDevice) {
|
|
1683
|
+
this.initMainToolbar(false, true, true);
|
|
1684
|
+
}
|
|
1685
|
+
this.initAdjustmentToolbarItem();
|
|
1686
|
+
break;
|
|
1687
|
+
case 'filter':
|
|
1688
|
+
this.updateContextualToolbar(type);
|
|
1689
|
+
break;
|
|
1690
|
+
case 'color':
|
|
1691
|
+
this.updateContextualToolbar(type, cType);
|
|
1692
|
+
break;
|
|
1693
|
+
case 'croptransform':
|
|
1694
|
+
this.parent.isCropTab = true;
|
|
1695
|
+
if (Browser.isDevice) {
|
|
1696
|
+
this.initMainToolbar(false, true, true);
|
|
1697
|
+
}
|
|
1698
|
+
this.parent.updateCropTransformItems();
|
|
1699
|
+
this.initCropTransformToolbar();
|
|
1700
|
+
break;
|
|
1701
|
+
}
|
|
1702
|
+
this.currToolbar = type;
|
|
1703
|
+
this.refreshDropDownBtn(isCropping);
|
|
1704
|
+
};
|
|
1705
|
+
ToolbarModule.prototype.getAdjustmentToolbarItem = function () {
|
|
1706
|
+
var toolbarItems = [];
|
|
1707
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Brightness') > -1)) {
|
|
1708
|
+
toolbarItems.push({ id: this.parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
|
|
1709
|
+
tooltipText: this.l10n.getConstant('Brightness'), align: 'Center' });
|
|
1710
|
+
}
|
|
1711
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Contrast') > -1)) {
|
|
1712
|
+
toolbarItems.push({ id: this.parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
|
|
1713
|
+
tooltipText: this.l10n.getConstant('Contrast'), align: 'Center' });
|
|
1714
|
+
}
|
|
1715
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Hue') > -1)) {
|
|
1716
|
+
toolbarItems.push({ id: this.parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
|
|
1717
|
+
tooltipText: this.l10n.getConstant('Hue'), align: 'Center' });
|
|
1718
|
+
}
|
|
1719
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Saturation') > -1)) {
|
|
1720
|
+
toolbarItems.push({ id: this.parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
|
|
1721
|
+
tooltipText: this.l10n.getConstant('Saturation'), align: 'Center' });
|
|
1722
|
+
}
|
|
1723
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Exposure') > -1)) {
|
|
1724
|
+
toolbarItems.push({ id: this.parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
|
|
1725
|
+
tooltipText: this.l10n.getConstant('Exposure'), align: 'Center' });
|
|
1726
|
+
}
|
|
1727
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Opacity') > -1)) {
|
|
1728
|
+
toolbarItems.push({ id: this.parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
|
|
1729
|
+
tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
|
|
1730
|
+
}
|
|
1731
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Blur') > -1)) {
|
|
1732
|
+
toolbarItems.push({ id: this.parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
|
|
1733
|
+
tooltipText: this.l10n.getConstant('Blur'), align: 'Center' });
|
|
1734
|
+
}
|
|
1735
|
+
var tempToolbarItems = this.processToolbar('center');
|
|
1736
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
1737
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
1738
|
+
}
|
|
1739
|
+
if (!Browser.isDevice) {
|
|
1740
|
+
toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
1741
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
1742
|
+
toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
1743
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
1744
|
+
}
|
|
1745
|
+
return toolbarItems;
|
|
1746
|
+
};
|
|
1747
|
+
ToolbarModule.prototype.getFilterToolbarItem = function () {
|
|
1748
|
+
var toolbarItems = [];
|
|
1749
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Default') > -1)) {
|
|
1750
|
+
toolbarItems.push({ id: this.parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1751
|
+
tooltipText: this.l10n.getConstant('Default'), align: 'Center',
|
|
1752
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
|
|
1753
|
+
}
|
|
1754
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Chrome') > -1)) {
|
|
1755
|
+
toolbarItems.push({ id: this.parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1756
|
+
tooltipText: this.l10n.getConstant('Chrome'), align: 'Center',
|
|
1757
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_chromeCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Chrome') + '</span></div></div>' });
|
|
1758
|
+
}
|
|
1759
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Cold') > -1)) {
|
|
1760
|
+
toolbarItems.push({ id: this.parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1761
|
+
tooltipText: this.l10n.getConstant('Cold'), align: 'Center',
|
|
1762
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_coldCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Cold') + '</span></div></div>' });
|
|
1763
|
+
}
|
|
1764
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Warm') > -1)) {
|
|
1765
|
+
toolbarItems.push({ id: this.parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1766
|
+
tooltipText: this.l10n.getConstant('Warm'), align: 'Center',
|
|
1767
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_warmCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Warm') + '</span></div></div>' });
|
|
1768
|
+
}
|
|
1769
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Grayscale') > -1)) {
|
|
1770
|
+
toolbarItems.push({ id: this.parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1771
|
+
tooltipText: this.l10n.getConstant('Grayscale'), align: 'Center',
|
|
1772
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_grayscaleCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Grayscale') + '</span></div></div>' });
|
|
1773
|
+
}
|
|
1774
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Sepia') > -1)) {
|
|
1775
|
+
toolbarItems.push({ id: this.parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1776
|
+
tooltipText: this.l10n.getConstant('Sepia'), align: 'Center',
|
|
1777
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_sepiaCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Sepia') + '</span></div></div>' });
|
|
1778
|
+
}
|
|
1779
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Invert') > -1)) {
|
|
1780
|
+
toolbarItems.push({ id: this.parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
|
|
1781
|
+
tooltipText: this.l10n.getConstant('Invert'), align: 'Center',
|
|
1782
|
+
template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_invertCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Invert') + '</span></div></div>' });
|
|
1783
|
+
}
|
|
1784
|
+
var tempToolbarItems = this.processToolbar('center');
|
|
1785
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
1786
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
1787
|
+
}
|
|
1788
|
+
return toolbarItems;
|
|
1789
|
+
};
|
|
1790
|
+
ToolbarModule.prototype.getPenToolbarItem = function (items) {
|
|
1791
|
+
var parent = this.parent;
|
|
1792
|
+
var toolbarItems = [];
|
|
1793
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar))) {
|
|
1794
|
+
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
1795
|
+
template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
|
|
1796
|
+
}
|
|
1797
|
+
if (items.indexOf('strokeColor') > -1) {
|
|
1798
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: this.parent.element.id + '_pen_strokecolor',
|
|
1799
|
+
cssClass: 'top-icon e-pen-stroke-color',
|
|
1800
|
+
tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
|
|
1801
|
+
template: '<button id="' + this.parent.element.id + '_penColorBtn"></button>' });
|
|
1802
|
+
}
|
|
1803
|
+
if (items.indexOf('strokeWidth') > -1) {
|
|
1804
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
|
|
1805
|
+
tooltipText: this.l10n.getConstant('StrokeWidth'),
|
|
1806
|
+
align: 'Center', type: 'Input', template: '<button id="' + this.parent.element.id + '_penStrokeWidth"></button>' });
|
|
1807
|
+
}
|
|
1808
|
+
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
1809
|
+
if (items.indexOf('remove') > -1) {
|
|
1810
|
+
toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
|
|
1811
|
+
tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
|
|
1812
|
+
}
|
|
1813
|
+
var tempToolbarItems = this.processSubToolbar(items);
|
|
1814
|
+
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
1815
|
+
toolbarItems.push(tempToolbarItems[i]);
|
|
1816
|
+
}
|
|
1817
|
+
if (!Browser.isDevice) {
|
|
1818
|
+
toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
1819
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
1820
|
+
toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
1821
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
1822
|
+
}
|
|
1823
|
+
return toolbarItems;
|
|
1824
|
+
};
|
|
1825
|
+
ToolbarModule.prototype.initPenToolbarItem = function (items) {
|
|
1826
|
+
var _this = this;
|
|
1827
|
+
var leftItem = this.getLeftToolbarItem();
|
|
1828
|
+
var rightItem = this.getRightToolbarItem();
|
|
1829
|
+
var mainItem = this.getPenToolbarItem(items);
|
|
1830
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
1831
|
+
if (Browser.isDevice) {
|
|
1832
|
+
this.defToolbarItems = mainItem;
|
|
1833
|
+
}
|
|
1834
|
+
else {
|
|
1835
|
+
this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
|
|
1836
|
+
}
|
|
1837
|
+
var toolbar = new Toolbar({
|
|
1838
|
+
width: '100%',
|
|
1839
|
+
items: this.defToolbarItems,
|
|
1840
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
1841
|
+
created: function () {
|
|
1842
|
+
_this.renderAnnotationBtn(true);
|
|
1843
|
+
_this.createPenColor(items);
|
|
1844
|
+
_this.createPenBtn(items);
|
|
1845
|
+
_this.wireZoomBtnEvents();
|
|
1846
|
+
if (!Browser.isDevice) {
|
|
1847
|
+
_this.renderSaveBtn();
|
|
1848
|
+
}
|
|
1849
|
+
_this.parent.trigger('toolbarCreated', { toolbarType: 'pen' });
|
|
1850
|
+
if (Browser.isDevice) {
|
|
1851
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
|
|
1852
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1853
|
+
toolbar.refreshOverflow();
|
|
1854
|
+
toolbar.refreshOverflow();
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
else {
|
|
1858
|
+
_this.createLeftToolbarControls();
|
|
1859
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
|
|
1860
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1861
|
+
toolbar.refreshOverflow();
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1866
|
+
if (Browser.isDevice) {
|
|
1867
|
+
toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
|
|
1868
|
+
}
|
|
1869
|
+
else {
|
|
1870
|
+
toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
|
|
1871
|
+
}
|
|
1872
|
+
this.enableDisableTbrBtn();
|
|
1873
|
+
};
|
|
1874
|
+
ToolbarModule.prototype.createPenColor = function (items) {
|
|
1875
|
+
var _this = this;
|
|
1876
|
+
var parent = this.parent;
|
|
1877
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1878
|
+
var proxy = this;
|
|
1879
|
+
if (items.indexOf('strokeColor') > -1) {
|
|
1880
|
+
parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
|
|
1881
|
+
id: parent.element.id + '_pen_stroke'
|
|
1882
|
+
}));
|
|
1883
|
+
var penColor = new ColorPicker({
|
|
1884
|
+
modeSwitcher: false, value: '#fff',
|
|
1885
|
+
showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
|
|
1886
|
+
change: function (args) {
|
|
1887
|
+
_this.parent.updatePenStrokeColor(args.currentValue.hex);
|
|
1888
|
+
_this.selFhdColor = args.currentValue.hex;
|
|
1889
|
+
strokeDDB_3.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
1890
|
+
strokeDDB_3.toggle();
|
|
1891
|
+
}
|
|
1892
|
+
}, '#' + parent.element.id + '_pen_stroke');
|
|
1893
|
+
var strokeDDB_3 = new DropDownButton({
|
|
1894
|
+
open: function (args) {
|
|
1895
|
+
if (Browser.isDevice) {
|
|
1896
|
+
args.element.parentElement.style.top = strokeDDB_3.element.getBoundingClientRect().top -
|
|
1897
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1898
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
1899
|
+
}
|
|
1900
|
+
},
|
|
1901
|
+
target: '.e-pen-color',
|
|
1902
|
+
iconCss: 'e-dropdownbtn-preview'
|
|
1903
|
+
}, '#' + parent.element.id + '_penColorBtn');
|
|
1904
|
+
penColor.inline = true;
|
|
1905
|
+
var obj = { tempFreeHandDrawEditingStyles: null };
|
|
1906
|
+
parent.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
|
|
1907
|
+
var indexObj = { freehandSelectedIndex: null };
|
|
1908
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
1909
|
+
if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
|
|
1910
|
+
this.parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
|
|
1911
|
+
= this.selFhdColor === '#42a5f5' ? obj['tempFreeHandDrawEditingStyles'].strokeColor :
|
|
1912
|
+
parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
|
|
1913
|
+
}
|
|
1914
|
+
else {
|
|
1915
|
+
parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
|
|
1916
|
+
= '#fff';
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
ToolbarModule.prototype.createPenBtn = function (items) {
|
|
1921
|
+
var _this = this;
|
|
1922
|
+
var parent = this.parent;
|
|
1923
|
+
var strokeWidthItems = [
|
|
1924
|
+
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
1925
|
+
{ id: '2', text: this.l10n.getConstant('Small') },
|
|
1926
|
+
{ id: '3', text: this.l10n.getConstant('Medium') },
|
|
1927
|
+
{ id: '4', text: this.l10n.getConstant('Large') },
|
|
1928
|
+
{ id: '5', text: this.l10n.getConstant('XLarge') }
|
|
1929
|
+
];
|
|
1930
|
+
if (items.indexOf('strokeWidth') > -1) {
|
|
1931
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_penStrokeWidth');
|
|
1932
|
+
var spanElem_3 = document.createElement('span');
|
|
1933
|
+
var indexObj = { freehandSelectedIndex: null };
|
|
1934
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
1935
|
+
if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
|
|
1936
|
+
spanElem_3.innerHTML = this.getPenStroke(parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth);
|
|
1937
|
+
}
|
|
1938
|
+
else {
|
|
1939
|
+
spanElem_3.innerHTML = this.l10n.getConstant('Small');
|
|
1940
|
+
}
|
|
1941
|
+
spanElem_3.className = 'e-pen-stroke-width';
|
|
1942
|
+
strokeWidthBtn.appendChild(spanElem_3);
|
|
1943
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1944
|
+
var proxy = this;
|
|
1945
|
+
var drpDownBtn_2 = new DropDownButton({ items: strokeWidthItems,
|
|
1946
|
+
open: function (args) {
|
|
1947
|
+
if (Browser.isDevice) {
|
|
1948
|
+
args.element.parentElement.style.top = drpDownBtn_2.element.getBoundingClientRect().top -
|
|
1949
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
1950
|
+
}
|
|
1951
|
+
var activeBtn = spanElem_3.innerHTML;
|
|
1952
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
1953
|
+
},
|
|
1954
|
+
select: function (args) {
|
|
1955
|
+
spanElem_3.textContent = args.item.text;
|
|
1956
|
+
_this.parent.updatePenStrokeWidth(args.item.id);
|
|
1957
|
+
if (Browser.isDevice) {
|
|
1958
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar'))) {
|
|
1959
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1960
|
+
var toolbar_8 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
1961
|
+
toolbar_8.refreshOverflow();
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
else {
|
|
1965
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar'))) {
|
|
1966
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1967
|
+
var toolbar_9 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
1968
|
+
toolbar_9.refreshOverflow();
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
});
|
|
1973
|
+
// Render initialized DropDownButton.
|
|
1974
|
+
drpDownBtn_2.appendTo('#' + parent.element.id + '_penStrokeWidth');
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
ToolbarModule.prototype.getPenStroke = function (value) {
|
|
1978
|
+
var textContent = '';
|
|
1979
|
+
var valueToTextContent = {
|
|
1980
|
+
1: this.l10n.getConstant('XSmall'),
|
|
1981
|
+
2: this.l10n.getConstant('Small'),
|
|
1982
|
+
3: this.l10n.getConstant('Medium'),
|
|
1983
|
+
4: this.l10n.getConstant('Large'),
|
|
1984
|
+
5: this.l10n.getConstant('XLarge')
|
|
1985
|
+
};
|
|
1986
|
+
if (value >= 1 && value <= 5) {
|
|
1987
|
+
textContent = valueToTextContent[value];
|
|
1988
|
+
}
|
|
1989
|
+
return textContent;
|
|
1990
|
+
};
|
|
1991
|
+
ToolbarModule.prototype.initAdjustmentToolbarItem = function () {
|
|
1992
|
+
var _this = this;
|
|
1993
|
+
var parent = this.parent;
|
|
1994
|
+
var leftItem = this.getLeftToolbarItem(null);
|
|
1995
|
+
var rightItem = this.getRightToolbarItem();
|
|
1996
|
+
var mainItem = this.getAdjustmentToolbarItem();
|
|
1997
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
1998
|
+
if (Browser.isDevice) {
|
|
1999
|
+
this.defToolbarItems = mainItem;
|
|
2000
|
+
}
|
|
2001
|
+
else {
|
|
2002
|
+
this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
|
|
2003
|
+
}
|
|
2004
|
+
var toolbar = new Toolbar({
|
|
2005
|
+
width: '100%',
|
|
2006
|
+
items: this.defToolbarItems,
|
|
2007
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
2008
|
+
created: function () {
|
|
2009
|
+
_this.wireZoomBtnEvents();
|
|
2010
|
+
if (!Browser.isDevice) {
|
|
2011
|
+
_this.renderSaveBtn();
|
|
2012
|
+
}
|
|
2013
|
+
if (Browser.isDevice) {
|
|
2014
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
2015
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2016
|
+
toolbar.refreshOverflow();
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
else {
|
|
2020
|
+
_this.createLeftToolbarControls();
|
|
2021
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
2022
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2023
|
+
toolbar.refreshOverflow();
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
});
|
|
2028
|
+
if (Browser.isDevice) {
|
|
2029
|
+
toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
2030
|
+
}
|
|
2031
|
+
else {
|
|
2032
|
+
toolbar.appendTo('#' + parent.element.id + '_toolbar');
|
|
2033
|
+
}
|
|
2034
|
+
this.enableDisableTbrBtn();
|
|
2035
|
+
};
|
|
2036
|
+
ToolbarModule.prototype.initFilterToolbarItem = function () {
|
|
2037
|
+
var _this = this;
|
|
2038
|
+
var parent = this.parent;
|
|
2039
|
+
var mainItem = this.getFilterToolbarItem();
|
|
2040
|
+
if (document.querySelector('#' + this.parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
|
|
2041
|
+
getComponent(document.getElementById(this.parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
|
|
2042
|
+
}
|
|
2043
|
+
var toolbar = new Toolbar({
|
|
2044
|
+
width: '100%',
|
|
2045
|
+
items: mainItem,
|
|
2046
|
+
clicked: this.contextualToolbarClicked.bind(this),
|
|
2047
|
+
created: function () {
|
|
2048
|
+
_this.updatePrivateVariables();
|
|
2049
|
+
_this.createCanvasFilter();
|
|
2050
|
+
if (parent.currentFilter === '') {
|
|
2051
|
+
parent.currentFilter = _this.parent.element.id + '_default';
|
|
2052
|
+
}
|
|
2053
|
+
var hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
|
|
2054
|
+
if (hdrWrapper) {
|
|
2055
|
+
hdrWrapper.style.display = 'none';
|
|
2056
|
+
}
|
|
2057
|
+
document.getElementById(parent.currentFilter + 'Canvas').parentElement.parentElement.classList.add('e-selected');
|
|
2058
|
+
_this.enableDisableTbrBtn();
|
|
2059
|
+
toolbar.refreshOverflow();
|
|
2060
|
+
}
|
|
2061
|
+
});
|
|
2062
|
+
toolbar.appendTo('#' + this.parent.element.id + '_contextualToolbar');
|
|
2063
|
+
};
|
|
2064
|
+
ToolbarModule.prototype.createCanvasFilter = function () {
|
|
2065
|
+
var parent = this.parent;
|
|
2066
|
+
var imageData = parent.getCurrentCanvasData();
|
|
2067
|
+
this.inMemoryCanvas.width = imageData.width;
|
|
2068
|
+
this.inMemoryCanvas.height = imageData.height;
|
|
2069
|
+
this.inMemoryContext.putImageData(imageData, 0, 0);
|
|
2070
|
+
this.updateFilterCanvas('_defaultCanvas', 'default');
|
|
2071
|
+
this.updateFilterCanvas('_chromeCanvas', 'chrome');
|
|
2072
|
+
this.updateFilterCanvas('_coldCanvas', 'cold');
|
|
2073
|
+
this.updateFilterCanvas('_warmCanvas', 'warm');
|
|
2074
|
+
this.updateFilterCanvas('_grayscaleCanvas', 'grayscale');
|
|
2075
|
+
this.updateFilterCanvas('_sepiaCanvas', 'sepia');
|
|
2076
|
+
this.updateFilterCanvas('_invertCanvas', 'invert');
|
|
2077
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
2078
|
+
};
|
|
2079
|
+
ToolbarModule.prototype.updateFilterCanvas = function (selector, type) {
|
|
2080
|
+
var filter = this.parent.element.querySelector('#' + this.parent.element.id + selector);
|
|
2081
|
+
if (!isNullOrUndefined(filter)) {
|
|
2082
|
+
var ctx = filter.getContext('2d');
|
|
2083
|
+
ctx = filter.getContext('2d');
|
|
2084
|
+
filter.style.width = '100px';
|
|
2085
|
+
filter.style.height = '100px';
|
|
2086
|
+
this.parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
|
|
2087
|
+
ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
ToolbarModule.prototype.getQuickAccessToolbarItem = function (isPenEdit) {
|
|
2091
|
+
var parent = this.parent;
|
|
2092
|
+
var args = { cancel: false, toolbarItems: [] };
|
|
2093
|
+
var toolbarItems = [];
|
|
2094
|
+
if (isNullOrUndefined(isPenEdit)) {
|
|
2095
|
+
toolbarItems.push('Clone');
|
|
2096
|
+
toolbarItems.push('Delete');
|
|
2097
|
+
if (parent.activeObj.shape === 'text') {
|
|
2098
|
+
toolbarItems.push('EditText');
|
|
2099
|
+
}
|
|
2100
|
+
args.shape = parent.toPascalCase(parent.activeObj.shape);
|
|
2101
|
+
}
|
|
2102
|
+
else if (isPenEdit) {
|
|
2103
|
+
toolbarItems.push('Delete');
|
|
2104
|
+
args.shape = 'Freehand draw';
|
|
2105
|
+
}
|
|
2106
|
+
args.toolbarItems = extend([], toolbarItems, null, true);
|
|
2107
|
+
parent.trigger('quickAccessToolbarOpen', args);
|
|
2108
|
+
var orgToolbarItems = [];
|
|
2109
|
+
if (args.cancel) {
|
|
2110
|
+
orgToolbarItems = [];
|
|
2111
|
+
}
|
|
2112
|
+
else {
|
|
2113
|
+
for (var i = 0; i < args.toolbarItems.length; i++) {
|
|
2114
|
+
switch (args.toolbarItems[i]) {
|
|
2115
|
+
case 'Clone':
|
|
2116
|
+
orgToolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
|
|
2117
|
+
tooltipText: this.l10n.getConstant('Duplicate'), align: 'Left' });
|
|
2118
|
+
break;
|
|
2119
|
+
case 'Delete':
|
|
2120
|
+
orgToolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
|
|
2121
|
+
tooltipText: this.l10n.getConstant('Remove'), align: 'Left' });
|
|
2122
|
+
break;
|
|
2123
|
+
case 'EditText':
|
|
2124
|
+
orgToolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
|
|
2125
|
+
tooltipText: this.l10n.getConstant('EditText'), align: 'Left' });
|
|
2126
|
+
break;
|
|
2127
|
+
default:
|
|
2128
|
+
orgToolbarItems.push(args.toolbarItems[i]);
|
|
2129
|
+
break;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
return orgToolbarItems;
|
|
2134
|
+
};
|
|
2135
|
+
ToolbarModule.prototype.renderQAT = function (isPenEdit) {
|
|
2136
|
+
if (!isNullOrUndefined(this.parent.activeObj) && this.parent.showQuickAccessToolbar) {
|
|
2137
|
+
var qtArea = document.getElementById(this.parent.element.id + '_quickAccessToolbarArea');
|
|
2138
|
+
if (!isNullOrUndefined(document.getElementById(this.parent.element.id + '_quickAccessToolbarArea'))) {
|
|
2139
|
+
this.destroyQuickAccessToolbar();
|
|
2140
|
+
document.getElementById(this.parent.element.id + '_quickAccessToolbarArea').style.display = 'block';
|
|
2141
|
+
}
|
|
2142
|
+
var items = this.getQuickAccessToolbarItem(isPenEdit);
|
|
2143
|
+
if (items.length === 0) {
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
if (isNullOrUndefined(this.parent.quickAccessToolbarTemplate)) {
|
|
2147
|
+
var toolbarObj = new Toolbar({
|
|
2148
|
+
items: items,
|
|
2149
|
+
clicked: this.quickAccessToolbarClicked.bind(this)
|
|
2150
|
+
});
|
|
2151
|
+
toolbarObj.appendTo('#' + this.parent.element.id + '_quickAccessToolbar');
|
|
2152
|
+
}
|
|
2153
|
+
if (isNullOrUndefined(isPenEdit)) {
|
|
2154
|
+
qtArea.style.width = 'auto';
|
|
2155
|
+
this.parent.activeObj.activePoint.width = Math.abs(this.parent.activeObj.activePoint.width);
|
|
2156
|
+
this.parent.activeObj.activePoint.height = Math.abs(this.parent.activeObj.activePoint.height);
|
|
2157
|
+
var x = this.parent.activeObj.activePoint.startX < this.parent.activeObj.activePoint.endX ?
|
|
2158
|
+
this.parent.activeObj.activePoint.startX : this.parent.activeObj.activePoint.endX;
|
|
2159
|
+
var y = this.parent.activeObj.activePoint.startY < this.parent.activeObj.activePoint.endY ?
|
|
2160
|
+
this.parent.activeObj.activePoint.startY : this.parent.activeObj.activePoint.endY;
|
|
2161
|
+
var width = this.parent.activeObj.activePoint.width;
|
|
2162
|
+
if (this.parent.activeObj.rotatedAngle !== 0 && this.parent.activeObj.shape !== 'arrow') {
|
|
2163
|
+
var point = this.parent.getSquarePointForRotatedShape(this.parent.activeObj);
|
|
2164
|
+
x = point.startX;
|
|
2165
|
+
y = point.startY;
|
|
2166
|
+
width = point.width;
|
|
2167
|
+
}
|
|
2168
|
+
else if (this.parent.activeObj.shape === 'path') {
|
|
2169
|
+
var path = this.parent.getSquarePointForPath(this.parent.activeObj);
|
|
2170
|
+
x = path.startX;
|
|
2171
|
+
y = path.startY;
|
|
2172
|
+
width = path.width;
|
|
2173
|
+
}
|
|
2174
|
+
qtArea.style.left = (x + (width / 2)) - (items.length * 25) + 'px';
|
|
2175
|
+
if (y - 60 < this.parent.img.destTop) {
|
|
2176
|
+
qtArea.style.top = this.parent.img.destTop + 'px';
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
qtArea.style.top = y - 60 + 'px';
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
else if (isPenEdit) {
|
|
2183
|
+
var obj = { activePoint: null };
|
|
2184
|
+
var indexObj = { freehandSelectedIndex: null };
|
|
2185
|
+
this.parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
2186
|
+
this.parent.notify('freehand-draw', { prop: 'getSqPtFD',
|
|
2187
|
+
value: { idx: indexObj['freehandSelectedIndex'], obj: obj } });
|
|
2188
|
+
var point = obj['activePoint'];
|
|
2189
|
+
qtArea.style.width = 'auto';
|
|
2190
|
+
qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
|
|
2191
|
+
if (point.startY - 60 < this.parent.img.destTop) {
|
|
2192
|
+
qtArea.style.top = this.parent.img.destTop + 'px';
|
|
2193
|
+
}
|
|
2194
|
+
else {
|
|
2195
|
+
qtArea.style.top = point.startY - 60 + 'px';
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2200
|
+
ToolbarModule.prototype.refreshDropDownBtn = function (isDisabled) {
|
|
2201
|
+
if (isNullOrUndefined(isDisabled)) {
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
var annotation = document.querySelector('#' + this.parent.element.id + '_annotationBtn');
|
|
2205
|
+
if (!isNullOrUndefined(annotation)) {
|
|
2206
|
+
if (isDisabled) {
|
|
2207
|
+
annotation.classList.add('e-disabled');
|
|
2208
|
+
annotation.parentElement.classList.add('e-overlay');
|
|
2209
|
+
}
|
|
2210
|
+
else {
|
|
2211
|
+
annotation.classList.remove('e-disabled');
|
|
2212
|
+
annotation.parentElement.classList.remove('e-overlay');
|
|
2213
|
+
}
|
|
2214
|
+
getComponent(annotation, 'dropdown-btn').disabled = isDisabled;
|
|
2215
|
+
}
|
|
2216
|
+
var transform = document.querySelector('#' + this.parent.element.id + '_transformBtn');
|
|
2217
|
+
if (!isNullOrUndefined(transform)) {
|
|
2218
|
+
if (isDisabled) {
|
|
2219
|
+
transform.classList.add('e-disabled');
|
|
2220
|
+
transform.parentElement.classList.add('e-overlay');
|
|
2221
|
+
}
|
|
2222
|
+
else {
|
|
2223
|
+
transform.classList.remove('e-disabled');
|
|
2224
|
+
transform.parentElement.classList.remove('e-overlay');
|
|
2225
|
+
}
|
|
2226
|
+
getComponent(transform, 'dropdown-btn').disabled = isDisabled;
|
|
2227
|
+
}
|
|
2228
|
+
var adjustment = document.querySelector('#' + this.parent.element.id + '_adjustment');
|
|
2229
|
+
if (!isNullOrUndefined(adjustment)) {
|
|
2230
|
+
if (isDisabled) {
|
|
2231
|
+
adjustment.classList.add('e-disabled');
|
|
2232
|
+
adjustment.parentElement.classList.add('e-overlay');
|
|
2233
|
+
}
|
|
2234
|
+
else {
|
|
2235
|
+
adjustment.classList.remove('e-disabled');
|
|
2236
|
+
adjustment.parentElement.classList.remove('e-overlay');
|
|
2237
|
+
}
|
|
2238
|
+
getComponent(adjustment, 'btn').disabled = isDisabled;
|
|
2239
|
+
}
|
|
2240
|
+
var filter = document.querySelector('#' + this.parent.element.id + '_filter');
|
|
2241
|
+
if (!isNullOrUndefined(filter)) {
|
|
2242
|
+
if (isDisabled) {
|
|
2243
|
+
filter.classList.add('e-disabled');
|
|
2244
|
+
filter.parentElement.classList.add('e-overlay');
|
|
2245
|
+
}
|
|
2246
|
+
else {
|
|
2247
|
+
filter.classList.remove('e-disabled');
|
|
2248
|
+
filter.parentElement.classList.remove('e-overlay');
|
|
2249
|
+
}
|
|
2250
|
+
getComponent(filter, 'btn').disabled = isDisabled;
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
ToolbarModule.prototype.cropSelect = function (args) {
|
|
2254
|
+
var parent = this.parent;
|
|
2255
|
+
parent.isCropTab = true;
|
|
2256
|
+
if (isNullOrUndefined(parent.transform.cropZoomFactor)) {
|
|
2257
|
+
parent.transform.cropZoomFactor = parent.transform.zoomFactor;
|
|
2258
|
+
parent.notify('draw', { prop: 'setTempZoomFactor', onPropertyChange: false, value: { tempZoomFactor: parent.transform.zoomFactor } });
|
|
2259
|
+
}
|
|
2260
|
+
parent.transform.zoomFactor = parent.transform.cropZoomFactor;
|
|
2261
|
+
var text = args.item.id;
|
|
2262
|
+
this.currentToolbar = 'crop';
|
|
2263
|
+
parent.currSelectionPoint = null;
|
|
2264
|
+
parent.select(text);
|
|
2265
|
+
this.enableDisableTbrBtn();
|
|
2266
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
2267
|
+
};
|
|
2268
|
+
ToolbarModule.prototype.quickAccessToolbarClicked = function (args, isContextualToolbar) {
|
|
2269
|
+
var parent = this.parent;
|
|
2270
|
+
var points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
|
|
2271
|
+
if (!isNullOrUndefined(args.item)) {
|
|
2272
|
+
var duplicateObj = void 0;
|
|
2273
|
+
var objColl = void 0;
|
|
2274
|
+
var isPreventUndoRedo = null;
|
|
2275
|
+
var obj = { prevActObj: null };
|
|
2276
|
+
var object = { tempObj: null };
|
|
2277
|
+
parent.notify('draw', { prop: 'getPrevActObj', onPropertyChange: false, value: { obj: obj } });
|
|
2278
|
+
parent.notify('selection', { prop: 'getTempActObj', onPropertyChange: false, value: { obj: object } });
|
|
2279
|
+
object['tempObj']['activePoint']['height'] = Math.abs(object['tempObj']['activePoint']['height']);
|
|
2280
|
+
var pathObject = { isNewPath: null };
|
|
2281
|
+
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
2282
|
+
switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
|
|
2283
|
+
case 'duplicate':
|
|
2284
|
+
if (!this.parent.element.querySelector('#' + this.parent.element.id + '_duplicate').classList.contains('e-disabled')) {
|
|
2285
|
+
if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
|
|
2286
|
+
isPreventUndoRedo = true;
|
|
2287
|
+
}
|
|
2288
|
+
duplicateObj = extend({}, parent.activeObj, {}, true);
|
|
2289
|
+
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
2290
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
2291
|
+
}
|
|
2292
|
+
else if (!isNullOrUndefined(obj['prevActObj'])) {
|
|
2293
|
+
parent.activeObj.currIndex = null;
|
|
2294
|
+
duplicateObj.currIndex = null;
|
|
2295
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
2296
|
+
}
|
|
2297
|
+
else {
|
|
2298
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
2299
|
+
}
|
|
2300
|
+
if (pathObject['isNewPath']) {
|
|
2301
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2302
|
+
}
|
|
2303
|
+
objColl = extend([], parent.objColl, [], true);
|
|
2304
|
+
duplicateObj.activePoint.startX += 10;
|
|
2305
|
+
duplicateObj.activePoint.startY -= 10;
|
|
2306
|
+
duplicateObj.activePoint.endX += 10;
|
|
2307
|
+
duplicateObj.activePoint.endY -= 10;
|
|
2308
|
+
if (duplicateObj.shape === 'path') {
|
|
2309
|
+
for (var i = 0; i < duplicateObj.pointColl.length; i++) {
|
|
2310
|
+
duplicateObj.pointColl[i].x += 10;
|
|
2311
|
+
duplicateObj.pointColl[i].y -= 10;
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
parent.activeObj = duplicateObj;
|
|
2315
|
+
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
2316
|
+
parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
|
|
2317
|
+
value: { obj: parent.activeObj } });
|
|
2318
|
+
}
|
|
2319
|
+
// parent.updateTrianglePoints(this.parent.activeObj); Invoke
|
|
2320
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
2321
|
+
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
2322
|
+
this.renderQAT();
|
|
2323
|
+
}
|
|
2324
|
+
break;
|
|
2325
|
+
case 'remove':
|
|
2326
|
+
if (!this.parent.element.querySelector('#' + this.parent.element.id + '_remove').classList.contains('e-disabled')) {
|
|
2327
|
+
parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
|
|
2328
|
+
}
|
|
2329
|
+
break;
|
|
2330
|
+
case 'edittext':
|
|
2331
|
+
if (!this.parent.element.querySelector('#' + this.parent.element.id + '_editText').classList.contains('e-disabled')) {
|
|
2332
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2333
|
+
parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
|
|
2334
|
+
value: { obj: extend({}, parent.activeObj, {}, true) } });
|
|
2335
|
+
parent.notify('selection', { prop: 'setInitialTextEdit', onPropertyChange: false,
|
|
2336
|
+
value: { bool: true } });
|
|
2337
|
+
parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
|
|
2338
|
+
value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
|
|
2339
|
+
if (parent.activeObj.rotatedAngle !== 0) {
|
|
2340
|
+
points.x = parent.activeObj.horTopLinePointColl[0].x;
|
|
2341
|
+
points.y = parent.activeObj.horTopLinePointColl[0].y;
|
|
2342
|
+
}
|
|
2343
|
+
parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
|
|
2344
|
+
value: { x: points.x, y: points.y, actObj: parent.activeObj } });
|
|
2345
|
+
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
2346
|
+
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
2347
|
+
}
|
|
2348
|
+
else if (!isNullOrUndefined(obj['prevActObj'])) {
|
|
2349
|
+
parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
|
|
2350
|
+
}
|
|
2351
|
+
if (!isNullOrUndefined(document.getElementById(this.parent.element.id + '_quickAccessToolbarArea'))) {
|
|
2352
|
+
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
break;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
if (isNullOrUndefined(isContextualToolbar)) {
|
|
2359
|
+
parent.trigger('quickAccessToolbarItemClick', args);
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
ToolbarModule.prototype.defToolbarClicked = function (args) {
|
|
2363
|
+
var parent = this.parent;
|
|
2364
|
+
var isContextualToolbar = false;
|
|
2365
|
+
var isFilterFinetune = false;
|
|
2366
|
+
if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
2367
|
+
if (!parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hide')) {
|
|
2368
|
+
isContextualToolbar = isFilterFinetune = true;
|
|
2369
|
+
}
|
|
2370
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
2371
|
+
}
|
|
2372
|
+
if (!isNullOrUndefined(args.item)) {
|
|
2373
|
+
var type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
|
|
2374
|
+
if (type === 'duplicate' || type === 'remove' || type === 'edittext') {
|
|
2375
|
+
this.quickAccessToolbarClicked(args, true);
|
|
2376
|
+
parent.trigger('toolbarItemClicked', args);
|
|
2377
|
+
}
|
|
2378
|
+
else {
|
|
2379
|
+
var isDisabledFilter = false;
|
|
2380
|
+
var isDisabledAdjustment = false;
|
|
2381
|
+
var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
|
|
2382
|
+
if (!isNullOrUndefined(adjustment) && adjustment.classList.contains('e-disabled')) {
|
|
2383
|
+
isDisabledAdjustment = true;
|
|
2384
|
+
}
|
|
2385
|
+
var filter = document.querySelector('#' + parent.element.id + '_filter');
|
|
2386
|
+
if (!isNullOrUndefined(filter) && filter.classList.contains('e-disabled')) {
|
|
2387
|
+
isDisabledFilter = true;
|
|
2388
|
+
}
|
|
2389
|
+
this.enableDisableTbrBtn();
|
|
2390
|
+
this.performDefTbrClick(type, isContextualToolbar, isDisabledAdjustment, isDisabledFilter, isFilterFinetune);
|
|
2391
|
+
parent.trigger('toolbarItemClicked', args);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
ToolbarModule.prototype.performDefTbrClick = function (type, isContextualToolbar, isDisabledAdjustment, isDisabledFilter, isFilterFinetune) {
|
|
2396
|
+
var parent = this.parent;
|
|
2397
|
+
var zoomIn = parent.element.querySelector('#' + parent.element.id + '_zoomIn');
|
|
2398
|
+
var isCropSelection = false;
|
|
2399
|
+
var panBtn;
|
|
2400
|
+
var splitWords;
|
|
2401
|
+
if (parent.activeObj.shape !== undefined) {
|
|
2402
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
2403
|
+
}
|
|
2404
|
+
if (splitWords === undefined && parent.currObjType.isCustomCrop) {
|
|
2405
|
+
isCropSelection = true;
|
|
2406
|
+
}
|
|
2407
|
+
else if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
2408
|
+
isCropSelection = true;
|
|
2409
|
+
}
|
|
2410
|
+
if (!parent.disabled) {
|
|
2411
|
+
switch (type) {
|
|
2412
|
+
case 'pan':
|
|
2413
|
+
parent.currObjType.isCustomCrop = parent.currObjType.isFiltered = false;
|
|
2414
|
+
if (parent.currObjType.isUndoAction) {
|
|
2415
|
+
parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
|
|
2416
|
+
}
|
|
2417
|
+
if (isCropSelection) {
|
|
2418
|
+
parent.currObjType.isCustomCrop = false;
|
|
2419
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2420
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2421
|
+
this.refreshToolbar('main');
|
|
2422
|
+
}
|
|
2423
|
+
if (parent.togglePan) {
|
|
2424
|
+
this.cancelPan();
|
|
2425
|
+
parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: true } });
|
|
2426
|
+
if (this.currentToolbar === 'pen') {
|
|
2427
|
+
parent.freehandDraw(true);
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
else {
|
|
2431
|
+
panBtn = this.parent.element.querySelector('.e-img-pan .e-btn');
|
|
2432
|
+
if (!isNullOrUndefined(panBtn)) {
|
|
2433
|
+
panBtn.classList.add('e-selected-btn');
|
|
2434
|
+
}
|
|
2435
|
+
parent.pan(true);
|
|
2436
|
+
parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: false } });
|
|
2437
|
+
}
|
|
2438
|
+
if (!isNullOrUndefined(zoomIn) && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
|
|
2439
|
+
zoomIn.classList.add('e-disabled');
|
|
2440
|
+
zoomIn.parentElement.classList.add('e-overlay');
|
|
2441
|
+
}
|
|
2442
|
+
else if (!isNullOrUndefined(zoomIn)) {
|
|
2443
|
+
zoomIn.classList.remove('e-disabled');
|
|
2444
|
+
zoomIn.parentElement.classList.remove('e-overlay');
|
|
2445
|
+
}
|
|
2446
|
+
this.refreshToolbar('main');
|
|
2447
|
+
break;
|
|
2448
|
+
case 'cancel':
|
|
2449
|
+
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar } });
|
|
2450
|
+
break;
|
|
2451
|
+
case 'ok':
|
|
2452
|
+
parent.okBtn();
|
|
2453
|
+
this.refreshDropDownBtn(false);
|
|
2454
|
+
this.currentToolbar = 'main';
|
|
2455
|
+
break;
|
|
2456
|
+
case 'crop':
|
|
2457
|
+
if (!isNullOrUndefined(parent.currSelectionPoint)) {
|
|
2458
|
+
if (parent.currObjType.isUndoAction) {
|
|
2459
|
+
parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
|
|
2460
|
+
}
|
|
2461
|
+
if (!isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
2462
|
+
parent.select(parent.activeObj.shape);
|
|
2463
|
+
}
|
|
2464
|
+
this.refreshToolbar('main', true, true);
|
|
2465
|
+
getComponent(parent.element.querySelector('#' + this.parent.element.id + '_cropBtn'), 'dropdown-btn').toggle();
|
|
2466
|
+
if (!isNullOrUndefined(parent.activeObj.shape)) {
|
|
2467
|
+
document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
2471
|
+
break;
|
|
2472
|
+
case 'reset':
|
|
2473
|
+
parent.reset();
|
|
2474
|
+
this.currentToolbar = 'main';
|
|
2475
|
+
break;
|
|
2476
|
+
case 'undo':
|
|
2477
|
+
parent.notify('undo-redo', { prop: 'call-undo' });
|
|
2478
|
+
break;
|
|
2479
|
+
case 'redo':
|
|
2480
|
+
parent.notify('undo-redo', { prop: 'call-redo' });
|
|
2481
|
+
break;
|
|
2482
|
+
case 'adjustment':
|
|
2483
|
+
if (!isDisabledAdjustment) {
|
|
2484
|
+
if (parent.currObjType.isFiltered) {
|
|
2485
|
+
parent.okBtn();
|
|
2486
|
+
}
|
|
2487
|
+
this.refreshToolbar('adjustment');
|
|
2488
|
+
parent.setTempFilterProperties();
|
|
2489
|
+
this.openSlider('brightness');
|
|
2490
|
+
}
|
|
2491
|
+
break;
|
|
2492
|
+
case 'brightness':
|
|
2493
|
+
case 'contrast':
|
|
2494
|
+
case 'hue':
|
|
2495
|
+
case 'saturation':
|
|
2496
|
+
case 'opacity':
|
|
2497
|
+
case 'blur':
|
|
2498
|
+
case 'exposure':
|
|
2499
|
+
this.openSlider(type);
|
|
2500
|
+
break;
|
|
2501
|
+
case 'filter':
|
|
2502
|
+
if (!isDisabledFilter) {
|
|
2503
|
+
showSpinner(parent.element);
|
|
2504
|
+
this.refreshToolbar('filter');
|
|
2505
|
+
parent.setTempFilterProperties();
|
|
2506
|
+
hideSpinner(parent.element);
|
|
2507
|
+
}
|
|
2508
|
+
break;
|
|
2509
|
+
case 'default':
|
|
2510
|
+
case 'chrome':
|
|
2511
|
+
case 'cold':
|
|
2512
|
+
case 'warm':
|
|
2513
|
+
case 'grayscale':
|
|
2514
|
+
case 'blackandwhite':
|
|
2515
|
+
case 'sepia':
|
|
2516
|
+
case 'invert':
|
|
2517
|
+
case 'sharpen':
|
|
2518
|
+
parent.currObjType.isFiltered = true;
|
|
2519
|
+
parent.notify('filter', { prop: 'applyImageFilter', value: { option: type } });
|
|
2520
|
+
break;
|
|
2521
|
+
case 'upload':
|
|
2522
|
+
if (isFilterFinetune) {
|
|
2523
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.remove('e-hide');
|
|
2524
|
+
}
|
|
2525
|
+
break;
|
|
2526
|
+
case 'bold':
|
|
2527
|
+
parent.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
|
|
2528
|
+
if (parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
2529
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2530
|
+
value: { item: 'italic' } });
|
|
2531
|
+
}
|
|
2532
|
+
else if (parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
2533
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2534
|
+
value: { item: 'default' } });
|
|
2535
|
+
}
|
|
2536
|
+
else if (!parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
2537
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2538
|
+
value: { item: 'bolditalic' } });
|
|
2539
|
+
}
|
|
2540
|
+
else if (!parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
2541
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2542
|
+
value: { item: 'bold' } });
|
|
2543
|
+
}
|
|
2544
|
+
if (parent.element.querySelector('#' + parent.element.id + '_bold').classList.contains('e-selected-btn')) {
|
|
2545
|
+
parent.element.querySelector('#' + parent.element.id + '_bold').classList.remove('e-selected-btn');
|
|
2546
|
+
}
|
|
2547
|
+
else {
|
|
2548
|
+
parent.element.querySelector('#' + parent.element.id + '_bold').classList.add('e-selected-btn');
|
|
2549
|
+
}
|
|
2550
|
+
break;
|
|
2551
|
+
case 'italic':
|
|
2552
|
+
parent.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
|
|
2553
|
+
if (parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
2554
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2555
|
+
value: { item: 'bold' } });
|
|
2556
|
+
}
|
|
2557
|
+
else if (parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
2558
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2559
|
+
value: { item: 'bolditalic' } });
|
|
2560
|
+
}
|
|
2561
|
+
else if (!parent.activeObj.textSettings.bold && parent.activeObj.textSettings.italic) {
|
|
2562
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2563
|
+
value: { item: 'default' } });
|
|
2564
|
+
}
|
|
2565
|
+
else if (!parent.activeObj.textSettings.bold && !parent.activeObj.textSettings.italic) {
|
|
2566
|
+
parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
|
|
2567
|
+
value: { item: 'italic' } });
|
|
2568
|
+
}
|
|
2569
|
+
if (parent.element.querySelector('#' + parent.element.id + '_italic').classList.contains('e-selected-btn')) {
|
|
2570
|
+
parent.element.querySelector('#' + parent.element.id + '_italic').classList.remove('e-selected-btn');
|
|
2571
|
+
}
|
|
2572
|
+
else {
|
|
2573
|
+
parent.element.querySelector('#' + parent.element.id + '_italic').classList.add('e-selected-btn');
|
|
2574
|
+
}
|
|
2575
|
+
break;
|
|
2576
|
+
case 'croptransform':
|
|
2577
|
+
this.refreshToolbar('croptransform');
|
|
2578
|
+
break;
|
|
2579
|
+
case 'rotateleft':
|
|
2580
|
+
case 'rotateright':
|
|
2581
|
+
case 'horizontalflip':
|
|
2582
|
+
case 'verticalflip':
|
|
2583
|
+
this.parent.transformSelect(type);
|
|
2584
|
+
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
2585
|
+
break;
|
|
2586
|
+
case 'save':
|
|
2587
|
+
if (parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.contains('e-hide')) {
|
|
2588
|
+
parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.remove('e-hide');
|
|
2589
|
+
break;
|
|
2590
|
+
}
|
|
2591
|
+
else {
|
|
2592
|
+
parent.okBtn();
|
|
2593
|
+
}
|
|
2594
|
+
parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.add('e-hide');
|
|
2595
|
+
parent.element.querySelector('#' + parent.element.id + '_saveBtn').click();
|
|
2596
|
+
break;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
ToolbarModule.prototype.contextualToolbarClicked = function (args) {
|
|
2601
|
+
var parent = this.parent;
|
|
2602
|
+
var selEle = parent.element.querySelector('.e-contextual-toolbar-wrapper .e-toolbar-item.e-selected');
|
|
2603
|
+
if (selEle) {
|
|
2604
|
+
selEle.classList.remove('e-selected');
|
|
2605
|
+
}
|
|
2606
|
+
var type = args.item.id.replace(parent.element.id, '').split('_')[1];
|
|
2607
|
+
var imageFiltering = { filter: parent.toPascalCase(type), cancel: false };
|
|
2608
|
+
this.parent.trigger('imageFiltering', imageFiltering);
|
|
2609
|
+
if (imageFiltering.cancel) {
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
document.getElementById(args.item.id + 'Canvas').parentElement.parentElement.classList.add('e-selected');
|
|
2613
|
+
parent.currObjType.isFiltered = true;
|
|
2614
|
+
parent.notify('filter', { prop: 'applyImageFilter', value: { option: type.toLowerCase() } });
|
|
2615
|
+
parent.currentFilter = args.item.id;
|
|
2616
|
+
this.enableDisableTbrBtn();
|
|
2617
|
+
};
|
|
2618
|
+
ToolbarModule.prototype.refreshShapeDrawing = function () {
|
|
2619
|
+
var object = { shape: '' };
|
|
2620
|
+
this.parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: object } });
|
|
2621
|
+
if (object['shape'] !== '') {
|
|
2622
|
+
this.parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
2623
|
+
this.parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2624
|
+
this.refreshToolbar('main', false);
|
|
2625
|
+
}
|
|
2626
|
+
};
|
|
2627
|
+
ToolbarModule.prototype.zoomInBtnClickHandler = function (e) {
|
|
2628
|
+
var parent = this.parent;
|
|
2629
|
+
if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
2630
|
+
this.refreshShapeDrawing();
|
|
2631
|
+
if (Browser.isDevice && e.type === 'touchstart') {
|
|
2632
|
+
if (!e.returnValue) {
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
e.preventDefault();
|
|
2636
|
+
}
|
|
2637
|
+
var zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
|
|
2638
|
+
EventHandler.trigger(zoomIn, 'click');
|
|
2639
|
+
var obj = { bool: false };
|
|
2640
|
+
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
2641
|
+
if (obj['bool']) {
|
|
2642
|
+
parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
2643
|
+
this.destroyQuickAccessToolbar();
|
|
2644
|
+
}
|
|
2645
|
+
this.applyPreviewFilter();
|
|
2646
|
+
parent.currObjType.isFiltered = false;
|
|
2647
|
+
if (parent.togglePen) {
|
|
2648
|
+
parent.currObjType.isZoomed = true;
|
|
2649
|
+
parent.freeHandDraw(false);
|
|
2650
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2651
|
+
}
|
|
2652
|
+
parent.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
2653
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2654
|
+
value: { zoomFactor: .1, zoomPoint: null } });
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
ToolbarModule.prototype.zoomOutBtnClickHandler = function (e) {
|
|
2658
|
+
var parent = this.parent;
|
|
2659
|
+
if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
2660
|
+
this.refreshShapeDrawing();
|
|
2661
|
+
if (Browser.isDevice && e.type === 'touchstart') {
|
|
2662
|
+
if (!e.returnValue) {
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
e.preventDefault();
|
|
2666
|
+
}
|
|
2667
|
+
var zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
|
|
2668
|
+
EventHandler.trigger(zoomOut, 'click');
|
|
2669
|
+
var obj = { bool: false };
|
|
2670
|
+
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
2671
|
+
if (obj['bool']) {
|
|
2672
|
+
parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
2673
|
+
this.destroyQuickAccessToolbar();
|
|
2674
|
+
}
|
|
2675
|
+
this.applyPreviewFilter();
|
|
2676
|
+
parent.currObjType.isFiltered = false;
|
|
2677
|
+
if (parent.togglePen) {
|
|
2678
|
+
parent.currObjType.isZoomed = true;
|
|
2679
|
+
parent.freeHandDraw(false);
|
|
2680
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2681
|
+
}
|
|
2682
|
+
parent.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
2683
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2684
|
+
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
2685
|
+
}
|
|
2686
|
+
};
|
|
2687
|
+
ToolbarModule.prototype.zoomInBtnMouseDownHandler = function (e) {
|
|
2688
|
+
e.preventDefault();
|
|
2689
|
+
this.zoomBtnHold = setInterval(this.zoomInBtnClickHandler.bind(this), 250);
|
|
2690
|
+
};
|
|
2691
|
+
ToolbarModule.prototype.zoomOutBtnMouseDownHandler = function (e) {
|
|
2692
|
+
e.preventDefault();
|
|
2693
|
+
this.zoomBtnHold = setInterval(this.zoomOutBtnClickHandler.bind(this), 250);
|
|
2694
|
+
};
|
|
2695
|
+
ToolbarModule.prototype.zoomBtnMouseUpHandler = function () {
|
|
2696
|
+
clearInterval(this.zoomBtnHold);
|
|
2697
|
+
this.zoomBtnHold = 0;
|
|
2698
|
+
};
|
|
2699
|
+
ToolbarModule.prototype.closeContextualToolbar = function () {
|
|
2700
|
+
var parent = this.parent;
|
|
2701
|
+
var isContextualToolbar = false;
|
|
2702
|
+
if ((!isNullOrUndefined(parent.element.querySelector('#' + parent.element.id + '_contextualToolbar')) &&
|
|
2703
|
+
!parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
|
|
2704
|
+
(!isNullOrUndefined(parent.element.querySelector('#' + parent.element.id + '_headWrapper'))
|
|
2705
|
+
&& !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
|
|
2706
|
+
parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
2707
|
+
parent.okBtn();
|
|
2708
|
+
this.refreshMainToolbar();
|
|
2709
|
+
isContextualToolbar = true;
|
|
2710
|
+
}
|
|
2711
|
+
return isContextualToolbar;
|
|
2712
|
+
};
|
|
2713
|
+
ToolbarModule.prototype.destroyQuickAccessToolbar = function () {
|
|
2714
|
+
var parent = this.parent;
|
|
2715
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_quickAccessToolbar')) &&
|
|
2716
|
+
!isNullOrUndefined(getComponent(document.getElementById(parent.element.id + '_quickAccessToolbar'), 'toolbar'))) {
|
|
2717
|
+
getComponent(document.getElementById(parent.element.id + '_quickAccessToolbar'), 'toolbar').destroy();
|
|
2718
|
+
}
|
|
2719
|
+
if (!isNullOrUndefined(document.getElementById(parent.element.id + '_quickAccessToolbarArea'))) {
|
|
2720
|
+
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
2721
|
+
}
|
|
2722
|
+
};
|
|
2723
|
+
ToolbarModule.prototype.renderSlider = function (type) {
|
|
2724
|
+
var parent = this.parent;
|
|
2725
|
+
var canvasWrapper = document.querySelector('#' + parent.element.id + '_contextualToolbarArea');
|
|
2726
|
+
var hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
|
|
2727
|
+
var labelWrapper = document.querySelector('#' + parent.element.id + '_labelWrapper');
|
|
2728
|
+
if (!hdrWrapper) {
|
|
2729
|
+
hdrWrapper = canvasWrapper.appendChild(parent.createElement('div', {
|
|
2730
|
+
id: parent.element.id + '_headWrapper',
|
|
2731
|
+
styles: 'position: relative'
|
|
2732
|
+
}));
|
|
2733
|
+
labelWrapper = hdrWrapper.appendChild(this.parent.createElement('label', {
|
|
2734
|
+
id: parent.element.id + '_labelWrapper',
|
|
2735
|
+
styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
2736
|
+
: 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
2737
|
+
}));
|
|
2738
|
+
}
|
|
2739
|
+
else {
|
|
2740
|
+
hdrWrapper.style.display = 'block';
|
|
2741
|
+
}
|
|
2742
|
+
labelWrapper.textContent = this.l10n.getConstant(parent.toPascalCase(type));
|
|
2743
|
+
var sliderWrapper = hdrWrapper.appendChild(parent.createElement('div', {
|
|
2744
|
+
id: parent.element.id + '_sliderWrapper',
|
|
2745
|
+
styles: 'position: absolute'
|
|
2746
|
+
}));
|
|
2747
|
+
var value = this.parent.getCurrAdjustmentValue(type);
|
|
2748
|
+
var min;
|
|
2749
|
+
var max;
|
|
2750
|
+
var slider;
|
|
2751
|
+
if (type === 'brightness' || type === 'contrast' || type === 'saturation' || type === 'exposure') {
|
|
2752
|
+
if (this.parent.finetuneSettings) {
|
|
2753
|
+
if (type === 'brightness' && parent.finetuneSettings.brightness) {
|
|
2754
|
+
min = parent.finetuneSettings.brightness.min;
|
|
2755
|
+
max = parent.finetuneSettings.brightness.max;
|
|
2756
|
+
}
|
|
2757
|
+
else if (type === 'contrast' && parent.finetuneSettings.contrast) {
|
|
2758
|
+
min = parent.finetuneSettings.contrast.min;
|
|
2759
|
+
max = parent.finetuneSettings.contrast.max;
|
|
2760
|
+
}
|
|
2761
|
+
else if (type === 'saturation' && parent.finetuneSettings.saturation) {
|
|
2762
|
+
min = parent.finetuneSettings.saturation.min;
|
|
2763
|
+
max = parent.finetuneSettings.saturation.max;
|
|
2764
|
+
}
|
|
2765
|
+
else if (type === 'exposure' && this.parent.finetuneSettings.exposure) {
|
|
2766
|
+
min = parent.finetuneSettings.exposure.min;
|
|
2767
|
+
max = parent.finetuneSettings.exposure.max;
|
|
2768
|
+
}
|
|
2769
|
+
else {
|
|
2770
|
+
min = -100;
|
|
2771
|
+
max = 100;
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
else {
|
|
2775
|
+
min = -100;
|
|
2776
|
+
max = 100;
|
|
2777
|
+
}
|
|
2778
|
+
slider = this.createSlider(min, max, value, type);
|
|
2779
|
+
}
|
|
2780
|
+
else if (type === 'hue' || type === 'blur' || type === 'opacity') {
|
|
2781
|
+
if (parent.finetuneSettings) {
|
|
2782
|
+
if (type === 'hue' && parent.finetuneSettings.hue) {
|
|
2783
|
+
min = parent.finetuneSettings.hue.min;
|
|
2784
|
+
max = parent.finetuneSettings.hue.max;
|
|
2785
|
+
}
|
|
2786
|
+
else if (type === 'blur' && parent.finetuneSettings.blur) {
|
|
2787
|
+
min = parent.finetuneSettings.blur.min;
|
|
2788
|
+
max = parent.finetuneSettings.blur.max;
|
|
2789
|
+
}
|
|
2790
|
+
else if (type === 'opacity' && parent.finetuneSettings.opacity) {
|
|
2791
|
+
min = parent.finetuneSettings.opacity.min;
|
|
2792
|
+
max = parent.finetuneSettings.opacity.max;
|
|
2793
|
+
}
|
|
2794
|
+
else {
|
|
2795
|
+
min = 0;
|
|
2796
|
+
max = 100;
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
else {
|
|
2800
|
+
min = 0;
|
|
2801
|
+
max = 100;
|
|
2802
|
+
}
|
|
2803
|
+
slider = this.createSlider(min, max, value, type);
|
|
2804
|
+
}
|
|
2805
|
+
slider.appendTo('#' + parent.element.id + '_sliderWrapper');
|
|
2806
|
+
sliderWrapper.style.left = (parseFloat(canvasWrapper.style.width) - parseFloat(slider.width)) / 2 + 'px';
|
|
2807
|
+
};
|
|
2808
|
+
ToolbarModule.prototype.createSlider = function (min, max, value, type) {
|
|
2809
|
+
var _this = this;
|
|
2810
|
+
var parent = this.parent;
|
|
2811
|
+
return new Slider({
|
|
2812
|
+
value: value,
|
|
2813
|
+
tooltip: { isVisible: true, placement: 'Before', showOn: 'Always' },
|
|
2814
|
+
type: 'MinRange',
|
|
2815
|
+
min: min,
|
|
2816
|
+
max: max,
|
|
2817
|
+
step: 10,
|
|
2818
|
+
width: Browser.isDevice ? '200px' : '300px',
|
|
2819
|
+
cssClass: 'e-slider',
|
|
2820
|
+
change: function (args) {
|
|
2821
|
+
_this.parent.setCurrAdjustmentValue(type, args.value);
|
|
2822
|
+
_this.enableDisableTbrBtn();
|
|
2823
|
+
}
|
|
2824
|
+
});
|
|
2825
|
+
};
|
|
2826
|
+
ToolbarModule.prototype.applyPreviewFilter = function () {
|
|
2827
|
+
if (!isNullOrUndefined(document.querySelector('#' + this.parent.element.id + '_sliderWrapper')) ||
|
|
2828
|
+
this.parent.currObjType.isFiltered) {
|
|
2829
|
+
this.parent.initialAdjustmentValue = this.parent.canvasFilter = this.lowerContext.filter;
|
|
2830
|
+
this.parent.currObjType.isFiltered = false;
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
ToolbarModule.prototype.unselectBtn = function () {
|
|
2834
|
+
var selectors = [
|
|
2835
|
+
'#' + this.parent.element.id + '_brightness',
|
|
2836
|
+
'#' + this.parent.element.id + '_contrast',
|
|
2837
|
+
'#' + this.parent.element.id + '_hue',
|
|
2838
|
+
'#' + this.parent.element.id + '_saturation',
|
|
2839
|
+
'#' + this.parent.element.id + '_opacity',
|
|
2840
|
+
'#' + this.parent.element.id + '_blur',
|
|
2841
|
+
'#' + this.parent.element.id + '_exposure'
|
|
2842
|
+
];
|
|
2843
|
+
for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) {
|
|
2844
|
+
var selector = selectors_1[_i];
|
|
2845
|
+
var element = document.querySelector(selector);
|
|
2846
|
+
if (element.classList.contains('e-selected-btn')) {
|
|
2847
|
+
element.classList.remove('e-selected-btn');
|
|
2848
|
+
break;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
ToolbarModule.prototype.openSlider = function (type) {
|
|
2853
|
+
this.unselectBtn();
|
|
2854
|
+
this.parent.currObjType.isFiltered = true;
|
|
2855
|
+
this.refreshToolbar('color', null, null, null, type);
|
|
2856
|
+
document.getElementById(this.parent.element.id + '_' + type).classList.add('e-selected-btn');
|
|
2857
|
+
};
|
|
2858
|
+
ToolbarModule.prototype.refreshSlider = function () {
|
|
2859
|
+
var sliderWrapper = document.querySelector('#' + this.parent.element.id + '_sliderWrapper');
|
|
2860
|
+
// eslint-disable-next-line
|
|
2861
|
+
var slider = document.querySelector('.e-slider');
|
|
2862
|
+
var hdrWrapper = document.querySelector('#' + this.parent.element.id + '_headWrapper');
|
|
2863
|
+
if (hdrWrapper) {
|
|
2864
|
+
hdrWrapper.style.display = 'none';
|
|
2865
|
+
}
|
|
2866
|
+
if (!isNullOrUndefined(sliderWrapper) && !isNullOrUndefined(slider)) {
|
|
2867
|
+
slider.ej2_instances[0].destroy();
|
|
2868
|
+
sliderWrapper.remove();
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
ToolbarModule.prototype.updateToolbarItems = function () {
|
|
2872
|
+
var selFillElem = this.parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
|
|
2873
|
+
var selStrokeElem = this.parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
|
|
2874
|
+
var selTextStrokeElem = this.parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
|
|
2875
|
+
var selPenStrokeElem = this.parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
|
|
2876
|
+
var strokeWidthElem = this.parent.element.querySelector('.e-shape-stroke-width');
|
|
2877
|
+
var fontFamilyElem = this.parent.element.querySelector('.e-text-font-family');
|
|
2878
|
+
var fontSizeElem = this.parent.element.querySelector('.e-text-font-size');
|
|
2879
|
+
var boldBtn = this.parent.element.querySelector('#' + this.parent.element.id + '_bold');
|
|
2880
|
+
var italicBtn = this.parent.element.querySelector('#' + this.parent.element.id + '_italic');
|
|
2881
|
+
if (isNullOrUndefined(this.parent.activeObj.strokeSettings.strokeWidth)) {
|
|
2882
|
+
this.parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
2883
|
+
}
|
|
2884
|
+
if (selFillElem) {
|
|
2885
|
+
if (this.parent.activeObj.strokeSettings.fillColor === '') {
|
|
2886
|
+
selFillElem.classList.add('e-nocolor-item');
|
|
2887
|
+
}
|
|
2888
|
+
else {
|
|
2889
|
+
selFillElem.classList.remove('e-nocolor-item');
|
|
2890
|
+
selFillElem.style.background = this.parent.activeObj.strokeSettings.fillColor;
|
|
2891
|
+
}
|
|
2892
|
+
getComponent(this.parent.element.id + '_shape_fill', 'colorpicker').value
|
|
2893
|
+
= this.parent.activeObj.strokeSettings.fillColor + 'ff';
|
|
2894
|
+
}
|
|
2895
|
+
if (selStrokeElem) {
|
|
2896
|
+
selStrokeElem.style.background = this.parent.activeObj.strokeSettings.strokeColor;
|
|
2897
|
+
getComponent(this.parent.element.id + '_shape_stroke', 'colorpicker').value
|
|
2898
|
+
= this.parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
2899
|
+
}
|
|
2900
|
+
if (selTextStrokeElem) {
|
|
2901
|
+
selTextStrokeElem.style.background = this.parent.activeObj.strokeSettings.strokeColor;
|
|
2902
|
+
getComponent(this.parent.element.id + '_text_font', 'colorpicker').value
|
|
2903
|
+
= this.parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
2904
|
+
}
|
|
2905
|
+
if (selPenStrokeElem) {
|
|
2906
|
+
selPenStrokeElem.style.background = this.parent.activeObj.strokeSettings.strokeColor;
|
|
2907
|
+
getComponent(this.parent.element.id + '_pen_stroke', 'colorpicker').value
|
|
2908
|
+
= this.parent.activeObj.strokeSettings.strokeColor + 'ff';
|
|
2909
|
+
}
|
|
2910
|
+
if (fontFamilyElem) {
|
|
2911
|
+
if (Browser.isDevice) {
|
|
2912
|
+
fontFamilyElem.setAttribute('style', 'font-family:' + this.parent.activeObj.textSettings.fontFamily.toLowerCase());
|
|
2913
|
+
}
|
|
2914
|
+
else {
|
|
2915
|
+
fontFamilyElem.textContent = this.parent.activeObj.textSettings.fontFamily;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
if (fontSizeElem) {
|
|
2919
|
+
for (var i = 0; i < this.parent.fontSizeColl.length; i++) {
|
|
2920
|
+
if (parseInt(this.parent.fontSizeColl[i].text, 10) >= Math.round(this.parent.activeObj.textSettings.fontSize)) {
|
|
2921
|
+
fontSizeElem.textContent = (i + 1).toString();
|
|
2922
|
+
break;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
if (boldBtn) {
|
|
2927
|
+
if (this.parent.activeObj.textSettings.bold) {
|
|
2928
|
+
boldBtn.classList.add('e-selected-btn');
|
|
2929
|
+
}
|
|
2930
|
+
else {
|
|
2931
|
+
boldBtn.classList.remove('e-selected-btn');
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
if (italicBtn) {
|
|
2935
|
+
if (this.parent.activeObj.textSettings.italic) {
|
|
2936
|
+
italicBtn.classList.add('e-selected-btn');
|
|
2937
|
+
}
|
|
2938
|
+
else {
|
|
2939
|
+
italicBtn.classList.remove('e-selected-btn');
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
if (strokeWidthElem) {
|
|
2943
|
+
var strokeWidth = Math.round((this.parent.activeObj.strokeSettings.strokeWidth)).toString();
|
|
2944
|
+
strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
|
|
2945
|
+
}
|
|
2946
|
+
};
|
|
2947
|
+
ToolbarModule.prototype.getStrokeWidth = function (text) {
|
|
2948
|
+
var strokeWidth;
|
|
2949
|
+
var currentWidth = parseInt(text, 10) / 2;
|
|
2950
|
+
switch (currentWidth) {
|
|
2951
|
+
case 1:
|
|
2952
|
+
strokeWidth = this.l10n.getConstant('XSmall');
|
|
2953
|
+
break;
|
|
2954
|
+
case 2:
|
|
2955
|
+
strokeWidth = this.l10n.getConstant('Small');
|
|
2956
|
+
break;
|
|
2957
|
+
case 3:
|
|
2958
|
+
strokeWidth = this.l10n.getConstant('Medium');
|
|
2959
|
+
break;
|
|
2960
|
+
case 4:
|
|
2961
|
+
strokeWidth = this.l10n.getConstant('Large');
|
|
2962
|
+
break;
|
|
2963
|
+
case 5:
|
|
2964
|
+
strokeWidth = this.l10n.getConstant('XLarge');
|
|
2965
|
+
break;
|
|
2966
|
+
}
|
|
2967
|
+
return strokeWidth;
|
|
2968
|
+
};
|
|
2969
|
+
ToolbarModule.prototype.cancelPan = function () {
|
|
2970
|
+
var parent = this.parent;
|
|
2971
|
+
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
2972
|
+
var panBtn = parent.element.querySelector('.e-img-pan .e-btn');
|
|
2973
|
+
if (!isNullOrUndefined(panBtn)) {
|
|
2974
|
+
panBtn.classList.remove('e-selected-btn');
|
|
2975
|
+
}
|
|
2976
|
+
parent.pan(false);
|
|
2977
|
+
};
|
|
2978
|
+
ToolbarModule.prototype.refreshMainToolbar = function () {
|
|
2979
|
+
if (this.currToolbar !== 'main') {
|
|
2980
|
+
this.refreshToolbar('main');
|
|
2981
|
+
}
|
|
2982
|
+
};
|
|
2983
|
+
ToolbarModule.prototype.destroySubComponents = function () {
|
|
2984
|
+
var inputElement = this.parent.element.querySelectorAll('input.e-control');
|
|
2985
|
+
var btnElement = this.parent.element.querySelectorAll('button.e-control');
|
|
2986
|
+
for (var i = 0, len = inputElement.length; i < len; i++) {
|
|
2987
|
+
if (inputElement[i].classList.contains('e-color-picker')) {
|
|
2988
|
+
getComponent(inputElement[i], 'color-picker').destroy();
|
|
2989
|
+
detach(select('input#' + inputElement[i].id, this.parent.element));
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
for (var i = 0, len = btnElement.length; i < len; i++) {
|
|
2993
|
+
if (btnElement[i].classList.contains('e-dropdown-btn')) {
|
|
2994
|
+
getComponent(btnElement[i], 'dropdown-btn').destroy();
|
|
2995
|
+
detach(select('button#' + btnElement[i].id, this.parent.element));
|
|
2996
|
+
}
|
|
2997
|
+
else if (btnElement[i].classList.contains('e-btn')) {
|
|
2998
|
+
getComponent(btnElement[i], 'btn').destroy();
|
|
2999
|
+
detach(select('button#' + btnElement[i].id, this.parent.element));
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
};
|
|
3003
|
+
ToolbarModule.prototype.setInitialShapeSettings = function (args) {
|
|
3004
|
+
var parent = this.parent;
|
|
3005
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3006
|
+
parent.currObjType.shape = args.item.id;
|
|
3007
|
+
parent.activeObj.shape = parent.currObjType.shape.toLowerCase();
|
|
3008
|
+
parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
|
|
3009
|
+
parent.activeObj.shapeDegree = parent.transform.degree;
|
|
3010
|
+
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
3011
|
+
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
3012
|
+
parent.activeObj.flipObjColl = [];
|
|
3013
|
+
};
|
|
3014
|
+
ToolbarModule.prototype.getModuleName = function () {
|
|
3015
|
+
return 'toolbar-module';
|
|
3016
|
+
};
|
|
3017
|
+
return ToolbarModule;
|
|
3018
|
+
}());
|
|
3019
|
+
export { ToolbarModule };
|