@syncfusion/ej2-image-editor 22.2.11 → 23.1.38

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