@syncfusion/ej2-image-editor 22.2.11 → 23.1.36
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/CHANGELOG.md +10 -0
- 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 +4269 -687
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +4232 -641
- 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 +12 -12
- package/src/image-editor/action/crop.js +47 -30
- package/src/image-editor/action/draw.d.ts +16 -0
- package/src/image-editor/action/draw.js +827 -81
- package/src/image-editor/action/export.d.ts +3 -0
- package/src/image-editor/action/export.js +84 -20
- package/src/image-editor/action/filter.d.ts +0 -1
- package/src/image-editor/action/filter.js +28 -41
- package/src/image-editor/action/freehand-draw.js +42 -32
- package/src/image-editor/action/selection.d.ts +6 -0
- package/src/image-editor/action/selection.js +380 -66
- package/src/image-editor/action/shape.d.ts +8 -0
- package/src/image-editor/action/shape.js +286 -91
- package/src/image-editor/action/transform.d.ts +9 -0
- package/src/image-editor/action/transform.js +402 -52
- package/src/image-editor/action/undo-redo.d.ts +1 -0
- package/src/image-editor/action/undo-redo.js +138 -10
- package/src/image-editor/base/enum.d.ts +38 -1
- package/src/image-editor/base/enum.js +39 -0
- package/src/image-editor/base/image-editor-model.d.ts +16 -2
- package/src/image-editor/base/image-editor.d.ts +134 -7
- package/src/image-editor/base/image-editor.js +611 -69
- package/src/image-editor/base/interface.d.ts +233 -2
- package/src/image-editor/renderer/toolbar.d.ts +25 -0
- package/src/image-editor/renderer/toolbar.js +1273 -72
- package/styles/bootstrap-dark.css +68 -1
- package/styles/bootstrap.css +68 -1
- package/styles/bootstrap4.css +68 -1
- package/styles/bootstrap5-dark.css +68 -1
- package/styles/bootstrap5.css +68 -1
- package/styles/fabric-dark.css +68 -1
- package/styles/fabric.css +68 -1
- package/styles/fluent-dark.css +68 -1
- package/styles/fluent.css +68 -1
- package/styles/highcontrast-light.css +70 -3
- package/styles/highcontrast.css +69 -7
- package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
- package/styles/image-editor/_bootstrap-definition.scss +1 -0
- package/styles/image-editor/_bootstrap4-definition.scss +1 -0
- package/styles/image-editor/_bootstrap5-definition.scss +1 -0
- package/styles/image-editor/_fabric-dark-definition.scss +1 -0
- package/styles/image-editor/_fabric-definition.scss +1 -0
- package/styles/image-editor/_fluent-definition.scss +1 -0
- package/styles/image-editor/_fusionnew-definition.scss +1 -0
- package/styles/image-editor/_highcontrast-definition.scss +2 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +2 -1
- package/styles/image-editor/_layout.scss +92 -0
- package/styles/image-editor/_material-dark-definition.scss +1 -0
- package/styles/image-editor/_material-definition.scss +1 -0
- package/styles/image-editor/_material3-definition.scss +2 -1
- package/styles/image-editor/_tailwind-definition.scss +1 -0
- package/styles/image-editor/_theme.scss +4 -2
- package/styles/image-editor/bootstrap-dark.css +68 -1
- package/styles/image-editor/bootstrap-dark.scss +1 -1
- package/styles/image-editor/bootstrap.css +68 -1
- package/styles/image-editor/bootstrap.scss +1 -1
- package/styles/image-editor/bootstrap4.css +68 -1
- package/styles/image-editor/bootstrap4.scss +1 -1
- package/styles/image-editor/bootstrap5-dark.css +68 -1
- package/styles/image-editor/bootstrap5-dark.scss +1 -1
- package/styles/image-editor/bootstrap5.css +68 -1
- package/styles/image-editor/bootstrap5.scss +1 -1
- package/styles/image-editor/fabric-dark.css +68 -1
- package/styles/image-editor/fabric-dark.scss +1 -1
- package/styles/image-editor/fabric.css +68 -1
- package/styles/image-editor/fabric.scss +1 -1
- package/styles/image-editor/fluent-dark.css +68 -1
- package/styles/image-editor/fluent-dark.scss +1 -1
- package/styles/image-editor/fluent.css +68 -1
- package/styles/image-editor/fluent.scss +1 -1
- package/styles/image-editor/highcontrast-light.css +70 -3
- package/styles/image-editor/highcontrast-light.scss +1 -1
- package/styles/image-editor/highcontrast.css +69 -7
- package/styles/image-editor/highcontrast.scss +1 -1
- package/styles/image-editor/icons/_bootstrap-dark.scss +1 -0
- package/styles/image-editor/icons/_bootstrap.scss +1 -0
- package/styles/image-editor/icons/_bootstrap4.scss +1 -0
- package/styles/image-editor/icons/_bootstrap5.scss +1 -0
- package/styles/image-editor/icons/_fabric-dark.scss +1 -0
- package/styles/image-editor/icons/_fabric.scss +1 -0
- package/styles/image-editor/icons/_fluent.scss +1 -0
- package/styles/image-editor/icons/_fusionnew.scss +1 -0
- package/styles/image-editor/icons/_highcontrast-light.scss +1 -0
- package/styles/image-editor/icons/_highcontrast.scss +1 -0
- package/styles/image-editor/icons/_material-dark.scss +1 -0
- package/styles/image-editor/icons/_material.scss +1 -0
- package/styles/image-editor/icons/_material3.scss +1 -0
- package/styles/image-editor/icons/_tailwind.scss +1 -0
- package/styles/image-editor/material-dark.css +68 -2
- package/styles/image-editor/material-dark.scss +1 -1
- package/styles/image-editor/material.css +68 -2
- package/styles/image-editor/material.scss +1 -1
- package/styles/image-editor/material3-dark.css +73 -4
- package/styles/image-editor/material3-dark.scss +1 -1
- package/styles/image-editor/material3.css +73 -4
- package/styles/image-editor/material3.scss +1 -1
- package/styles/image-editor/tailwind-dark.css +68 -2
- package/styles/image-editor/tailwind-dark.scss +1 -1
- package/styles/image-editor/tailwind.css +68 -2
- package/styles/image-editor/tailwind.scss +1 -1
- package/styles/material-dark.css +68 -2
- package/styles/material.css +68 -2
- package/styles/material3-dark.css +73 -4
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +73 -4
- package/styles/material3.scss +1 -1
- package/styles/tailwind-dark.css +68 -2
- package/styles/tailwind.css +68 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { extend, Browser, detach, select } from '@syncfusion/ej2-base';
|
|
2
2
|
import { EventHandler, getComponent, isNullOrUndefined, L10n } from '@syncfusion/ej2-base';
|
|
3
|
+
import { NumericTextBox } from '@syncfusion/ej2-inputs';
|
|
3
4
|
import { Toolbar } from '@syncfusion/ej2-navigations';
|
|
4
5
|
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
5
6
|
import { ColorPicker, Uploader, Slider } from '@syncfusion/ej2-inputs';
|
|
@@ -14,6 +15,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
14
15
|
this.currentToolbar = 'main';
|
|
15
16
|
this.selFhdColor = '#42a5f5';
|
|
16
17
|
this.preventEnableDisableUr = false;
|
|
18
|
+
this.isAspectRatio = true;
|
|
19
|
+
this.isFrameToolbar = false;
|
|
17
20
|
this.parent = parent;
|
|
18
21
|
this.addEventListener();
|
|
19
22
|
this.initLocale();
|
|
@@ -109,7 +112,50 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
109
112
|
SquareSolid: 'Square Solid',
|
|
110
113
|
None: 'None',
|
|
111
114
|
CropAndTransform: 'Crop and Transform',
|
|
112
|
-
CropSelection: 'Crop Selection'
|
|
115
|
+
CropSelection: 'Crop Selection',
|
|
116
|
+
Image: 'Add Image',
|
|
117
|
+
Transparency: 'Transparency',
|
|
118
|
+
Height: 'Height',
|
|
119
|
+
Width: 'Width',
|
|
120
|
+
AspectRatio: 'Maintain aspect ratio',
|
|
121
|
+
W: 'W',
|
|
122
|
+
H: 'H',
|
|
123
|
+
DragText: 'Drag and drop your image here or',
|
|
124
|
+
BrowseText: 'Browse here...',
|
|
125
|
+
SupportText: 'Supports:',
|
|
126
|
+
Frame: 'Frame',
|
|
127
|
+
Mat: 'Mat',
|
|
128
|
+
Bevel: 'Bevel',
|
|
129
|
+
Inset: 'Inset',
|
|
130
|
+
Hook: 'Hook',
|
|
131
|
+
Color: 'Color',
|
|
132
|
+
Size: 'Size',
|
|
133
|
+
Offset: 'Offset',
|
|
134
|
+
Radius: 'Radius',
|
|
135
|
+
Amount: 'Amount',
|
|
136
|
+
Resize: 'Resize',
|
|
137
|
+
0: '0%',
|
|
138
|
+
20: '20%',
|
|
139
|
+
40: '40%',
|
|
140
|
+
60: '60%',
|
|
141
|
+
80: '80%',
|
|
142
|
+
100: '100%',
|
|
143
|
+
1: '1',
|
|
144
|
+
2: '2',
|
|
145
|
+
3: '3',
|
|
146
|
+
4: '4',
|
|
147
|
+
5: '5',
|
|
148
|
+
Border: 'Border',
|
|
149
|
+
Solid: 'Solid',
|
|
150
|
+
Dashed: 'Dashed',
|
|
151
|
+
Dotted: 'Dotted',
|
|
152
|
+
GradientColor: 'Gradient Color',
|
|
153
|
+
ConfirmDialogHeader: 'Confirm Save Changes',
|
|
154
|
+
ConfirmDialogContent: 'Do you want to save the changes you made to the image?',
|
|
155
|
+
AlertDialogHeader: 'Unsupported file',
|
|
156
|
+
AlertDialogContent: 'The dropped file is unsupported.',
|
|
157
|
+
Yes: 'Yes',
|
|
158
|
+
No: 'No'
|
|
113
159
|
};
|
|
114
160
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
115
161
|
};
|
|
@@ -136,7 +182,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
136
182
|
this.enableDisableTbrBtn();
|
|
137
183
|
break;
|
|
138
184
|
case 'init-main-toolbar':
|
|
139
|
-
this.initMainToolbar(args.value['isApplyBtn'], args.value['isDevice'], args.value['isOkBtn']);
|
|
185
|
+
this.initMainToolbar(args.value['isApplyBtn'], args.value['isDevice'], args.value['isOkBtn'], args.value['isResize']);
|
|
140
186
|
break;
|
|
141
187
|
case 'create-bottom-toolbar':
|
|
142
188
|
this.createBottomToolbar();
|
|
@@ -243,6 +289,24 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
243
289
|
case 'reset':
|
|
244
290
|
this.reset();
|
|
245
291
|
break;
|
|
292
|
+
case 'getLocaleText':
|
|
293
|
+
args.value['obj']['value'] = this.l10n.getConstant(args.value['obj']['key']);
|
|
294
|
+
break;
|
|
295
|
+
case 'initResizeToolbar':
|
|
296
|
+
this.initResizeToolbar();
|
|
297
|
+
break;
|
|
298
|
+
case 'getFrameToolbar':
|
|
299
|
+
args.value['obj']['bool'] = this.isFrameToolbar;
|
|
300
|
+
break;
|
|
301
|
+
case 'callFrameToolbar':
|
|
302
|
+
this.callFrameToolbar();
|
|
303
|
+
break;
|
|
304
|
+
case 'resizeClick':
|
|
305
|
+
this.resizeClick();
|
|
306
|
+
break;
|
|
307
|
+
case 'frameToolbarClick':
|
|
308
|
+
this.frameToolbarClick();
|
|
309
|
+
break;
|
|
246
310
|
}
|
|
247
311
|
};
|
|
248
312
|
ToolbarModule.prototype.updatePrivateVariables = function () {
|
|
@@ -265,10 +329,11 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
265
329
|
parent.prevCurrSelectionPoint = null;
|
|
266
330
|
this.zoomBtnHold = null;
|
|
267
331
|
this.currToolbar = '';
|
|
332
|
+
parent.cxtTbarHeight = null;
|
|
268
333
|
this.currentToolbar = 'main';
|
|
269
334
|
this.selFhdColor = '#42a5f5';
|
|
270
335
|
parent.currentFilter = '';
|
|
271
|
-
this.preventZoomBtn = parent.isCropToolbar = this.preventEnableDisableUr = false;
|
|
336
|
+
this.preventZoomBtn = parent.isCropToolbar = this.preventEnableDisableUr = this.isFrameToolbar = false;
|
|
272
337
|
parent.initialAdjustmentValue = parent.canvasFilter =
|
|
273
338
|
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
274
339
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
@@ -404,16 +469,21 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
404
469
|
toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
|
|
405
470
|
}
|
|
406
471
|
};
|
|
407
|
-
ToolbarModule.prototype.initMainToolbar = function (isApplyOption, isDevice, isOkBtn) {
|
|
472
|
+
ToolbarModule.prototype.initMainToolbar = function (isApplyOption, isDevice, isOkBtn, isResize, isFrame) {
|
|
408
473
|
var _this = this;
|
|
409
474
|
var parent = this.parent;
|
|
410
475
|
if (this.isToolbar()) {
|
|
411
|
-
var leftItem = this.getLeftToolbarItem(isOkBtn);
|
|
476
|
+
var leftItem = this.getLeftToolbarItem(isOkBtn, isResize);
|
|
412
477
|
var rightItem = this.getRightToolbarItem(isOkBtn);
|
|
413
|
-
var mainItem = this.getMainToolbarItem(isApplyOption);
|
|
478
|
+
var mainItem = this.getMainToolbarItem(isApplyOption, isFrame);
|
|
414
479
|
var zoomItem = this.getZoomToolbarItem();
|
|
415
480
|
if (isDevice) {
|
|
416
|
-
|
|
481
|
+
if (isFrame) {
|
|
482
|
+
this.defToolbarItems = mainItem;
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
this.defToolbarItems = leftItem.concat(rightItem);
|
|
486
|
+
}
|
|
417
487
|
}
|
|
418
488
|
else {
|
|
419
489
|
this.defToolbarItems = leftItem.concat(mainItem, rightItem, zoomItem);
|
|
@@ -431,7 +501,12 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
431
501
|
parent.trigger('toolbarCreated', { toolbarType: 'main' });
|
|
432
502
|
}
|
|
433
503
|
});
|
|
434
|
-
|
|
504
|
+
if (isDevice && isFrame) {
|
|
505
|
+
toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
|
|
509
|
+
}
|
|
435
510
|
this.createLeftToolbarControls();
|
|
436
511
|
this.enableDisableTbrBtn();
|
|
437
512
|
if (this.isToolbar() && document.getElementById(parent.element.id + '_toolbar')) {
|
|
@@ -463,14 +538,14 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
463
538
|
}
|
|
464
539
|
}
|
|
465
540
|
};
|
|
466
|
-
ToolbarModule.prototype.getLeftToolbarItem = function (isOkBtn) {
|
|
541
|
+
ToolbarModule.prototype.getLeftToolbarItem = function (isOkBtn, isResize) {
|
|
467
542
|
var parent = this.parent;
|
|
468
543
|
var toolbarItems = [];
|
|
469
|
-
if (!isOkBtn) {
|
|
544
|
+
if (!isOkBtn || isResize) {
|
|
470
545
|
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) });
|
|
471
546
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
472
547
|
}
|
|
473
|
-
if (parent.allowUndoRedo) {
|
|
548
|
+
if (parent.allowUndoRedo && !isResize) {
|
|
474
549
|
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
|
|
475
550
|
toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
|
|
476
551
|
tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
|
|
@@ -480,7 +555,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
480
555
|
tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
|
|
481
556
|
}
|
|
482
557
|
}
|
|
483
|
-
if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
558
|
+
if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar && !isResize) {
|
|
484
559
|
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomOut') > -1)) {
|
|
485
560
|
toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
|
|
486
561
|
tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
|
|
@@ -521,24 +596,60 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
521
596
|
}
|
|
522
597
|
return toolbarItems;
|
|
523
598
|
};
|
|
524
|
-
ToolbarModule.prototype.getMainToolbarItem = function (isApplyOption) {
|
|
599
|
+
ToolbarModule.prototype.getMainToolbarItem = function (isApplyOption, isFrame) {
|
|
525
600
|
var parent = this.parent;
|
|
526
601
|
var toolbarItems = [];
|
|
527
|
-
if (
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
602
|
+
if (isFrame) {
|
|
603
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('None') > -1)) {
|
|
604
|
+
toolbarItems.push({ id: this.parent.element.id + '_none', prefixIcon: 'e-icons e-frame-none', cssClass: 'top-icon e-frame-none',
|
|
605
|
+
tooltipText: this.l10n.getConstant('None'), align: 'Center' });
|
|
606
|
+
}
|
|
607
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Mat') > -1)) {
|
|
608
|
+
toolbarItems.push({ id: this.parent.element.id + '_mat', prefixIcon: 'e-icons e-frame-mat', cssClass: 'top-icon e-frame-mat',
|
|
609
|
+
tooltipText: this.l10n.getConstant('Mat'), align: 'Center' });
|
|
610
|
+
}
|
|
611
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Bevel') > -1)) {
|
|
612
|
+
toolbarItems.push({ id: this.parent.element.id + '_bevel', prefixIcon: 'e-icons e-frame-bevel', cssClass: 'top-icon e-frame-bevel',
|
|
613
|
+
tooltipText: this.l10n.getConstant('Bevel'), align: 'Center' });
|
|
614
|
+
}
|
|
615
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Line') > -1)) {
|
|
616
|
+
toolbarItems.push({ id: this.parent.element.id + '_line', prefixIcon: 'e-icons e-frame-line', cssClass: 'top-icon e-frame-line',
|
|
617
|
+
tooltipText: this.l10n.getConstant('Line'), align: 'Center' });
|
|
618
|
+
}
|
|
619
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Inset') > -1)) {
|
|
620
|
+
toolbarItems.push({ id: this.parent.element.id + '_inset', prefixIcon: 'e-icons e-frame-inset', cssClass: 'top-icon e-frame-inset',
|
|
621
|
+
tooltipText: this.l10n.getConstant('Inset'), align: 'Center' });
|
|
622
|
+
}
|
|
623
|
+
if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Hook') > -1)) {
|
|
624
|
+
toolbarItems.push({ id: this.parent.element.id + '_hook', prefixIcon: 'e-icons e-frame-hook', cssClass: 'top-icon e-frame-hook',
|
|
625
|
+
tooltipText: this.l10n.getConstant('Hook'), align: 'Center' });
|
|
626
|
+
}
|
|
538
627
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
628
|
+
else {
|
|
629
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Crop') > -1)) {
|
|
630
|
+
toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
|
|
631
|
+
tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
|
|
632
|
+
}
|
|
633
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Annotate') > -1)) {
|
|
634
|
+
toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
|
|
635
|
+
template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
|
|
636
|
+
}
|
|
637
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Finetune') > -1)) {
|
|
638
|
+
toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
|
|
639
|
+
tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
|
|
640
|
+
}
|
|
641
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Filter') > -1)) {
|
|
642
|
+
toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
|
|
643
|
+
tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
|
|
644
|
+
}
|
|
645
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Frame') > -1)) {
|
|
646
|
+
toolbarItems.push({ id: parent.element.id + '_frame', prefixIcon: 'e-icons e-border-frame', cssClass: 'top-icon e-border-frame',
|
|
647
|
+
tooltipText: this.l10n.getConstant('Frame'), align: 'Center' });
|
|
648
|
+
}
|
|
649
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Resize') > -1)) {
|
|
650
|
+
toolbarItems.push({ id: parent.element.id + '_resize', prefixIcon: 'e-icons e-resize', cssClass: 'top-icon e-resize',
|
|
651
|
+
tooltipText: this.l10n.getConstant('Resize'), align: 'Center' });
|
|
652
|
+
}
|
|
542
653
|
}
|
|
543
654
|
var tempToolbarItems = this.processToolbar('center');
|
|
544
655
|
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
@@ -580,10 +691,18 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
580
691
|
getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
|
|
581
692
|
}
|
|
582
693
|
this.refreshSlider();
|
|
583
|
-
|
|
694
|
+
if (type === 'frame') {
|
|
695
|
+
this.initFrameToolbarItem();
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
this.renderSlider(cType);
|
|
699
|
+
}
|
|
584
700
|
}
|
|
585
701
|
if (Browser.isDevice) {
|
|
586
702
|
var cHt = contextualToolbarArea.offsetHeight;
|
|
703
|
+
if (this.isFrameToolbar && parent.element.querySelector('#' + parent.element.id + '_customizeWrapper')) {
|
|
704
|
+
cHt = parent.element.querySelector('#' + parent.element.id + '_customizeWrapper').offsetHeight;
|
|
705
|
+
}
|
|
587
706
|
var ht = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper').offsetHeight;
|
|
588
707
|
contextualToolbarArea.style.top = this.toolbarHeight + ht - cHt + 'px';
|
|
589
708
|
}
|
|
@@ -638,6 +757,142 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
638
757
|
zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
|
|
639
758
|
}
|
|
640
759
|
};
|
|
760
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
761
|
+
ToolbarModule.prototype.widthAspectRatio = function (e) {
|
|
762
|
+
var parent = this.parent;
|
|
763
|
+
var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
|
|
764
|
+
var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
|
|
765
|
+
var aspectRatioIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
|
|
766
|
+
var originalWidth = parent.img.destWidth;
|
|
767
|
+
var originalHeight = parent.img.destHeight;
|
|
768
|
+
var aspectRatioHeightValue = parseFloat(aspectRatioHeight.value);
|
|
769
|
+
var width = Math.floor((aspectRatioHeightValue / (originalHeight / originalWidth)));
|
|
770
|
+
if (aspectRatioIcon) {
|
|
771
|
+
if (width != null && !isNaN(width)) {
|
|
772
|
+
getComponent(aspectRatioWidth, 'numerictextbox').value = width;
|
|
773
|
+
aspectRatioWidth.value = width.toString() + ' px';
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
getComponent(aspectRatioWidth, 'numerictextbox').value = 0;
|
|
777
|
+
aspectRatioWidth.value = '0 px';
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
782
|
+
ToolbarModule.prototype.heightAspectRatio = function (e) {
|
|
783
|
+
var parent = this.parent;
|
|
784
|
+
var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
|
|
785
|
+
var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
|
|
786
|
+
var aspectRatioIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
|
|
787
|
+
var originalWidth = parent.img.destWidth;
|
|
788
|
+
var originalHeight = parent.img.destHeight;
|
|
789
|
+
var aspectRatioWidthValue = parseFloat(aspectRatioWidth.value);
|
|
790
|
+
var height = Math.floor((aspectRatioWidthValue / (originalWidth / originalHeight)));
|
|
791
|
+
if (aspectRatioIcon && !isNaN(height)) {
|
|
792
|
+
getComponent(aspectRatioHeight, 'numerictextbox').value = height;
|
|
793
|
+
aspectRatioHeight.value = height.toString() + ' px';
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
getComponent(aspectRatioHeight, 'numerictextbox').value = 0;
|
|
797
|
+
aspectRatioHeight.value = '0 px';
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
ToolbarModule.prototype.getResizeToolbarItem = function () {
|
|
801
|
+
var toolbarItems = [];
|
|
802
|
+
var spanWidth = document.createElement('span');
|
|
803
|
+
spanWidth.innerHTML = this.l10n.getConstant('W');
|
|
804
|
+
toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
|
|
805
|
+
toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
|
|
806
|
+
tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
|
|
807
|
+
showSpinButton: false, value: (this.parent.aspectWidth && this.parent.aspectHeight) ? this.parent.aspectWidth : Math.ceil(this.parent.img.destWidth),
|
|
808
|
+
format: '###.## px' })
|
|
809
|
+
});
|
|
810
|
+
var spanHeight = document.createElement('span');
|
|
811
|
+
spanHeight.innerHTML = this.l10n.getConstant('H');
|
|
812
|
+
toolbarItems.push({ id: this.parent.element.id + '_height', cssClass: 'e-ie-resize-height', template: spanHeight, align: 'Center' });
|
|
813
|
+
toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
|
|
814
|
+
tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
|
|
815
|
+
showSpinButton: false, value: (this.parent.aspectWidth && this.parent.aspectHeight) ? this.parent.aspectHeight : Math.ceil(this.parent.img.destHeight),
|
|
816
|
+
format: '###.## px' })
|
|
817
|
+
});
|
|
818
|
+
if (!this.isAspectRatio) {
|
|
819
|
+
toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
|
|
820
|
+
this.isAspectRatio = true;
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
toolbarItems.push({ id: this.parent.element.id + '_nonaspectratio', prefixIcon: 'e-icons e-unlock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
|
|
824
|
+
this.isAspectRatio = false;
|
|
825
|
+
}
|
|
826
|
+
if (!Browser.isDevice) {
|
|
827
|
+
toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
828
|
+
tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
|
|
829
|
+
toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
|
|
830
|
+
tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
|
|
831
|
+
}
|
|
832
|
+
return toolbarItems;
|
|
833
|
+
};
|
|
834
|
+
ToolbarModule.prototype.initResizeToolbar = function () {
|
|
835
|
+
var _this = this;
|
|
836
|
+
var leftItem = this.getLeftToolbarItem(false, true);
|
|
837
|
+
var rightItem = this.getRightToolbarItem();
|
|
838
|
+
var mainItem = this.getResizeToolbarItem();
|
|
839
|
+
var zoomItem = this.getZoomToolbarItem();
|
|
840
|
+
if (Browser.isDevice) {
|
|
841
|
+
this.defToolbarItems = mainItem;
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
|
|
845
|
+
}
|
|
846
|
+
var toolbar = new Toolbar({
|
|
847
|
+
width: '100%',
|
|
848
|
+
items: this.defToolbarItems,
|
|
849
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
850
|
+
created: function () {
|
|
851
|
+
_this.wireResizeBtnEvents();
|
|
852
|
+
if (!Browser.isDevice) {
|
|
853
|
+
_this.renderSaveBtn();
|
|
854
|
+
}
|
|
855
|
+
_this.parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
|
|
856
|
+
if (Browser.isDevice) {
|
|
857
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar')))) {
|
|
858
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
859
|
+
toolbar.refreshOverflow();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
_this.createLeftToolbarControls();
|
|
864
|
+
if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
|
|
865
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
866
|
+
toolbar.refreshOverflow();
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
if (Browser.isDevice) {
|
|
872
|
+
toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
|
|
876
|
+
}
|
|
877
|
+
this.parent.isResize = false;
|
|
878
|
+
this.enableDisableTbrBtn();
|
|
879
|
+
this.parent.isResize = true;
|
|
880
|
+
this.parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
881
|
+
};
|
|
882
|
+
ToolbarModule.prototype.wireResizeBtnEvents = function () {
|
|
883
|
+
var parent = this.parent;
|
|
884
|
+
var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
|
|
885
|
+
var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
|
|
886
|
+
var aspectRatio = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
|
|
887
|
+
if (aspectRatio) {
|
|
888
|
+
if (!isNullOrUndefined(aspectRatioHeight)) {
|
|
889
|
+
aspectRatioWidth.addEventListener('keyup', this.heightAspectRatio.bind(this));
|
|
890
|
+
}
|
|
891
|
+
if (!isNullOrUndefined(aspectRatioWidth)) {
|
|
892
|
+
aspectRatioHeight.addEventListener('keyup', this.widthAspectRatio.bind(this));
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
641
896
|
ToolbarModule.prototype.enableDisableTbrBtn = function () {
|
|
642
897
|
var parent = this.parent;
|
|
643
898
|
if (!this.preventEnableDisableUr) {
|
|
@@ -645,7 +900,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
645
900
|
parent.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
|
|
646
901
|
var undoRedoObj = { undoRedoStep: null };
|
|
647
902
|
parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
648
|
-
var undo =
|
|
903
|
+
var undo = parent.element.querySelector('#' + parent.element.id + '_undo');
|
|
649
904
|
if (undo && undoRedoObj['undoRedoStep'] === 0) {
|
|
650
905
|
undo.classList.add('e-disabled');
|
|
651
906
|
undo.parentElement.classList.add('e-overlay');
|
|
@@ -654,7 +909,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
654
909
|
undo.classList.remove('e-disabled');
|
|
655
910
|
undo.parentElement.classList.remove('e-overlay');
|
|
656
911
|
}
|
|
657
|
-
var redo =
|
|
912
|
+
var redo = parent.element.querySelector('#' + parent.element.id + '_redo');
|
|
658
913
|
if (redo && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
|
|
659
914
|
redo.classList.add('e-disabled');
|
|
660
915
|
redo.parentElement.classList.add('e-overlay');
|
|
@@ -686,12 +941,12 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
686
941
|
zoomOut.classList.remove('e-disabled');
|
|
687
942
|
zoomOut.parentElement.classList.remove('e-overlay');
|
|
688
943
|
}
|
|
689
|
-
var
|
|
690
|
-
if (
|
|
691
|
-
|
|
944
|
+
var frame = document.querySelector('#' + parent.element.id + '_frame');
|
|
945
|
+
if (frame && ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop)) {
|
|
946
|
+
frame.classList.add('e-disabled');
|
|
692
947
|
}
|
|
693
|
-
else if (
|
|
694
|
-
|
|
948
|
+
else if (frame) {
|
|
949
|
+
frame.classList.remove('e-disabled');
|
|
695
950
|
}
|
|
696
951
|
};
|
|
697
952
|
ToolbarModule.prototype.createLeftToolbarControls = function () {
|
|
@@ -750,6 +1005,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
750
1005
|
if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Text') > -1)) {
|
|
751
1006
|
items.push({ text: this.l10n.getConstant('Text'), id: 'text', iconCss: 'e-icons e-add-text' });
|
|
752
1007
|
}
|
|
1008
|
+
if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Image') > -1)) {
|
|
1009
|
+
items.push({ text: this.l10n.getConstant('Image'), id: 'image', iconCss: 'e-icons e-image' });
|
|
1010
|
+
}
|
|
753
1011
|
var obj = { freehandDrawSelectedId: null };
|
|
754
1012
|
parent.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: obj } });
|
|
755
1013
|
var duplicateElement = document.querySelector('#' + parent.element.id + '_duplicate');
|
|
@@ -784,6 +1042,10 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
784
1042
|
var drpDownBtn = new DropDownButton({ items: items, iconCss: 'e-icons ' + iconCss,
|
|
785
1043
|
cssClass: 'e-image-popup',
|
|
786
1044
|
open: function (args) {
|
|
1045
|
+
if (parent.currObjType.isFiltered) {
|
|
1046
|
+
parent.okBtn();
|
|
1047
|
+
parent.element.querySelector('#' + _this.parent.element.id + '_annotationBtn').click();
|
|
1048
|
+
}
|
|
787
1049
|
if (Browser.isDevice) {
|
|
788
1050
|
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
789
1051
|
args.element.parentElement.offsetHeight + 'px';
|
|
@@ -833,6 +1095,10 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
833
1095
|
// parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: {type: 'text',
|
|
834
1096
|
// isApplyBtn: null, isCropping: null, isZooming: null, cType: null}});
|
|
835
1097
|
break;
|
|
1098
|
+
case 'image':
|
|
1099
|
+
_this.currentToolbar = 'shapes';
|
|
1100
|
+
parent.element.querySelector('#' + _this.parent.element.id + '_fileUpload').click();
|
|
1101
|
+
break;
|
|
836
1102
|
default:
|
|
837
1103
|
_this.currentToolbar = 'shapes';
|
|
838
1104
|
/// parent.notify('shape', { prop: 'draw-shape', value: {obj: (args.item.id).toLowerCase()}});
|
|
@@ -972,28 +1238,20 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
972
1238
|
template: '<button id="' + parent.element.id + '_cropBtn"></button>'
|
|
973
1239
|
});
|
|
974
1240
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
975
|
-
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 ||
|
|
976
|
-
parent.
|
|
977
|
-
toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
|
|
978
|
-
tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
1241
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('RotateLeft') > -1))) {
|
|
1242
|
+
toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise', tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
979
1243
|
}
|
|
980
|
-
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 ||
|
|
981
|
-
parent.
|
|
982
|
-
toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
|
|
983
|
-
tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
1244
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('RotateRight') > -1))) {
|
|
1245
|
+
toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise', tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
984
1246
|
}
|
|
985
1247
|
if (toolbarItems.length > 2) {
|
|
986
1248
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
987
1249
|
}
|
|
988
|
-
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 ||
|
|
989
|
-
parent.
|
|
990
|
-
toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
|
|
991
|
-
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
1250
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('HorizontalFlip') > -1))) {
|
|
1251
|
+
toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip', tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
992
1252
|
}
|
|
993
|
-
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 ||
|
|
994
|
-
parent.
|
|
995
|
-
toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
|
|
996
|
-
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
1253
|
+
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('VerticalFlip') > -1))) {
|
|
1254
|
+
toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip', tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
997
1255
|
}
|
|
998
1256
|
if (!Browser.isDevice) {
|
|
999
1257
|
toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
|
|
@@ -1032,6 +1290,21 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1032
1290
|
toolbarItems.push({ id: parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
|
|
1033
1291
|
type: 'Input', template: '<button id="' + parent.element.id + '_endBtn"></button>' });
|
|
1034
1292
|
}
|
|
1293
|
+
if (items.indexOf('flip') > -1) {
|
|
1294
|
+
toolbarItems.push({ id: parent.element.id + '_rotLeft', prefixIcon: 'e-anti-clock-wise',
|
|
1295
|
+
tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
|
|
1296
|
+
toolbarItems.push({ id: parent.element.id + '_rotRight', prefixIcon: 'e-clock-wise',
|
|
1297
|
+
tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
|
|
1298
|
+
toolbarItems.push({ id: parent.element.id + '_hFlip', prefixIcon: 'e-horizontal-flip',
|
|
1299
|
+
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
|
|
1300
|
+
toolbarItems.push({ id: parent.element.id + '_vFlip', prefixIcon: 'e-vertical-flip',
|
|
1301
|
+
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
|
|
1302
|
+
}
|
|
1303
|
+
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
1304
|
+
if (items.indexOf('transparency') > -1) {
|
|
1305
|
+
toolbarItems.push({ id: parent.element.id + '_transparency', prefixIcon: 'e-opacity',
|
|
1306
|
+
tooltipText: this.l10n.getConstant('Transparency'), align: 'Center' });
|
|
1307
|
+
}
|
|
1035
1308
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
1036
1309
|
if (items.indexOf('duplicate') > -1) {
|
|
1037
1310
|
toolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
|
|
@@ -1135,6 +1408,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1135
1408
|
case 'text':
|
|
1136
1409
|
icon = 'e-add-text';
|
|
1137
1410
|
break;
|
|
1411
|
+
case 'image':
|
|
1412
|
+
icon = 'e-image';
|
|
1413
|
+
break;
|
|
1138
1414
|
case 'pen':
|
|
1139
1415
|
icon = 'e-free-pen';
|
|
1140
1416
|
break;
|
|
@@ -1449,15 +1725,15 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1449
1725
|
toolbarItems.push({ align: 'Center', type: 'Separator' });
|
|
1450
1726
|
if (items.indexOf('duplicate') > -1) {
|
|
1451
1727
|
toolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
|
|
1452
|
-
tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center' });
|
|
1728
|
+
tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center', disabled: parent.textArea.style.display === 'block' ? true : false });
|
|
1453
1729
|
}
|
|
1454
1730
|
if (items.indexOf('remove') > -1) {
|
|
1455
1731
|
toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
|
|
1456
|
-
tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
|
|
1732
|
+
tooltipText: this.l10n.getConstant('Remove'), align: 'Center', disabled: parent.textArea.style.display === 'block' ? true : false });
|
|
1457
1733
|
}
|
|
1458
1734
|
if (items.indexOf('text') > -1) {
|
|
1459
1735
|
toolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
|
|
1460
|
-
tooltipText: this.l10n.getConstant('EditText'), align: 'Center' });
|
|
1736
|
+
tooltipText: this.l10n.getConstant('EditText'), align: 'Center', disabled: parent.textArea.style.display === 'block' ? true : false });
|
|
1461
1737
|
}
|
|
1462
1738
|
var tempToolbarItems = this.processSubToolbar(items);
|
|
1463
1739
|
for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
|
|
@@ -1641,7 +1917,14 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1641
1917
|
}
|
|
1642
1918
|
var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
|
|
1643
1919
|
var args = { toolbarType: item };
|
|
1920
|
+
var aspectIcon;
|
|
1921
|
+
var nonAspectIcon;
|
|
1644
1922
|
if (type !== 'filter' && type !== 'color') {
|
|
1923
|
+
if (document.getElementById(parent.element.id + '_customizeWrapper') &&
|
|
1924
|
+
(getComponent(document.getElementById(parent.element.id + '_customizeWrapper'), 'toolbar')) && this.defToolbarItems.length > 0) {
|
|
1925
|
+
getComponent(document.getElementById(parent.element.id + '_customizeWrapper'), 'toolbar').destroy();
|
|
1926
|
+
document.getElementById(parent.element.id + '_customizeWrapper').innerHTML = '';
|
|
1927
|
+
}
|
|
1645
1928
|
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
1646
1929
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
1647
1930
|
document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
|
|
@@ -1654,6 +1937,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1654
1937
|
}
|
|
1655
1938
|
}
|
|
1656
1939
|
this.refreshSlider();
|
|
1940
|
+
this.isFrameToolbar = false;
|
|
1657
1941
|
parent.isCropTab = false;
|
|
1658
1942
|
switch (type) {
|
|
1659
1943
|
case 'main':
|
|
@@ -1687,6 +1971,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1687
1971
|
else if (parent.activeObj.shape === 'arrow') {
|
|
1688
1972
|
args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
|
|
1689
1973
|
}
|
|
1974
|
+
else if (parent.activeObj.shape === 'image') {
|
|
1975
|
+
args.toolbarItems = ['flip', 'duplicate', 'remove', 'transparency'];
|
|
1976
|
+
}
|
|
1690
1977
|
else {
|
|
1691
1978
|
args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
|
|
1692
1979
|
}
|
|
@@ -1718,10 +2005,27 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1718
2005
|
case 'filter':
|
|
1719
2006
|
this.updateContextualToolbar(type);
|
|
1720
2007
|
break;
|
|
2008
|
+
case 'resize':
|
|
2009
|
+
this.initResizeToolbar();
|
|
2010
|
+
if (Browser.isDevice) {
|
|
2011
|
+
this.initMainToolbar(false, true, true, true);
|
|
2012
|
+
}
|
|
2013
|
+
aspectIcon = parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
|
|
2014
|
+
nonAspectIcon = parent.element.querySelector('#' + this.parent.element.id + '_nonaspectratio');
|
|
2015
|
+
if (this.parent.aspectWidth && this.parent.aspectHeight) {
|
|
2016
|
+
if (nonAspectIcon) {
|
|
2017
|
+
parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
|
|
2018
|
+
}
|
|
2019
|
+
else if (aspectIcon) {
|
|
2020
|
+
parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: null, isAspectRatio: true } });
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
break;
|
|
1721
2024
|
case 'color':
|
|
1722
2025
|
this.updateContextualToolbar(type, cType);
|
|
1723
2026
|
break;
|
|
1724
2027
|
case 'croptransform':
|
|
2028
|
+
parent.allowDownScale = false;
|
|
1725
2029
|
parent.isCropTab = true;
|
|
1726
2030
|
if (Browser.isDevice) {
|
|
1727
2031
|
this.initMainToolbar(false, true, true);
|
|
@@ -1729,6 +2033,23 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1729
2033
|
parent.updateCropTransformItems();
|
|
1730
2034
|
this.initCropTransformToolbar();
|
|
1731
2035
|
break;
|
|
2036
|
+
case 'frame':
|
|
2037
|
+
this.isFrameToolbar = true;
|
|
2038
|
+
if (Browser.isDevice) {
|
|
2039
|
+
this.initMainToolbar(false, true, true);
|
|
2040
|
+
this.initMainToolbar(false, true, true, false, true);
|
|
2041
|
+
}
|
|
2042
|
+
else {
|
|
2043
|
+
this.initMainToolbar(true, null, null, false, true);
|
|
2044
|
+
}
|
|
2045
|
+
if (parent.element.querySelector('#' + parent.element.id + '_' + parent.frameObj.type)) {
|
|
2046
|
+
parent.element.querySelector('#' + parent.element.id + '_' + parent.frameObj.type).classList.add('e-selected-btn');
|
|
2047
|
+
}
|
|
2048
|
+
if (parent.frameObj.type !== 'none') {
|
|
2049
|
+
this.updateContextualToolbar(type, cType);
|
|
2050
|
+
}
|
|
2051
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2052
|
+
break;
|
|
1732
2053
|
}
|
|
1733
2054
|
this.currToolbar = type;
|
|
1734
2055
|
this.refreshDropDownBtn(isCropping);
|
|
@@ -1786,6 +2107,35 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1786
2107
|
}
|
|
1787
2108
|
return toolbarItems;
|
|
1788
2109
|
};
|
|
2110
|
+
ToolbarModule.prototype.getFrameToolbarItem = function () {
|
|
2111
|
+
var parent = this.parent;
|
|
2112
|
+
var toolbarItems = [];
|
|
2113
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_frameColor',
|
|
2114
|
+
cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('Color'), align: 'Center', type: 'Input',
|
|
2115
|
+
template: '<span>' + this.l10n.getConstant('Color') + '</span><button id="' + parent.element.id + '_frameColorBtn"></button>' });
|
|
2116
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_frameGradient',
|
|
2117
|
+
cssClass: 'top-icon e-frame-stroke', tooltipText: this.l10n.getConstant('GradientColor'), align: 'Center', type: 'Input',
|
|
2118
|
+
template: '<span>' + this.l10n.getConstant('GradientColor') + '</span><button id="' + parent.element.id + '_frameGradientColorBtn"></button>' });
|
|
2119
|
+
toolbarItems.push({ id: parent.element.id + '_frameSize', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Size'), align: 'Center',
|
|
2120
|
+
type: 'Input', template: '<span>' + this.l10n.getConstant('Size') + '</span><button id="' + parent.element.id + '_frameSizeBtn"></button>' });
|
|
2121
|
+
if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset' || parent.frameObj.type === 'hook') {
|
|
2122
|
+
toolbarItems.push({ id: parent.element.id + '_frameInset', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Inset'), align: 'Center',
|
|
2123
|
+
type: 'Input', template: '<span>' + this.l10n.getConstant('Inset') + '</span><button id="' + parent.element.id + '_frameInsetBtn"></button>' });
|
|
2124
|
+
}
|
|
2125
|
+
if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset') {
|
|
2126
|
+
toolbarItems.push({ id: parent.element.id + '_frameOffset', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Offset'), align: 'Center',
|
|
2127
|
+
type: 'Input', template: '<span>' + this.l10n.getConstant('Offset') + '</span><button id="' + parent.element.id + '_frameOffsetBtn"></button>' });
|
|
2128
|
+
}
|
|
2129
|
+
if (parent.frameObj.type === 'line') {
|
|
2130
|
+
toolbarItems.push({ id: parent.element.id + '_frameRadius', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Radius'), align: 'Center',
|
|
2131
|
+
type: 'Input', template: '<span>' + this.l10n.getConstant('Radius') + '</span><button id="' + parent.element.id + '_frameRadiusBtn"></button>' });
|
|
2132
|
+
toolbarItems.push({ id: parent.element.id + '_frameAmount', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Amount'), align: 'Center',
|
|
2133
|
+
type: 'Input', template: '<span>' + this.l10n.getConstant('Amount') + '</span><button id="' + parent.element.id + '_frameAmountBtn"></button>' });
|
|
2134
|
+
toolbarItems.push({ id: parent.element.id + '_frameBorder', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Border'), align: 'Center',
|
|
2135
|
+
type: 'Input', template: '<span>' + this.l10n.getConstant('Border') + '</span><button id="' + parent.element.id + '_frameBorderBtn"></button>' });
|
|
2136
|
+
}
|
|
2137
|
+
return toolbarItems;
|
|
2138
|
+
};
|
|
1789
2139
|
ToolbarModule.prototype.getFilterToolbarItem = function () {
|
|
1790
2140
|
var toolbarItems = [];
|
|
1791
2141
|
var parent = this.parent;
|
|
@@ -2082,6 +2432,603 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2082
2432
|
}
|
|
2083
2433
|
this.enableDisableTbrBtn();
|
|
2084
2434
|
};
|
|
2435
|
+
ToolbarModule.prototype.initFrameToolbarItem = function () {
|
|
2436
|
+
var _this = this;
|
|
2437
|
+
var parent = this.parent;
|
|
2438
|
+
var canvasWrapper = document.querySelector('#' + parent.element.id + '_contextualToolbarArea');
|
|
2439
|
+
var frameWrapper = document.querySelector('#' + parent.element.id + '_frameWrapper');
|
|
2440
|
+
if (!frameWrapper) {
|
|
2441
|
+
frameWrapper = canvasWrapper.appendChild(parent.createElement('div', {
|
|
2442
|
+
id: parent.element.id + '_frameWrapper',
|
|
2443
|
+
className: 'e-frame-wrapper',
|
|
2444
|
+
styles: 'position: relative'
|
|
2445
|
+
}));
|
|
2446
|
+
}
|
|
2447
|
+
else {
|
|
2448
|
+
frameWrapper.style.display = 'block';
|
|
2449
|
+
}
|
|
2450
|
+
frameWrapper.appendChild(parent.createElement('div', {
|
|
2451
|
+
id: parent.element.id + '_customizeWrapper',
|
|
2452
|
+
styles: 'position: absolute'
|
|
2453
|
+
}));
|
|
2454
|
+
var mainItem = this.getFrameToolbarItem();
|
|
2455
|
+
var toolbar = new Toolbar({
|
|
2456
|
+
width: '100%',
|
|
2457
|
+
items: mainItem,
|
|
2458
|
+
clicked: this.defToolbarClicked.bind(this),
|
|
2459
|
+
created: function () {
|
|
2460
|
+
_this.createFrameColor();
|
|
2461
|
+
_this.createFrameSize();
|
|
2462
|
+
if (parent.frameObj.type === 'line') {
|
|
2463
|
+
_this.createFrameRadius();
|
|
2464
|
+
}
|
|
2465
|
+
if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset' || parent.frameObj.type === 'hook') {
|
|
2466
|
+
_this.createFrameInset();
|
|
2467
|
+
}
|
|
2468
|
+
if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset') {
|
|
2469
|
+
_this.createFrameOffset();
|
|
2470
|
+
}
|
|
2471
|
+
if (parent.frameObj.type === 'line') {
|
|
2472
|
+
_this.createFrameAmount();
|
|
2473
|
+
_this.createFrameBorder();
|
|
2474
|
+
}
|
|
2475
|
+
_this.createFrameGradientColor();
|
|
2476
|
+
if (Browser.isDevice) {
|
|
2477
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
2478
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2479
|
+
toolbar.refreshOverflow();
|
|
2480
|
+
toolbar.refreshOverflow();
|
|
2481
|
+
toolbar.refreshOverflow();
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
else {
|
|
2485
|
+
_this.createLeftToolbarControls();
|
|
2486
|
+
if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
|
|
2487
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2488
|
+
toolbar.refreshOverflow();
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
parent.element.querySelector('#' + parent.element.id + '_' + parent.frameObj.type).focus();
|
|
2492
|
+
}
|
|
2493
|
+
});
|
|
2494
|
+
toolbar.appendTo('#' + this.parent.element.id + '_customizeWrapper');
|
|
2495
|
+
};
|
|
2496
|
+
ToolbarModule.prototype.createFrameGradientColor = function () {
|
|
2497
|
+
var parent = this.parent;
|
|
2498
|
+
var prevFrameSettings;
|
|
2499
|
+
var obj = { frameChangeEventArgs: null };
|
|
2500
|
+
parent.element.querySelector('.e-template.e-frame-stroke').appendChild(parent.createElement('input', {
|
|
2501
|
+
id: parent.element.id + '_frame_gradient_fill'
|
|
2502
|
+
}));
|
|
2503
|
+
var fillColor = new ColorPicker({
|
|
2504
|
+
modeSwitcher: false, noColor: true, value: parent.frameObj.gradientColor,
|
|
2505
|
+
showButtons: false, mode: 'Palette', cssClass: 'e-frame-gradient-fill-color',
|
|
2506
|
+
change: function (args) {
|
|
2507
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2508
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2509
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2510
|
+
lineCount: parent.frameObj.amount };
|
|
2511
|
+
var temp = parent.frameObj.gradientColor;
|
|
2512
|
+
var object = { currObj: {} };
|
|
2513
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2514
|
+
parent.frameObj.gradientColor = args.currentValue.hex;
|
|
2515
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2516
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2517
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2518
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2519
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2520
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2521
|
+
previousFilter: null, isCircleCrop: null
|
|
2522
|
+
} });
|
|
2523
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2524
|
+
if (args.currentValue.rgba === '') {
|
|
2525
|
+
fillDDB.element.children[0].classList.add('e-nocolor-item');
|
|
2526
|
+
}
|
|
2527
|
+
else {
|
|
2528
|
+
fillDDB.element.children[0].classList.remove('e-nocolor-item');
|
|
2529
|
+
fillDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
else {
|
|
2533
|
+
parent.frameObj.gradientColor = temp;
|
|
2534
|
+
}
|
|
2535
|
+
fillDDB.toggle();
|
|
2536
|
+
}
|
|
2537
|
+
}, '#' + parent.element.id + '_frame_gradient_fill');
|
|
2538
|
+
var fillDDB = new DropDownButton({
|
|
2539
|
+
open: function (args) {
|
|
2540
|
+
if (Browser.isDevice) {
|
|
2541
|
+
args.element.parentElement.style.top = fillDDB.element.getBoundingClientRect().top -
|
|
2542
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2543
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
target: '.e-frame-gradient-fill-color',
|
|
2547
|
+
iconCss: 'e-dropdownbtn-preview'
|
|
2548
|
+
}, '#' + parent.element.id + '_frameGradientColorBtn');
|
|
2549
|
+
fillColor.inline = true;
|
|
2550
|
+
if (parent.frameObj.gradientColor === '') {
|
|
2551
|
+
parent.element.querySelector('.e-frame-stroke.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
|
|
2552
|
+
}
|
|
2553
|
+
else {
|
|
2554
|
+
parent.element.querySelector('.e-frame-stroke.e-template .e-dropdownbtn-preview').style.background = parent.frameObj.gradientColor;
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
ToolbarModule.prototype.createFrameColor = function () {
|
|
2558
|
+
var parent = this.parent;
|
|
2559
|
+
var prevFrameSettings;
|
|
2560
|
+
var obj = { frameChangeEventArgs: null };
|
|
2561
|
+
parent.element.querySelector('.e-template.e-stroke').appendChild(parent.createElement('input', {
|
|
2562
|
+
id: parent.element.id + '_frame_fill'
|
|
2563
|
+
}));
|
|
2564
|
+
var fillColor = new ColorPicker({
|
|
2565
|
+
modeSwitcher: false, value: parent.frameObj.color,
|
|
2566
|
+
showButtons: false, mode: 'Palette', cssClass: 'e-frame-fill-color',
|
|
2567
|
+
change: function (args) {
|
|
2568
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2569
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2570
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2571
|
+
lineCount: parent.frameObj.amount };
|
|
2572
|
+
var temp = parent.frameObj.color;
|
|
2573
|
+
var object = { currObj: {} };
|
|
2574
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2575
|
+
parent.frameObj.color = args.currentValue.hex;
|
|
2576
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2577
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2578
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2579
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2580
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2581
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2582
|
+
previousFilter: null, isCircleCrop: null
|
|
2583
|
+
} });
|
|
2584
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2585
|
+
if (args.currentValue.rgba === '') {
|
|
2586
|
+
fillDDB.element.children[0].classList.add('e-nocolor-item');
|
|
2587
|
+
}
|
|
2588
|
+
else {
|
|
2589
|
+
fillDDB.element.children[0].classList.remove('e-nocolor-item');
|
|
2590
|
+
fillDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
else {
|
|
2594
|
+
parent.frameObj.color = temp;
|
|
2595
|
+
}
|
|
2596
|
+
fillDDB.toggle();
|
|
2597
|
+
}
|
|
2598
|
+
}, '#' + parent.element.id + '_frame_fill');
|
|
2599
|
+
var fillDDB = new DropDownButton({
|
|
2600
|
+
open: function (args) {
|
|
2601
|
+
if (Browser.isDevice) {
|
|
2602
|
+
args.element.parentElement.style.top = fillDDB.element.getBoundingClientRect().top -
|
|
2603
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2604
|
+
args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
|
|
2605
|
+
}
|
|
2606
|
+
},
|
|
2607
|
+
target: '.e-frame-fill-color',
|
|
2608
|
+
iconCss: 'e-dropdownbtn-preview'
|
|
2609
|
+
}, '#' + parent.element.id + '_frameColorBtn');
|
|
2610
|
+
fillColor.inline = true;
|
|
2611
|
+
parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview').style.background = parent.frameObj.color;
|
|
2612
|
+
};
|
|
2613
|
+
ToolbarModule.prototype.createFrameSize = function () {
|
|
2614
|
+
var parent = this.parent;
|
|
2615
|
+
var prevFrameSettings;
|
|
2616
|
+
var obj = { frameChangeEventArgs: null };
|
|
2617
|
+
var strokeWidthItems = [
|
|
2618
|
+
{ id: '1', text: this.l10n.getConstant('20') },
|
|
2619
|
+
{ id: '2', text: this.l10n.getConstant('40') },
|
|
2620
|
+
{ id: '3', text: this.l10n.getConstant('60') },
|
|
2621
|
+
{ id: '4', text: this.l10n.getConstant('80') },
|
|
2622
|
+
{ id: '5', text: this.l10n.getConstant('100') }
|
|
2623
|
+
];
|
|
2624
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_frameSizeBtn');
|
|
2625
|
+
var spanElem = document.createElement('span');
|
|
2626
|
+
spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.size.toString());
|
|
2627
|
+
spanElem.className = 'e-frame-stroke-width';
|
|
2628
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
2629
|
+
// Initialize the DropDownButton component.
|
|
2630
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
2631
|
+
open: function (args) {
|
|
2632
|
+
if (Browser.isDevice) {
|
|
2633
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
2634
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2635
|
+
}
|
|
2636
|
+
var activeBtn = drpDownBtn.element.childNodes[0].textContent;
|
|
2637
|
+
if (activeBtn !== '') {
|
|
2638
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
2639
|
+
}
|
|
2640
|
+
},
|
|
2641
|
+
select: function (args) {
|
|
2642
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2643
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2644
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2645
|
+
lineCount: parent.frameObj.amount };
|
|
2646
|
+
var temp = parent.frameObj.size;
|
|
2647
|
+
var object = { currObj: {} };
|
|
2648
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2649
|
+
parent.frameObj.size = parseInt(args.item.text, 10);
|
|
2650
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2651
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2652
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2653
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2654
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2655
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2656
|
+
previousFilter: null, isCircleCrop: null
|
|
2657
|
+
} });
|
|
2658
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2659
|
+
drpDownBtn.content = args.item.text;
|
|
2660
|
+
}
|
|
2661
|
+
else {
|
|
2662
|
+
parent.frameObj.size = temp;
|
|
2663
|
+
}
|
|
2664
|
+
if (Browser.isDevice) {
|
|
2665
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
2666
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2667
|
+
var toolbar_10 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
2668
|
+
toolbar_10.refreshOverflow();
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
else {
|
|
2672
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
2673
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2674
|
+
var toolbar_11 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
2675
|
+
toolbar_11.refreshOverflow();
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
});
|
|
2680
|
+
// Render initialized DropDownButton.
|
|
2681
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_frameSizeBtn');
|
|
2682
|
+
};
|
|
2683
|
+
ToolbarModule.prototype.createFrameInset = function () {
|
|
2684
|
+
var parent = this.parent;
|
|
2685
|
+
var prevFrameSettings;
|
|
2686
|
+
var obj = { frameChangeEventArgs: null };
|
|
2687
|
+
var strokeWidthItems = [
|
|
2688
|
+
{ id: '1', text: this.l10n.getConstant('20') },
|
|
2689
|
+
{ id: '2', text: this.l10n.getConstant('40') },
|
|
2690
|
+
{ id: '3', text: this.l10n.getConstant('60') },
|
|
2691
|
+
{ id: '4', text: this.l10n.getConstant('80') },
|
|
2692
|
+
{ id: '5', text: this.l10n.getConstant('100') }
|
|
2693
|
+
];
|
|
2694
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_frameInsetBtn');
|
|
2695
|
+
var spanElem = document.createElement('span');
|
|
2696
|
+
spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.inset.toString());
|
|
2697
|
+
spanElem.className = 'e-frame-inset';
|
|
2698
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
2699
|
+
// Initialize the DropDownButton component.
|
|
2700
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
2701
|
+
open: function (args) {
|
|
2702
|
+
if (Browser.isDevice) {
|
|
2703
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
2704
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2705
|
+
}
|
|
2706
|
+
var activeBtn = drpDownBtn.element.childNodes[0].textContent;
|
|
2707
|
+
if (activeBtn !== '') {
|
|
2708
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
2709
|
+
}
|
|
2710
|
+
},
|
|
2711
|
+
select: function (args) {
|
|
2712
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2713
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2714
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2715
|
+
lineCount: parent.frameObj.amount };
|
|
2716
|
+
var temp = parent.frameObj.inset;
|
|
2717
|
+
var object = { currObj: {} };
|
|
2718
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2719
|
+
parent.frameObj.inset = parseInt(args.item.text, 10);
|
|
2720
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2721
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2722
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2723
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2724
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2725
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2726
|
+
previousFilter: null, isCircleCrop: null
|
|
2727
|
+
} });
|
|
2728
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2729
|
+
drpDownBtn.content = args.item.text;
|
|
2730
|
+
}
|
|
2731
|
+
else {
|
|
2732
|
+
parent.frameObj.inset = temp;
|
|
2733
|
+
}
|
|
2734
|
+
if (Browser.isDevice) {
|
|
2735
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
2736
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2737
|
+
var toolbar_12 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
2738
|
+
toolbar_12.refreshOverflow();
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
else {
|
|
2742
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
2743
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2744
|
+
var toolbar_13 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
2745
|
+
toolbar_13.refreshOverflow();
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
});
|
|
2750
|
+
// Render initialized DropDownButton.
|
|
2751
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_frameInsetBtn');
|
|
2752
|
+
};
|
|
2753
|
+
ToolbarModule.prototype.createFrameOffset = function () {
|
|
2754
|
+
var parent = this.parent;
|
|
2755
|
+
var prevFrameSettings;
|
|
2756
|
+
var obj = { frameChangeEventArgs: null };
|
|
2757
|
+
var strokeWidthItems = [
|
|
2758
|
+
{ id: '1', text: this.l10n.getConstant('20') },
|
|
2759
|
+
{ id: '2', text: this.l10n.getConstant('40') },
|
|
2760
|
+
{ id: '3', text: this.l10n.getConstant('60') },
|
|
2761
|
+
{ id: '4', text: this.l10n.getConstant('80') },
|
|
2762
|
+
{ id: '5', text: this.l10n.getConstant('100') }
|
|
2763
|
+
];
|
|
2764
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_frameOffsetBtn');
|
|
2765
|
+
var spanElem = document.createElement('span');
|
|
2766
|
+
spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.offset.toString());
|
|
2767
|
+
spanElem.className = 'e-frame-offset';
|
|
2768
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
2769
|
+
// Initialize the DropDownButton component.
|
|
2770
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
2771
|
+
open: function (args) {
|
|
2772
|
+
if (Browser.isDevice) {
|
|
2773
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
2774
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2775
|
+
}
|
|
2776
|
+
var activeBtn = drpDownBtn.element.childNodes[0].textContent;
|
|
2777
|
+
if (activeBtn !== '') {
|
|
2778
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
2779
|
+
}
|
|
2780
|
+
},
|
|
2781
|
+
select: function (args) {
|
|
2782
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2783
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2784
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2785
|
+
lineCount: parent.frameObj.amount };
|
|
2786
|
+
var temp = parent.frameObj.offset;
|
|
2787
|
+
var object = { currObj: {} };
|
|
2788
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2789
|
+
parent.frameObj.offset = parseInt(args.item.text, 10);
|
|
2790
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2791
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2792
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2793
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2794
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2795
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2796
|
+
previousFilter: null, isCircleCrop: null
|
|
2797
|
+
} });
|
|
2798
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2799
|
+
drpDownBtn.content = args.item.text;
|
|
2800
|
+
}
|
|
2801
|
+
else {
|
|
2802
|
+
parent.frameObj.offset = temp;
|
|
2803
|
+
}
|
|
2804
|
+
if (Browser.isDevice) {
|
|
2805
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
2806
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2807
|
+
var toolbar_14 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
2808
|
+
toolbar_14.refreshOverflow();
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
else {
|
|
2812
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
2813
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2814
|
+
var toolbar_15 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
2815
|
+
toolbar_15.refreshOverflow();
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
});
|
|
2820
|
+
// Render initialized DropDownButton.
|
|
2821
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_frameOffsetBtn');
|
|
2822
|
+
};
|
|
2823
|
+
ToolbarModule.prototype.createFrameRadius = function () {
|
|
2824
|
+
var parent = this.parent;
|
|
2825
|
+
var prevFrameSettings;
|
|
2826
|
+
var obj = { frameChangeEventArgs: null };
|
|
2827
|
+
var strokeWidthItems = [
|
|
2828
|
+
{ id: '1', text: this.l10n.getConstant('0') },
|
|
2829
|
+
{ id: '2', text: this.l10n.getConstant('20') },
|
|
2830
|
+
{ id: '3', text: this.l10n.getConstant('40') },
|
|
2831
|
+
{ id: '4', text: this.l10n.getConstant('60') },
|
|
2832
|
+
{ id: '5', text: this.l10n.getConstant('80') },
|
|
2833
|
+
{ id: '6', text: this.l10n.getConstant('100') }
|
|
2834
|
+
];
|
|
2835
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_frameRadiusBtn');
|
|
2836
|
+
var spanElem = document.createElement('span');
|
|
2837
|
+
spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.radius.toString());
|
|
2838
|
+
spanElem.className = 'e-frame-radius';
|
|
2839
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
2840
|
+
// Initialize the DropDownButton component.
|
|
2841
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
2842
|
+
open: function (args) {
|
|
2843
|
+
if (Browser.isDevice) {
|
|
2844
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
2845
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2846
|
+
}
|
|
2847
|
+
var activeBtn = drpDownBtn.element.childNodes[0].textContent;
|
|
2848
|
+
if (activeBtn !== '') {
|
|
2849
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
2850
|
+
}
|
|
2851
|
+
},
|
|
2852
|
+
select: function (args) {
|
|
2853
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2854
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2855
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2856
|
+
lineCount: parent.frameObj.amount };
|
|
2857
|
+
var temp = parent.frameObj.radius;
|
|
2858
|
+
var object = { currObj: {} };
|
|
2859
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2860
|
+
parent.frameObj.radius = parseInt(args.item.text, 10);
|
|
2861
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2862
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2863
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2864
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2865
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2866
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2867
|
+
previousFilter: null, isCircleCrop: null
|
|
2868
|
+
} });
|
|
2869
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2870
|
+
drpDownBtn.content = args.item.text;
|
|
2871
|
+
}
|
|
2872
|
+
else {
|
|
2873
|
+
parent.frameObj.radius = temp;
|
|
2874
|
+
}
|
|
2875
|
+
if (Browser.isDevice) {
|
|
2876
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
2877
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2878
|
+
var toolbar_16 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
2879
|
+
toolbar_16.refreshOverflow();
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
else {
|
|
2883
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
2884
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2885
|
+
var toolbar_17 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
2886
|
+
toolbar_17.refreshOverflow();
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
});
|
|
2891
|
+
// Render initialized DropDownButton.
|
|
2892
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_frameRadiusBtn');
|
|
2893
|
+
};
|
|
2894
|
+
ToolbarModule.prototype.createFrameAmount = function () {
|
|
2895
|
+
var parent = this.parent;
|
|
2896
|
+
var prevFrameSettings;
|
|
2897
|
+
var obj = { frameChangeEventArgs: null };
|
|
2898
|
+
var strokeWidthItems = [
|
|
2899
|
+
{ id: '1', text: this.l10n.getConstant('1') },
|
|
2900
|
+
{ id: '2', text: this.l10n.getConstant('2') },
|
|
2901
|
+
{ id: '3', text: this.l10n.getConstant('3') },
|
|
2902
|
+
{ id: '4', text: this.l10n.getConstant('4') },
|
|
2903
|
+
{ id: '5', text: this.l10n.getConstant('5') }
|
|
2904
|
+
];
|
|
2905
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_frameAmountBtn');
|
|
2906
|
+
var spanElem = document.createElement('span');
|
|
2907
|
+
spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.amount.toString());
|
|
2908
|
+
spanElem.className = 'e-frame-amount';
|
|
2909
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
2910
|
+
// Initialize the DropDownButton component.
|
|
2911
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
2912
|
+
open: function (args) {
|
|
2913
|
+
if (Browser.isDevice) {
|
|
2914
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
2915
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2916
|
+
}
|
|
2917
|
+
var activeBtn = drpDownBtn.element.childNodes[0].textContent;
|
|
2918
|
+
if (activeBtn !== '') {
|
|
2919
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
2920
|
+
}
|
|
2921
|
+
},
|
|
2922
|
+
select: function (args) {
|
|
2923
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2924
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2925
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2926
|
+
lineCount: parent.frameObj.amount };
|
|
2927
|
+
var temp = parent.frameObj.amount;
|
|
2928
|
+
var object = { currObj: {} };
|
|
2929
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2930
|
+
parent.frameObj.amount = parseInt(args.item.text, 10);
|
|
2931
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
2932
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
2933
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
2934
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
2935
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
2936
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
2937
|
+
previousFilter: null, isCircleCrop: null
|
|
2938
|
+
} });
|
|
2939
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
2940
|
+
drpDownBtn.content = args.item.text;
|
|
2941
|
+
}
|
|
2942
|
+
else {
|
|
2943
|
+
parent.frameObj.amount = temp;
|
|
2944
|
+
}
|
|
2945
|
+
if (Browser.isDevice) {
|
|
2946
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
2947
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2948
|
+
var toolbar_18 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
2949
|
+
toolbar_18.refreshOverflow();
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
else {
|
|
2953
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
2954
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2955
|
+
var toolbar_19 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
2956
|
+
toolbar_19.refreshOverflow();
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
// Render initialized DropDownButton.
|
|
2962
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_frameAmountBtn');
|
|
2963
|
+
};
|
|
2964
|
+
ToolbarModule.prototype.createFrameBorder = function () {
|
|
2965
|
+
var parent = this.parent;
|
|
2966
|
+
var prevFrameSettings;
|
|
2967
|
+
var obj = { frameChangeEventArgs: null };
|
|
2968
|
+
var strokeWidthItems = [
|
|
2969
|
+
{ id: '1', text: this.l10n.getConstant('Solid') },
|
|
2970
|
+
{ id: '2', text: this.l10n.getConstant('Dashed') },
|
|
2971
|
+
{ id: '3', text: this.l10n.getConstant('Dotted') },
|
|
2972
|
+
];
|
|
2973
|
+
var strokeWidthBtn = document.getElementById(parent.element.id + '_frameBorderBtn');
|
|
2974
|
+
var spanElem = document.createElement('span');
|
|
2975
|
+
spanElem.innerHTML = this.l10n.getConstant(parent.toPascalCase(parent.frameObj.border));
|
|
2976
|
+
spanElem.className = 'e-frame-border';
|
|
2977
|
+
strokeWidthBtn.appendChild(spanElem);
|
|
2978
|
+
// Initialize the DropDownButton component.
|
|
2979
|
+
var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
|
|
2980
|
+
open: function (args) {
|
|
2981
|
+
if (Browser.isDevice) {
|
|
2982
|
+
args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
|
|
2983
|
+
args.element.parentElement.offsetHeight + 'px';
|
|
2984
|
+
}
|
|
2985
|
+
var activeBtn = drpDownBtn.element.childNodes[0].textContent;
|
|
2986
|
+
if (activeBtn !== '') {
|
|
2987
|
+
args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
|
|
2988
|
+
}
|
|
2989
|
+
},
|
|
2990
|
+
select: function (args) {
|
|
2991
|
+
prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
|
|
2992
|
+
gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
|
|
2993
|
+
offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
|
|
2994
|
+
lineCount: parent.frameObj.amount };
|
|
2995
|
+
var temp = parent.frameObj.border;
|
|
2996
|
+
var object = { currObj: {} };
|
|
2997
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
2998
|
+
parent.frameObj.border = args.item.text.toLowerCase();
|
|
2999
|
+
parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
|
|
3000
|
+
if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
|
|
3001
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
3002
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
3003
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
3004
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
3005
|
+
previousFilter: null, isCircleCrop: null
|
|
3006
|
+
} });
|
|
3007
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
3008
|
+
drpDownBtn.content = args.item.text;
|
|
3009
|
+
}
|
|
3010
|
+
else {
|
|
3011
|
+
parent.frameObj.border = temp;
|
|
3012
|
+
}
|
|
3013
|
+
if (Browser.isDevice) {
|
|
3014
|
+
if (document.getElementById(parent.element.id + '_bottomToolbar')) {
|
|
3015
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3016
|
+
var toolbar_20 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
|
|
3017
|
+
toolbar_20.refreshOverflow();
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
else {
|
|
3021
|
+
if (document.getElementById(parent.element.id + '_toolbar')) {
|
|
3022
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3023
|
+
var toolbar_21 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
3024
|
+
toolbar_21.refreshOverflow();
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
});
|
|
3029
|
+
// Render initialized DropDownButton.
|
|
3030
|
+
drpDownBtn.appendTo('#' + parent.element.id + '_frameBorderBtn');
|
|
3031
|
+
};
|
|
2085
3032
|
ToolbarModule.prototype.initFilterToolbarItem = function () {
|
|
2086
3033
|
var _this = this;
|
|
2087
3034
|
var parent = this.parent;
|
|
@@ -2112,6 +3059,13 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2112
3059
|
});
|
|
2113
3060
|
toolbar.appendTo('#' + parent.element.id + '_contextualToolbar');
|
|
2114
3061
|
};
|
|
3062
|
+
ToolbarModule.prototype.drawDashedLine = function (ctx) {
|
|
3063
|
+
ctx.beginPath();
|
|
3064
|
+
ctx.setLineDash([5]);
|
|
3065
|
+
ctx.rect(10, 10, 280, 130);
|
|
3066
|
+
ctx.stroke();
|
|
3067
|
+
ctx.closePath();
|
|
3068
|
+
};
|
|
2115
3069
|
ToolbarModule.prototype.createCanvasFilter = function () {
|
|
2116
3070
|
var parent = this.parent;
|
|
2117
3071
|
showSpinner(parent.element);
|
|
@@ -2148,6 +3102,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2148
3102
|
var args = { cancel: false, toolbarItems: [] };
|
|
2149
3103
|
var toolbarItems = [];
|
|
2150
3104
|
if (isNullOrUndefined(isPenEdit)) {
|
|
3105
|
+
if (parent.activeObj.shape === 'image') {
|
|
3106
|
+
toolbarItems.push('Flip');
|
|
3107
|
+
}
|
|
2151
3108
|
toolbarItems.push('Clone');
|
|
2152
3109
|
toolbarItems.push('Delete');
|
|
2153
3110
|
if (parent.activeObj.shape === 'text') {
|
|
@@ -2180,6 +3137,12 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2180
3137
|
orgToolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
|
|
2181
3138
|
tooltipText: this.l10n.getConstant('EditText'), align: 'Left' });
|
|
2182
3139
|
break;
|
|
3140
|
+
case 'Flip':
|
|
3141
|
+
orgToolbarItems.push({ id: parent.element.id + '_hFlip', prefixIcon: 'e-icons e-horizontal-flip',
|
|
3142
|
+
tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Left' });
|
|
3143
|
+
orgToolbarItems.push({ id: parent.element.id + '_vFlip', prefixIcon: 'e-icons e-vertical-flip',
|
|
3144
|
+
tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Left' });
|
|
3145
|
+
break;
|
|
2183
3146
|
default:
|
|
2184
3147
|
orgToolbarItems.push(args.toolbarItems[i]);
|
|
2185
3148
|
break;
|
|
@@ -2207,6 +3170,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2207
3170
|
});
|
|
2208
3171
|
toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
|
|
2209
3172
|
}
|
|
3173
|
+
var height = this.toolbarHeight && this.toolbarHeight !== 0 ? this.toolbarHeight : qtArea.clientHeight;
|
|
2210
3174
|
if (isNullOrUndefined(isPenEdit)) {
|
|
2211
3175
|
qtArea.style.width = 'auto';
|
|
2212
3176
|
parent.activeObj.activePoint.width = Math.abs(parent.activeObj.activePoint.width);
|
|
@@ -2232,11 +3196,15 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2232
3196
|
width = path.width;
|
|
2233
3197
|
}
|
|
2234
3198
|
qtArea.style.left = (x + (width / 2)) - (items.length * 25) + 'px';
|
|
2235
|
-
if (
|
|
3199
|
+
if (parseFloat(qtArea.style.left) + (qtArea.clientWidth / 2) !== x + (width / 2)) {
|
|
3200
|
+
var diff = (x + (width / 2)) - (parseFloat(qtArea.style.left) + (qtArea.clientWidth / 2));
|
|
3201
|
+
qtArea.style.left = parseFloat(qtArea.style.left) + diff + 'px';
|
|
3202
|
+
}
|
|
3203
|
+
if (y - (height + (height / 1.5)) < parent.img.destTop) {
|
|
2236
3204
|
qtArea.style.top = parent.img.destTop + 'px';
|
|
2237
3205
|
}
|
|
2238
3206
|
else {
|
|
2239
|
-
qtArea.style.top = y -
|
|
3207
|
+
qtArea.style.top = y - (height + (height / 1.5)) + 'px';
|
|
2240
3208
|
}
|
|
2241
3209
|
}
|
|
2242
3210
|
else if (isPenEdit) {
|
|
@@ -2248,11 +3216,11 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2248
3216
|
var point = obj['activePoint'];
|
|
2249
3217
|
qtArea.style.width = 'auto';
|
|
2250
3218
|
qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
|
|
2251
|
-
if (point.startY -
|
|
3219
|
+
if (point.startY - (height + (height / 1.5)) < parent.img.destTop) {
|
|
2252
3220
|
qtArea.style.top = parent.img.destTop + 'px';
|
|
2253
3221
|
}
|
|
2254
3222
|
else {
|
|
2255
|
-
qtArea.style.top = point.startY -
|
|
3223
|
+
qtArea.style.top = point.startY - (height + (height / 1.5)) + 'px';
|
|
2256
3224
|
}
|
|
2257
3225
|
}
|
|
2258
3226
|
}
|
|
@@ -2339,14 +3307,20 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2339
3307
|
parent.notify('selection', { prop: 'getTempActObj', onPropertyChange: false, value: { obj: object } });
|
|
2340
3308
|
object['tempObj']['activePoint']['height'] = Math.abs(object['tempObj']['activePoint']['height']);
|
|
2341
3309
|
var pathObject = { isNewPath: null };
|
|
3310
|
+
var ctx = void 0;
|
|
2342
3311
|
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
2343
3312
|
switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
|
|
2344
3313
|
case 'duplicate':
|
|
2345
3314
|
if (!parent.element.querySelector('#' + parent.element.id + '_duplicate').classList.contains('e-disabled')) {
|
|
3315
|
+
this.refreshSlider();
|
|
2346
3316
|
if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
|
|
2347
3317
|
isPreventUndoRedo = true;
|
|
2348
3318
|
}
|
|
2349
3319
|
duplicateObj = extend({}, parent.activeObj, {}, true);
|
|
3320
|
+
if (duplicateObj.shape === 'image') {
|
|
3321
|
+
objColl = extend([], parent.objColl, [], true);
|
|
3322
|
+
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
3323
|
+
}
|
|
2350
3324
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
2351
3325
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
|
|
2352
3326
|
}
|
|
@@ -2372,19 +3346,47 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2372
3346
|
duplicateObj.pointColl[i].y -= 10;
|
|
2373
3347
|
}
|
|
2374
3348
|
}
|
|
2375
|
-
|
|
3349
|
+
else if (duplicateObj.shape === 'image') {
|
|
3350
|
+
duplicateObj.imageCanvas = parent.createElement('canvas');
|
|
3351
|
+
}
|
|
3352
|
+
parent.activeObj = extend({}, duplicateObj, {}, true);
|
|
3353
|
+
if (parent.activeObj.shape === 'image') {
|
|
3354
|
+
if (parent.activeObj.isHorImageFlip && parent.activeObj.isVerImageFlip) {
|
|
3355
|
+
parent.activeObj.isHorImageFlip = parent.activeObj.isVerImageFlip = false;
|
|
3356
|
+
parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
3357
|
+
value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: true } });
|
|
3358
|
+
parent.activeObj.isHorImageFlip = parent.activeObj.isVerImageFlip = true;
|
|
3359
|
+
}
|
|
3360
|
+
else if (parent.activeObj.isHorImageFlip) {
|
|
3361
|
+
parent.activeObj.isHorImageFlip = false;
|
|
3362
|
+
parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
3363
|
+
value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: null } });
|
|
3364
|
+
parent.activeObj.isHorImageFlip = true;
|
|
3365
|
+
}
|
|
3366
|
+
else if (parent.activeObj.isVerImageFlip) {
|
|
3367
|
+
parent.activeObj.isVerImageFlip = false;
|
|
3368
|
+
parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
3369
|
+
value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: true } });
|
|
3370
|
+
parent.activeObj.isVerImageFlip = true;
|
|
3371
|
+
}
|
|
3372
|
+
else {
|
|
3373
|
+
parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
3374
|
+
value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: null } });
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
2376
3377
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
2377
3378
|
parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
|
|
2378
3379
|
value: { obj: parent.activeObj } });
|
|
2379
3380
|
}
|
|
2380
|
-
|
|
2381
|
-
|
|
3381
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj,
|
|
3382
|
+
isCropRatio: null, points: null, isPreventDrag: true } });
|
|
2382
3383
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
2383
3384
|
this.renderQAT();
|
|
2384
3385
|
}
|
|
2385
3386
|
break;
|
|
2386
3387
|
case 'remove':
|
|
2387
3388
|
if (!parent.element.querySelector('#' + parent.element.id + '_remove').classList.contains('e-disabled')) {
|
|
3389
|
+
this.refreshSlider();
|
|
2388
3390
|
parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
|
|
2389
3391
|
}
|
|
2390
3392
|
break;
|
|
@@ -2414,6 +3416,25 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2414
3416
|
}
|
|
2415
3417
|
}
|
|
2416
3418
|
break;
|
|
3419
|
+
case 'rotleft':
|
|
3420
|
+
case 'rotright':
|
|
3421
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_rotLeft').classList.contains('e-disabled') ||
|
|
3422
|
+
!parent.element.querySelector('#' + parent.element.id + '_rotRight').classList.contains('e-disabled')) {
|
|
3423
|
+
parent.rotateImage(args.item.id.replace(parent.element.id + '_', '').toLowerCase());
|
|
3424
|
+
}
|
|
3425
|
+
break;
|
|
3426
|
+
case 'hflip':
|
|
3427
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_hFlip').classList.contains('e-disabled')) {
|
|
3428
|
+
ctx = parent.activeObj.imageCanvas.getContext('2d');
|
|
3429
|
+
parent.horizontalFlip(ctx);
|
|
3430
|
+
}
|
|
3431
|
+
break;
|
|
3432
|
+
case 'vflip':
|
|
3433
|
+
if (!parent.element.querySelector('#' + parent.element.id + '_vFlip').classList.contains('e-disabled')) {
|
|
3434
|
+
ctx = parent.activeObj.imageCanvas.getContext('2d');
|
|
3435
|
+
parent.verticalFlip(ctx);
|
|
3436
|
+
}
|
|
3437
|
+
break;
|
|
2417
3438
|
}
|
|
2418
3439
|
}
|
|
2419
3440
|
if (isNullOrUndefined(isContextualToolbar)) {
|
|
@@ -2424,7 +3445,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2424
3445
|
var parent = this.parent;
|
|
2425
3446
|
var isContextualToolbar = false;
|
|
2426
3447
|
var isFilterFinetune = false;
|
|
2427
|
-
if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
3448
|
+
if (!this.isFrameToolbar && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
2428
3449
|
if (!parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hide')) {
|
|
2429
3450
|
isContextualToolbar = isFilterFinetune = true;
|
|
2430
3451
|
}
|
|
@@ -2432,7 +3453,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2432
3453
|
}
|
|
2433
3454
|
if (args.item) {
|
|
2434
3455
|
var type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
|
|
2435
|
-
if (type === 'duplicate' || type === 'remove' || type === 'edittext'
|
|
3456
|
+
if (type === 'duplicate' || type === 'remove' || type === 'edittext' ||
|
|
3457
|
+
type === 'hflip' || type === 'vflip' || type === 'rotleft' || type === 'rotright') {
|
|
2436
3458
|
this.quickAccessToolbarClicked(args, true);
|
|
2437
3459
|
parent.trigger('toolbarItemClicked', args);
|
|
2438
3460
|
}
|
|
@@ -2519,6 +3541,11 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2519
3541
|
break;
|
|
2520
3542
|
case 'reset':
|
|
2521
3543
|
parent.reset();
|
|
3544
|
+
this.imageHeight = null;
|
|
3545
|
+
this.imageWidth = null;
|
|
3546
|
+
this.parent.aspectHeight = null;
|
|
3547
|
+
this.parent.aspectWidth = null;
|
|
3548
|
+
this.isAspectRatio = true;
|
|
2522
3549
|
this.currentToolbar = 'main';
|
|
2523
3550
|
break;
|
|
2524
3551
|
case 'undo':
|
|
@@ -2527,6 +3554,25 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2527
3554
|
case 'redo':
|
|
2528
3555
|
parent.notify('undo-redo', { prop: 'call-redo' });
|
|
2529
3556
|
break;
|
|
3557
|
+
case 'aspectratio':
|
|
3558
|
+
if (!parent.isCircleCrop && (isNullOrUndefined(parent.currSelectionPoint)) ||
|
|
3559
|
+
(parent.currSelectionPoint && parent.currSelectionPoint.shape !== 'crop-circle')) {
|
|
3560
|
+
parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
|
|
3561
|
+
height: parent.img.srcHeight };
|
|
3562
|
+
this.refreshToolbar('resize');
|
|
3563
|
+
}
|
|
3564
|
+
break;
|
|
3565
|
+
case 'nonaspectratio':
|
|
3566
|
+
parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
|
|
3567
|
+
height: parent.img.srcHeight };
|
|
3568
|
+
this.refreshToolbar('resize');
|
|
3569
|
+
break;
|
|
3570
|
+
case 'resize':
|
|
3571
|
+
if (parent.currObjType.isFiltered) {
|
|
3572
|
+
parent.okBtn();
|
|
3573
|
+
}
|
|
3574
|
+
this.resizeClick();
|
|
3575
|
+
break;
|
|
2530
3576
|
case 'adjustment':
|
|
2531
3577
|
if (!isDisabledAdjustment) {
|
|
2532
3578
|
if (parent.currObjType.isFiltered) {
|
|
@@ -2622,6 +3668,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2622
3668
|
}
|
|
2623
3669
|
break;
|
|
2624
3670
|
case 'croptransform':
|
|
3671
|
+
if (parent.currObjType.isFiltered) {
|
|
3672
|
+
parent.okBtn();
|
|
3673
|
+
}
|
|
2625
3674
|
this.refreshToolbar('croptransform');
|
|
2626
3675
|
break;
|
|
2627
3676
|
case 'rotateleft':
|
|
@@ -2642,8 +3691,114 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2642
3691
|
parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.add('e-hide');
|
|
2643
3692
|
parent.element.querySelector('#' + parent.element.id + '_saveBtn').click();
|
|
2644
3693
|
break;
|
|
3694
|
+
case 'transparency':
|
|
3695
|
+
this.updateContextualToolbar('transparency', 'transparency');
|
|
3696
|
+
break;
|
|
3697
|
+
case 'frame':
|
|
3698
|
+
this.frameToolbarClick();
|
|
3699
|
+
break;
|
|
3700
|
+
case 'none':
|
|
3701
|
+
case 'mat':
|
|
3702
|
+
case 'bevel':
|
|
3703
|
+
case 'line':
|
|
3704
|
+
case 'inset':
|
|
3705
|
+
case 'hook':
|
|
3706
|
+
this.unselectFrameBtn();
|
|
3707
|
+
if (parent.element.querySelector('#' + parent.element.id + '_' + type)) {
|
|
3708
|
+
parent.element.querySelector('#' + parent.element.id + '_' + type).classList.add('e-selected-btn');
|
|
3709
|
+
}
|
|
3710
|
+
parent.frameObj.type = type;
|
|
3711
|
+
parent.frameObj.size = 20;
|
|
3712
|
+
parent.frameObj.inset = 20;
|
|
3713
|
+
parent.frameObj.radius = 0;
|
|
3714
|
+
parent.frameObj.amount = 1;
|
|
3715
|
+
if (type === 'inset') {
|
|
3716
|
+
parent.frameObj.offset = 60;
|
|
3717
|
+
}
|
|
3718
|
+
else {
|
|
3719
|
+
parent.frameObj.offset = 20;
|
|
3720
|
+
}
|
|
3721
|
+
this.refreshToolbar('frame');
|
|
3722
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
|
|
3723
|
+
break;
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
};
|
|
3727
|
+
ToolbarModule.prototype.frameToolbarClick = function () {
|
|
3728
|
+
var parent = this.parent;
|
|
3729
|
+
var frame = document.querySelector('#' + parent.element.id + '_frame');
|
|
3730
|
+
var zoom;
|
|
3731
|
+
var frameObj;
|
|
3732
|
+
var tempFrameObj;
|
|
3733
|
+
if (parent.currObjType.isFiltered) {
|
|
3734
|
+
parent.okBtn();
|
|
3735
|
+
}
|
|
3736
|
+
if (frame && !frame.classList.contains('e-disabled')) {
|
|
3737
|
+
zoom = parent.transform.zoomFactor;
|
|
3738
|
+
parent.frameDestPoints = extend({}, parent.img, {}, true);
|
|
3739
|
+
if (isNullOrUndefined(parent.cxtTbarHeight)) {
|
|
3740
|
+
frameObj = extend({}, parent.frameObj, {}, true);
|
|
3741
|
+
tempFrameObj = extend({}, parent.tempFrameObj, {}, true);
|
|
3742
|
+
this.callFrameToolbar();
|
|
3743
|
+
parent.frameObj.type = 'mat';
|
|
3744
|
+
this.callFrameToolbar();
|
|
3745
|
+
parent.cxtTbarHeight = parent.element.querySelector('#' + parent.element.id + '_customizeWrapper').clientHeight;
|
|
3746
|
+
parent.frameObj = frameObj;
|
|
3747
|
+
parent.tempFrameObj = tempFrameObj;
|
|
3748
|
+
}
|
|
3749
|
+
this.zoomToFrameRange();
|
|
3750
|
+
parent.tempFrameZoomLevel = zoom;
|
|
3751
|
+
if (Browser.isDevice) {
|
|
3752
|
+
parent.img.destTop -= (parent.cxtTbarHeight / 2);
|
|
3753
|
+
}
|
|
3754
|
+
else {
|
|
3755
|
+
parent.img.destTop += (parent.cxtTbarHeight / 2);
|
|
2645
3756
|
}
|
|
3757
|
+
this.callFrameToolbar();
|
|
3758
|
+
}
|
|
3759
|
+
};
|
|
3760
|
+
ToolbarModule.prototype.zoomToFrameRange = function () {
|
|
3761
|
+
var parent = this.parent;
|
|
3762
|
+
this.isFrameToolbar = false;
|
|
3763
|
+
parent.notify('transform', { prop: 'resetZoom', onPropertyChange: false });
|
|
3764
|
+
while (true) {
|
|
3765
|
+
if (this.toolbarHeight + parent.img.destTop >= (this.toolbarHeight + parent.cxtTbarHeight)) {
|
|
3766
|
+
break;
|
|
3767
|
+
}
|
|
3768
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3769
|
+
value: { zoomFactor: -.1, zoomPoint: null, isResize: true } });
|
|
3770
|
+
}
|
|
3771
|
+
this.isFrameToolbar = true;
|
|
3772
|
+
};
|
|
3773
|
+
ToolbarModule.prototype.resizeClick = function () {
|
|
3774
|
+
this.parent.upperCanvas.style.cursor = 'default';
|
|
3775
|
+
this.parent.notify('transform', { prop: 'updateResize', value: { bool: false } });
|
|
3776
|
+
if (this.isAspectRatio) {
|
|
3777
|
+
this.isAspectRatio = false;
|
|
2646
3778
|
}
|
|
3779
|
+
else {
|
|
3780
|
+
this.isAspectRatio = true;
|
|
3781
|
+
}
|
|
3782
|
+
this.parent.isResize = true;
|
|
3783
|
+
this.refreshToolbar('resize');
|
|
3784
|
+
};
|
|
3785
|
+
ToolbarModule.prototype.callFrameToolbar = function () {
|
|
3786
|
+
var parent = this.parent;
|
|
3787
|
+
parent.notify('draw', { prop: 'setTempFrame', value: { frame: parent.frameObj.type } });
|
|
3788
|
+
extend(parent.tempFrameObj, parent.frameObj);
|
|
3789
|
+
var undoRedoObj = { appliedUndoRedoColl: [] };
|
|
3790
|
+
parent.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: undoRedoObj } });
|
|
3791
|
+
if (undoRedoObj['appliedUndoRedoColl']['length'] === 0) {
|
|
3792
|
+
var object = { currObj: {} };
|
|
3793
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
3794
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
|
|
3795
|
+
operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
|
|
3796
|
+
previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
|
|
3797
|
+
previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
|
|
3798
|
+
previousFilter: null, isCircleCrop: null
|
|
3799
|
+
} });
|
|
3800
|
+
}
|
|
3801
|
+
this.refreshToolbar('frame');
|
|
2647
3802
|
};
|
|
2648
3803
|
ToolbarModule.prototype.contextualToolbarClicked = function (args) {
|
|
2649
3804
|
var parent = this.parent;
|
|
@@ -2676,6 +3831,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2676
3831
|
ToolbarModule.prototype.zoomInBtnClickHandler = function (e) {
|
|
2677
3832
|
var parent = this.parent;
|
|
2678
3833
|
if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
3834
|
+
if (parent.currObjType.isFiltered) {
|
|
3835
|
+
parent.okBtn();
|
|
3836
|
+
}
|
|
2679
3837
|
this.refreshShapeDrawing();
|
|
2680
3838
|
if (Browser.isDevice && e.type === 'touchstart') {
|
|
2681
3839
|
if (!e.returnValue) {
|
|
@@ -2700,12 +3858,15 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2700
3858
|
}
|
|
2701
3859
|
parent.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
2702
3860
|
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2703
|
-
value: { zoomFactor: .1, zoomPoint: null } });
|
|
3861
|
+
value: { zoomFactor: .1, zoomPoint: null, isResize: null } });
|
|
2704
3862
|
}
|
|
2705
3863
|
};
|
|
2706
3864
|
ToolbarModule.prototype.zoomOutBtnClickHandler = function (e) {
|
|
2707
3865
|
var parent = this.parent;
|
|
2708
3866
|
if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
3867
|
+
if (parent.currObjType.isFiltered) {
|
|
3868
|
+
parent.okBtn();
|
|
3869
|
+
}
|
|
2709
3870
|
this.refreshShapeDrawing();
|
|
2710
3871
|
if (Browser.isDevice && e.type === 'touchstart') {
|
|
2711
3872
|
if (!e.returnValue) {
|
|
@@ -2730,7 +3891,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2730
3891
|
}
|
|
2731
3892
|
parent.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
2732
3893
|
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2733
|
-
value: { zoomFactor: -.1, zoomPoint: null } });
|
|
3894
|
+
value: { zoomFactor: -.1, zoomPoint: null, isResize: null } });
|
|
2734
3895
|
}
|
|
2735
3896
|
};
|
|
2736
3897
|
ToolbarModule.prototype.zoomInBtnMouseDownHandler = function (e) {
|
|
@@ -2780,11 +3941,20 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2780
3941
|
id: parent.element.id + '_headWrapper',
|
|
2781
3942
|
styles: 'position: relative'
|
|
2782
3943
|
}));
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
: 'position: absolute; top: 25%; left: calc(50% -
|
|
2787
|
-
|
|
3944
|
+
if (type === 'transparency') {
|
|
3945
|
+
labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
|
|
3946
|
+
id: parent.element.id + '_labelWrapper',
|
|
3947
|
+
styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 175px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
3948
|
+
: 'position: absolute; top: 25%; left: calc(50% - 250px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
3949
|
+
}));
|
|
3950
|
+
}
|
|
3951
|
+
else {
|
|
3952
|
+
labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
|
|
3953
|
+
id: parent.element.id + '_labelWrapper',
|
|
3954
|
+
styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
3955
|
+
: 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
|
|
3956
|
+
}));
|
|
3957
|
+
}
|
|
2788
3958
|
}
|
|
2789
3959
|
else {
|
|
2790
3960
|
hdrWrapper.style.display = 'block';
|
|
@@ -2852,6 +4022,11 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2852
4022
|
}
|
|
2853
4023
|
slider = this.createSlider(min, max, value, type);
|
|
2854
4024
|
}
|
|
4025
|
+
else if (type === 'transparency') {
|
|
4026
|
+
min = 0;
|
|
4027
|
+
max = 100;
|
|
4028
|
+
slider = this.createSlider(min, max, value, type);
|
|
4029
|
+
}
|
|
2855
4030
|
slider.appendTo('#' + parent.element.id + '_sliderWrapper');
|
|
2856
4031
|
sliderWrapper.style.left = (parseFloat(canvasWrapper.style.width) - parseFloat(slider.width)) / 2 + 'px';
|
|
2857
4032
|
};
|
|
@@ -2868,8 +4043,15 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2868
4043
|
width: Browser.isDevice ? '200px' : '300px',
|
|
2869
4044
|
cssClass: 'e-slider',
|
|
2870
4045
|
change: function (args) {
|
|
2871
|
-
|
|
2872
|
-
|
|
4046
|
+
if (type === 'transparency') {
|
|
4047
|
+
parent.activeObj.imageTransparency = args.value / 100;
|
|
4048
|
+
_this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
4049
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
4050
|
+
}
|
|
4051
|
+
else {
|
|
4052
|
+
parent.setCurrAdjustmentValue(type, args.value);
|
|
4053
|
+
_this.enableDisableTbrBtn();
|
|
4054
|
+
}
|
|
2873
4055
|
}
|
|
2874
4056
|
});
|
|
2875
4057
|
};
|
|
@@ -2921,6 +4103,25 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2921
4103
|
sliderWrapper.remove();
|
|
2922
4104
|
}
|
|
2923
4105
|
};
|
|
4106
|
+
ToolbarModule.prototype.unselectFrameBtn = function () {
|
|
4107
|
+
var parent = this.parent;
|
|
4108
|
+
var selectors = [
|
|
4109
|
+
'#' + parent.element.id + '_none',
|
|
4110
|
+
'#' + parent.element.id + '_mat',
|
|
4111
|
+
'#' + parent.element.id + '_line',
|
|
4112
|
+
'#' + parent.element.id + '_inset',
|
|
4113
|
+
'#' + parent.element.id + '_bevel',
|
|
4114
|
+
'#' + parent.element.id + '_hook'
|
|
4115
|
+
];
|
|
4116
|
+
for (var _i = 0, selectors_2 = selectors; _i < selectors_2.length; _i++) {
|
|
4117
|
+
var selector = selectors_2[_i];
|
|
4118
|
+
var element = document.querySelector(selector);
|
|
4119
|
+
if (element.classList.contains('e-selected-btn')) {
|
|
4120
|
+
element.classList.remove('e-selected-btn');
|
|
4121
|
+
break;
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
};
|
|
2924
4125
|
ToolbarModule.prototype.updateToolbarItems = function () {
|
|
2925
4126
|
var parent = this.parent;
|
|
2926
4127
|
if (!parent.isImageLoaded) {
|