@syncfusion/ej2-image-editor 23.2.6 → 24.1.41

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 (99) hide show
  1. package/CHANGELOG.md +3 -51
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +7151 -4321
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +7269 -4426
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.d.ts +6 -0
  13. package/src/image-editor/action/crop.js +347 -188
  14. package/src/image-editor/action/draw.d.ts +35 -2
  15. package/src/image-editor/action/draw.js +1682 -881
  16. package/src/image-editor/action/export.js +90 -29
  17. package/src/image-editor/action/filter.d.ts +3 -1
  18. package/src/image-editor/action/filter.js +74 -94
  19. package/src/image-editor/action/freehand-draw.d.ts +4 -0
  20. package/src/image-editor/action/freehand-draw.js +259 -149
  21. package/src/image-editor/action/selection.d.ts +6 -1
  22. package/src/image-editor/action/selection.js +1133 -1091
  23. package/src/image-editor/action/shape.d.ts +7 -0
  24. package/src/image-editor/action/shape.js +921 -550
  25. package/src/image-editor/action/transform.d.ts +2 -0
  26. package/src/image-editor/action/transform.js +514 -346
  27. package/src/image-editor/action/undo-redo.d.ts +2 -0
  28. package/src/image-editor/action/undo-redo.js +137 -36
  29. package/src/image-editor/base/enum.d.ts +2 -1
  30. package/src/image-editor/base/enum.js +1 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +37 -2
  32. package/src/image-editor/base/image-editor.d.ts +124 -3
  33. package/src/image-editor/base/image-editor.js +672 -171
  34. package/src/image-editor/base/interface.d.ts +69 -15
  35. package/src/image-editor/renderer/toolbar.d.ts +10 -0
  36. package/src/image-editor/renderer/toolbar.js +1371 -822
  37. package/styles/bootstrap-dark.css +113 -8
  38. package/styles/bootstrap.css +112 -7
  39. package/styles/bootstrap4.css +113 -8
  40. package/styles/bootstrap5-dark.css +113 -8
  41. package/styles/bootstrap5.css +113 -8
  42. package/styles/fabric-dark.css +114 -9
  43. package/styles/fabric.css +113 -8
  44. package/styles/fluent-dark.css +118 -9
  45. package/styles/fluent.css +118 -9
  46. package/styles/highcontrast-light.css +112 -7
  47. package/styles/highcontrast.css +116 -7
  48. package/styles/image-editor/_bootstrap-dark-definition.scss +3 -0
  49. package/styles/image-editor/_bootstrap-definition.scss +3 -0
  50. package/styles/image-editor/_bootstrap4-definition.scss +3 -0
  51. package/styles/image-editor/_bootstrap5-definition.scss +3 -0
  52. package/styles/image-editor/_fabric-dark-definition.scss +3 -0
  53. package/styles/image-editor/_fabric-definition.scss +3 -0
  54. package/styles/image-editor/_fluent-definition.scss +3 -0
  55. package/styles/image-editor/_fusionnew-definition.scss +3 -0
  56. package/styles/image-editor/_highcontrast-definition.scss +3 -0
  57. package/styles/image-editor/_highcontrast-light-definition.scss +3 -0
  58. package/styles/image-editor/_layout.scss +138 -4
  59. package/styles/image-editor/_material-dark-definition.scss +3 -0
  60. package/styles/image-editor/_material-definition.scss +3 -0
  61. package/styles/image-editor/_material3-definition.scss +3 -0
  62. package/styles/image-editor/_tailwind-definition.scss +3 -0
  63. package/styles/image-editor/_theme.scss +2 -4
  64. package/styles/image-editor/bootstrap-dark.css +113 -8
  65. package/styles/image-editor/bootstrap.css +112 -7
  66. package/styles/image-editor/bootstrap4.css +113 -8
  67. package/styles/image-editor/bootstrap5-dark.css +113 -8
  68. package/styles/image-editor/bootstrap5.css +113 -8
  69. package/styles/image-editor/fabric-dark.css +114 -9
  70. package/styles/image-editor/fabric.css +113 -8
  71. package/styles/image-editor/fluent-dark.css +118 -9
  72. package/styles/image-editor/fluent.css +118 -9
  73. package/styles/image-editor/highcontrast-light.css +112 -7
  74. package/styles/image-editor/highcontrast.css +116 -7
  75. package/styles/image-editor/icons/_bootstrap-dark.scss +60 -0
  76. package/styles/image-editor/icons/_bootstrap.scss +60 -0
  77. package/styles/image-editor/icons/_bootstrap4.scss +60 -0
  78. package/styles/image-editor/icons/_bootstrap5.scss +60 -0
  79. package/styles/image-editor/icons/_fabric-dark.scss +60 -0
  80. package/styles/image-editor/icons/_fabric.scss +60 -0
  81. package/styles/image-editor/icons/_fluent.scss +66 -0
  82. package/styles/image-editor/icons/_highcontrast-light.scss +60 -0
  83. package/styles/image-editor/icons/_highcontrast.scss +60 -0
  84. package/styles/image-editor/icons/_material-dark.scss +60 -0
  85. package/styles/image-editor/icons/_material.scss +60 -0
  86. package/styles/image-editor/icons/_material3.scss +60 -0
  87. package/styles/image-editor/icons/_tailwind.scss +60 -0
  88. package/styles/image-editor/material-dark.css +113 -8
  89. package/styles/image-editor/material.css +113 -8
  90. package/styles/image-editor/material3-dark.css +126 -9
  91. package/styles/image-editor/material3.css +126 -9
  92. package/styles/image-editor/tailwind-dark.css +114 -9
  93. package/styles/image-editor/tailwind.css +114 -9
  94. package/styles/material-dark.css +113 -8
  95. package/styles/material.css +113 -8
  96. package/styles/material3-dark.css +126 -9
  97. package/styles/material3.css +126 -9
  98. package/styles/tailwind-dark.css +114 -9
  99. package/styles/tailwind.css +114 -9
@@ -1,4 +1,4 @@
1
- import { extend, Browser, detach, select } from '@syncfusion/ej2-base';
1
+ import { extend, Browser, detach, select, isBlazor } from '@syncfusion/ej2-base';
2
2
  import { EventHandler, getComponent, isNullOrUndefined, L10n } from '@syncfusion/ej2-base';
3
3
  import { NumericTextBox } from '@syncfusion/ej2-inputs';
4
4
  import { Toolbar } from '@syncfusion/ej2-navigations';
@@ -17,6 +17,19 @@ var ToolbarModule = /** @class */ (function () {
17
17
  this.preventEnableDisableUr = false;
18
18
  this.isAspectRatio = true;
19
19
  this.isFrameToolbar = false;
20
+ this.presetColors = {
21
+ 'custom': ['#000000', '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#2196f3',
22
+ '#03a9f4', '#00bcd4', '#009688', '#ffeb3b', '#ffffff', '#ffebee', '#fce4ec', '#f3e5f5', '#ede7f6', '#e3f2fd',
23
+ '#e1f5fe', '#e0f7fa', '#e0f2f1', '#fffde7', '#f2f2f2', '#ffcdd2', '#f8bbd0', '#e1bee7', '#d1c4e9', '#bbdefb',
24
+ '#b3e5fc', '#b2ebf2', '#b2dfdb', '#fff9c4', '#e6e6e6', '#ef9a9a', '#f48fb1', '#ce93d8', '#b39ddb', '#90caf9',
25
+ '#81d4fa', '#80deea', '#80cbc4', '#fff59d', '#cccccc', '#e57373', '#f06292', '#ba68c8', '#9575cd', '#64b5f6',
26
+ '#4fc3f7', '#4dd0e1', '#4db6ac', '#fff176', '#b3b3b3', '#ef5350', '#ec407a', '#ab47bc', '#7e57c2', '#42a5f5',
27
+ '#29b6f6', '#26c6da', '#26a69a', '#ffee58', '#999999', '#e53935', '#d81b60', '#8e24aa', '#5e35b1', '#1e88e5',
28
+ '#039be5', '#00acc1', '#00897b', '#fdd835', '#808080', '#d32f2f', '#c2185b', '#7b1fa2', '#512da8', '#1976d2',
29
+ '#0288d1', '#0097a7', '#00796b', '#fbc02d', '#666666', '#c62828', '#ad1457', '#6a1b9a', '#4527a0', '#1565c0',
30
+ '#0277bd', '#00838f', '#00695c', '#f9a825', '#4d4d4d', '#b71c1c', '#880e4f', '#4a148c', '#311b92', '#0d47a1',
31
+ '#01579b', '#006064', '#004d40', '#f57f17']
32
+ };
20
33
  this.parent = parent;
21
34
  this.addEventListener();
22
35
  this.initLocale();
@@ -71,8 +84,8 @@ var ToolbarModule = /** @class */ (function () {
71
84
  RotateRight: 'Rotate Right',
72
85
  HorizontalFlip: 'Horizontal Flip',
73
86
  VerticalFlip: 'Vertical Flip',
74
- OK: 'OK',
75
- Cancel: 'Cancel',
87
+ OK: 'Apply',
88
+ Cancel: 'Discard',
76
89
  FillColor: 'Fill Color',
77
90
  StrokeColor: 'Stroke Color',
78
91
  StrokeWidth: 'Stroke Width',
@@ -158,7 +171,9 @@ var ToolbarModule = /** @class */ (function () {
158
171
  Yes: 'Yes',
159
172
  No: 'No',
160
173
  ImageErrorDialogHeader: 'Image Selection Error',
161
- ImageErrorDialogContent: 'Please select only one image to open.'
174
+ ImageErrorDialogContent: 'Please select only one image to open.',
175
+ Straighten: 'Straighten',
176
+ NoOutline: 'No outline',
162
177
  };
163
178
  this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
164
179
  };
@@ -185,7 +200,7 @@ var ToolbarModule = /** @class */ (function () {
185
200
  this.enableDisableTbrBtn();
186
201
  break;
187
202
  case 'init-main-toolbar':
188
- this.initMainToolbar(args.value['isApplyBtn'], args.value['isDevice'], args.value['isOkBtn'], args.value['isResize']);
203
+ this.initMainToolbar(args.value['isApplyBtn'], args.value['isDevice'], args.value['isOkBtn'], args.value['isResize'], args.value['isFrame'], args.value['isMainToolbar']);
189
204
  break;
190
205
  case 'create-bottom-toolbar':
191
206
  this.createBottomToolbar();
@@ -310,6 +325,12 @@ var ToolbarModule = /** @class */ (function () {
310
325
  case 'frameToolbarClick':
311
326
  this.frameToolbarClick();
312
327
  break;
328
+ case 'performCropTransformClick':
329
+ this.performCropTransformClick();
330
+ break;
331
+ case 'duplicateShape':
332
+ this.duplicateShape(args.value['isPreventUndoRedo'], true);
333
+ break;
313
334
  }
314
335
  };
315
336
  ToolbarModule.prototype.updatePrivateVariables = function () {
@@ -340,19 +361,21 @@ var ToolbarModule = /** @class */ (function () {
340
361
  parent.initialAdjustmentValue = parent.canvasFilter =
341
362
  'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
342
363
  'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
364
+ parent.tempStraighten = 0;
365
+ parent.isStraightening = false;
343
366
  };
344
367
  ToolbarModule.prototype.destroyTopToolbar = function () {
345
368
  var parent = this.parent;
346
369
  var toolbar = document.getElementById(parent.element.id + '_toolbar');
347
370
  if (this.isToolbar() && toolbar && toolbar.classList.contains('e-control')) {
348
- getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
371
+ getComponent(toolbar, 'toolbar').destroy();
349
372
  }
350
373
  };
351
374
  ToolbarModule.prototype.destroyBottomToolbar = function () {
352
375
  var parent = this.parent;
353
376
  var toolbar = document.getElementById(parent.element.id + '_bottomToolbar');
354
377
  if (toolbar && toolbar.classList.contains('e-control')) {
355
- getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
378
+ getComponent(toolbar, 'toolbar').destroy();
356
379
  }
357
380
  };
358
381
  ToolbarModule.prototype.isToolbar = function () {
@@ -363,9 +386,10 @@ var ToolbarModule = /** @class */ (function () {
363
386
  ToolbarModule.prototype.createToolbar = function () {
364
387
  var _this = this;
365
388
  var parent = this.parent;
389
+ var id = parent.element.id;
366
390
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
367
391
  parent.element.appendChild(parent.createElement('div', {
368
- id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
392
+ id: id + '_toolbarArea', className: 'e-toolbar-area'
369
393
  }));
370
394
  var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
371
395
  tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
@@ -373,10 +397,8 @@ var ToolbarModule = /** @class */ (function () {
373
397
  this.defToolbarItems = [];
374
398
  }
375
399
  this.defToolbarItems.push(toolbarItems);
376
- var toolbarArea = document.getElementById(parent.element.id + '_toolbarArea');
377
- var toolbar_1 = parent.createElement('div', {
378
- id: parent.element.id + '_toolbar'
379
- });
400
+ var toolbarArea = document.getElementById(id + '_toolbarArea');
401
+ var toolbar_1 = parent.createElement('div', { id: id + '_toolbar' });
380
402
  toolbarArea.appendChild(toolbar_1);
381
403
  var uploadItems = [
382
404
  {
@@ -387,22 +409,22 @@ var ToolbarModule = /** @class */ (function () {
387
409
  allowedExtensions: '.jpg, .jpeg, .png,.svg',
388
410
  multiple: false,
389
411
  selected: function () {
412
+ var toolbar = document.getElementById(id + '_toolbar');
413
+ var bToolbar = document.getElementById(id + '_bottomToolbar');
390
414
  if (!parent.disabled) {
391
415
  if (Browser.isDevice) {
392
- if (_this.defToolbarItems.length > 0 &&
393
- document.getElementById(parent.element.id + '_toolbar')) {
394
- getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
416
+ if (_this.defToolbarItems.length > 0 && toolbar) {
417
+ getComponent(toolbar, 'toolbar').destroy();
395
418
  }
396
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
397
- getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
419
+ if (bToolbar) {
420
+ getComponent(bToolbar, 'toolbar').destroy();
398
421
  }
399
422
  _this.initMainToolbar(false, Browser.isDevice, null);
400
423
  _this.createBottomToolbar();
401
424
  }
402
425
  else {
403
- if (_this.defToolbarItems.length > 0 &&
404
- document.getElementById(parent.element.id + '_toolbar')) {
405
- getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
426
+ if (_this.defToolbarItems.length > 0 && toolbar) {
427
+ getComponent(toolbar, 'toolbar').destroy();
406
428
  }
407
429
  _this.initMainToolbar(false, false, null);
408
430
  }
@@ -416,10 +438,11 @@ var ToolbarModule = /** @class */ (function () {
416
438
  parent.trigger('toolbarCreated', { toolbarType: 'main' });
417
439
  },
418
440
  clicked: this.defToolbarClicked.bind(this) });
419
- toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
441
+ toolbarObj.appendTo('#' + id + '_toolbar');
420
442
  this.createLeftToolbarControls();
421
- if (document.getElementById(parent.element.id + '_toolbar')) {
422
- this.toolbarHeight = document.getElementById(parent.element.id + '_toolbar').clientHeight;
443
+ var mToolbar = document.getElementById(id + '_toolbar');
444
+ if (toolbar_1) {
445
+ this.toolbarHeight = mToolbar.scrollHeight;
423
446
  }
424
447
  }
425
448
  else {
@@ -428,27 +451,30 @@ var ToolbarModule = /** @class */ (function () {
428
451
  };
429
452
  ToolbarModule.prototype.createContextualToolbar = function () {
430
453
  var parent = this.parent;
454
+ var id = parent.element.id;
431
455
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
432
- parent.element.appendChild(parent.createElement('div', { id: parent.element.id + '_contextualToolbarArea',
456
+ parent.element.appendChild(parent.createElement('div', { id: id + '_contextualToolbarArea',
433
457
  className: 'e-contextual-toolbar-wrapper e-hide', attrs: { style: 'position: absolute;' }
434
458
  }));
435
- var toolbarArea = document.getElementById(parent.element.id + '_contextualToolbarArea');
436
- var toolbar_2 = parent.createElement('div', { id: parent.element.id + '_contextualToolbar' });
459
+ var toolbarArea = document.getElementById(id + '_contextualToolbarArea');
460
+ var toolbar_2 = parent.createElement('div', { id: id + '_contextualToolbar' });
437
461
  toolbarArea.appendChild(toolbar_2);
438
462
  }
439
463
  };
440
464
  ToolbarModule.prototype.createBottomToolbar = function () {
441
465
  var parent = this.parent;
466
+ var id = parent.element.id;
467
+ if (parent.element.querySelector('#' + id + '_bottomToolbarArea')) {
468
+ parent.element.querySelector('#' + id + '_bottomToolbarArea').remove();
469
+ }
442
470
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
443
471
  parent.element.appendChild(parent.createElement('div', {
444
- id: parent.element.id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
472
+ id: id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
445
473
  }));
446
474
  if (!parent.toolbarTemplate) {
447
- document.getElementById(parent.element.id + '_canvasWrapper').style.height = (parent.element.offsetHeight
448
- - this.toolbarHeight * 2) - 3 + 'px';
449
- var toolbarArea = document.getElementById(parent.element.id + '_bottomToolbarArea');
475
+ var toolbarArea = document.getElementById(id + '_bottomToolbarArea');
450
476
  var toolbarElem = parent.createElement('div', {
451
- id: parent.element.id + '_bottomToolbar'
477
+ id: id + '_bottomToolbar'
452
478
  });
453
479
  toolbarArea.appendChild(toolbarElem);
454
480
  }
@@ -457,6 +483,7 @@ var ToolbarModule = /** @class */ (function () {
457
483
  };
458
484
  ToolbarModule.prototype.createQuickAccessToolbar = function () {
459
485
  var parent = this.parent;
486
+ var id = parent.element.id;
460
487
  if (parent.showQuickAccessToolbar) {
461
488
  var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
462
489
  tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
@@ -464,21 +491,22 @@ var ToolbarModule = /** @class */ (function () {
464
491
  this.defToolbarItems = [];
465
492
  }
466
493
  this.defToolbarItems.push(toolbarItems);
467
- var toolbarArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
494
+ var toolbarArea = document.getElementById(id + '_quickAccessToolbarArea');
468
495
  var toolbar_3 = parent.createElement('div', {
469
- id: parent.element.id + '_quickAccessToolbar'
496
+ id: id + '_quickAccessToolbar'
470
497
  });
471
498
  toolbarArea.appendChild(toolbar_3);
472
499
  var toolbarObj = new Toolbar({ clicked: this.defToolbarClicked.bind(this) });
473
- toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
500
+ toolbarObj.appendTo('#' + id + '_quickAccessToolbar');
474
501
  }
475
502
  };
476
- ToolbarModule.prototype.initMainToolbar = function (isApplyOption, isDevice, isOkBtn, isResize, isFrame) {
503
+ ToolbarModule.prototype.initMainToolbar = function (isApplyOption, isDevice, isOkBtn, isResize, isFrame, isMainToolbar) {
477
504
  var _this = this;
478
505
  var parent = this.parent;
506
+ var id = parent.element.id;
479
507
  if (this.isToolbar()) {
480
508
  var leftItem = this.getLeftToolbarItem(isOkBtn, isResize);
481
- var rightItem = this.getRightToolbarItem(isOkBtn);
509
+ var rightItem = this.getRightToolbarItem(isOkBtn, isMainToolbar);
482
510
  var mainItem = this.getMainToolbarItem(isApplyOption, isFrame);
483
511
  var zoomItem = this.getZoomToolbarItem();
484
512
  if (isDevice) {
@@ -506,16 +534,16 @@ var ToolbarModule = /** @class */ (function () {
506
534
  }
507
535
  });
508
536
  if (isDevice && isFrame) {
509
- toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
537
+ toolbarObj.appendTo('#' + id + '_bottomToolbar');
510
538
  }
511
539
  else {
512
- toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
540
+ toolbarObj.appendTo('#' + id + '_toolbar');
513
541
  }
514
542
  this.createLeftToolbarControls();
515
543
  this.enableDisableTbrBtn();
516
- if (this.isToolbar() && document.getElementById(parent.element.id + '_toolbar')) {
544
+ if (this.isToolbar() && document.getElementById(id + '_toolbar')) {
517
545
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
518
- var toolbar_4 = getComponent(parent.element.id + '_toolbar', 'toolbar');
546
+ var toolbar_4 = getComponent(id + '_toolbar', 'toolbar');
519
547
  toolbar_4.refreshOverflow();
520
548
  }
521
549
  }
@@ -523,6 +551,7 @@ var ToolbarModule = /** @class */ (function () {
523
551
  ToolbarModule.prototype.initBottomToolbar = function () {
524
552
  var _this = this;
525
553
  var parent = this.parent;
554
+ var id = parent.element.id;
526
555
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
527
556
  var items = this.getMainToolbarItem();
528
557
  var toolbarObj = new Toolbar({ items: items, width: '100%',
@@ -534,38 +563,39 @@ var ToolbarModule = /** @class */ (function () {
534
563
  },
535
564
  clicked: this.defToolbarClicked.bind(this)
536
565
  });
537
- toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
538
- if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
566
+ toolbarObj.appendTo('#' + id + '_bottomToolbar');
567
+ if (this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
539
568
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
540
- var toolbar_5 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
569
+ var toolbar_5 = getComponent(id + '_bottomToolbar', 'toolbar');
541
570
  toolbar_5.refreshOverflow();
542
571
  }
543
572
  }
544
573
  };
545
574
  ToolbarModule.prototype.getLeftToolbarItem = function (isOkBtn, isResize) {
546
575
  var parent = this.parent;
576
+ var id = parent.element.id;
547
577
  var toolbarItems = [];
548
578
  if (!isOkBtn || isResize) {
549
- toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
579
+ toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
550
580
  toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
551
581
  }
552
582
  if (parent.allowUndoRedo && !isResize) {
553
583
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
554
- toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
584
+ toolbarItems.push({ id: id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
555
585
  tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
556
586
  }
557
587
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Redo') > -1)) {
558
- toolbarItems.push({ id: parent.element.id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
588
+ toolbarItems.push({ id: id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
559
589
  tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
560
590
  }
561
591
  }
562
592
  if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar && !isResize) {
563
593
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomOut') > -1)) {
564
- toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
594
+ toolbarItems.push({ id: id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
565
595
  tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
566
596
  }
567
597
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomIn') > -1)) {
568
- toolbarItems.push({ id: parent.element.id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
598
+ toolbarItems.push({ id: id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
569
599
  tooltipText: this.l10n.getConstant('ZoomIn'), align: 'Left' });
570
600
  }
571
601
  }
@@ -575,23 +605,24 @@ var ToolbarModule = /** @class */ (function () {
575
605
  }
576
606
  return toolbarItems;
577
607
  };
578
- ToolbarModule.prototype.getRightToolbarItem = function (isOkBtn) {
608
+ ToolbarModule.prototype.getRightToolbarItem = function (isOkBtn, isMainToolbar) {
579
609
  var parent = this.parent;
610
+ var id = parent.element.id;
580
611
  var toolbarItems = [];
581
612
  if (isOkBtn) {
582
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
613
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
583
614
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
584
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
615
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
585
616
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
586
617
  }
587
- if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Reset') > -1)) {
588
- toolbarItems.push({ id: parent.element.id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
618
+ if ((isMainToolbar || !Browser.isDevice) && (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Reset') > -1))) {
619
+ toolbarItems.push({ id: id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
589
620
  tooltipText: this.l10n.getConstant('Reset'), align: 'Right' });
590
621
  }
591
622
  if (!isOkBtn) {
592
623
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Save') > -1)) {
593
- toolbarItems.push({ id: parent.element.id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
594
- tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + parent.element.id + '_saveBtn"></button>' });
624
+ toolbarItems.push({ id: id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
625
+ tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + id + '_saveBtn"></button>' });
595
626
  }
596
627
  }
597
628
  var tempToolbarItems = this.processToolbar('right');
@@ -602,56 +633,57 @@ var ToolbarModule = /** @class */ (function () {
602
633
  };
603
634
  ToolbarModule.prototype.getMainToolbarItem = function (isApplyOption, isFrame) {
604
635
  var parent = this.parent;
636
+ var id = parent.element.id;
605
637
  var toolbarItems = [];
606
638
  if (isFrame) {
607
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('None') > -1)) {
608
- toolbarItems.push({ id: this.parent.element.id + '_none', prefixIcon: 'e-icons e-frame-none', cssClass: 'top-icon e-frame-none',
639
+ if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('None') > -1)) {
640
+ toolbarItems.push({ id: id + '_none', prefixIcon: 'e-icons e-frame-none', cssClass: 'top-icon e-frame-none',
609
641
  tooltipText: this.l10n.getConstant('None'), align: 'Center' });
610
642
  }
611
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Mat') > -1)) {
612
- toolbarItems.push({ id: this.parent.element.id + '_mat', prefixIcon: 'e-icons e-frame-mat', cssClass: 'top-icon e-frame-mat',
643
+ if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Mat') > -1)) {
644
+ toolbarItems.push({ id: id + '_mat', prefixIcon: 'e-icons e-frame-mat', cssClass: 'top-icon e-frame-mat',
613
645
  tooltipText: this.l10n.getConstant('Mat'), align: 'Center' });
614
646
  }
615
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Bevel') > -1)) {
616
- toolbarItems.push({ id: this.parent.element.id + '_bevel', prefixIcon: 'e-icons e-frame-bevel', cssClass: 'top-icon e-frame-bevel',
647
+ if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Bevel') > -1)) {
648
+ toolbarItems.push({ id: id + '_bevel', prefixIcon: 'e-icons e-frame-bevel', cssClass: 'top-icon e-frame-bevel',
617
649
  tooltipText: this.l10n.getConstant('Bevel'), align: 'Center' });
618
650
  }
619
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Line') > -1)) {
620
- toolbarItems.push({ id: this.parent.element.id + '_line', prefixIcon: 'e-icons e-frame-line', cssClass: 'top-icon e-frame-line',
651
+ if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Line') > -1)) {
652
+ toolbarItems.push({ id: id + '_line', prefixIcon: 'e-icons e-frame-line', cssClass: 'top-icon e-frame-line',
621
653
  tooltipText: this.l10n.getConstant('Line'), align: 'Center' });
622
654
  }
623
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Inset') > -1)) {
624
- toolbarItems.push({ id: this.parent.element.id + '_inset', prefixIcon: 'e-icons e-frame-inset', cssClass: 'top-icon e-frame-inset',
655
+ if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Inset') > -1)) {
656
+ toolbarItems.push({ id: id + '_inset', prefixIcon: 'e-icons e-frame-inset', cssClass: 'top-icon e-frame-inset',
625
657
  tooltipText: this.l10n.getConstant('Inset'), align: 'Center' });
626
658
  }
627
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Hook') > -1)) {
628
- toolbarItems.push({ id: this.parent.element.id + '_hook', prefixIcon: 'e-icons e-frame-hook', cssClass: 'top-icon e-frame-hook',
659
+ if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Hook') > -1)) {
660
+ toolbarItems.push({ id: id + '_hook', prefixIcon: 'e-icons e-frame-hook', cssClass: 'top-icon e-frame-hook',
629
661
  tooltipText: this.l10n.getConstant('Hook'), align: 'Center' });
630
662
  }
631
663
  }
632
664
  else {
633
665
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Crop') > -1)) {
634
- toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
666
+ toolbarItems.push({ id: id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
635
667
  tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
636
668
  }
637
669
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Annotate') > -1)) {
638
- toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
639
- template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
670
+ toolbarItems.push({ id: id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
671
+ template: '<button id="' + id + '_annotationBtn"></button>' });
640
672
  }
641
673
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Finetune') > -1)) {
642
- toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
674
+ toolbarItems.push({ id: id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
643
675
  tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
644
676
  }
645
677
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Filter') > -1)) {
646
- toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
678
+ toolbarItems.push({ id: id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
647
679
  tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
648
680
  }
649
681
  if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Frame') > -1)) {
650
- toolbarItems.push({ id: parent.element.id + '_frame', prefixIcon: 'e-icons e-border-frame', cssClass: 'top-icon e-border-frame',
682
+ toolbarItems.push({ id: id + '_frame', prefixIcon: 'e-icons e-border-frame', cssClass: 'top-icon e-border-frame',
651
683
  tooltipText: this.l10n.getConstant('Frame'), align: 'Center' });
652
684
  }
653
685
  if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Resize') > -1)) {
654
- toolbarItems.push({ id: parent.element.id + '_resize', prefixIcon: 'e-icons e-resize', cssClass: 'top-icon e-resize',
686
+ toolbarItems.push({ id: id + '_resize', prefixIcon: 'e-icons e-resize', cssClass: 'top-icon e-resize',
655
687
  tooltipText: this.l10n.getConstant('Resize'), align: 'Center' });
656
688
  }
657
689
  }
@@ -660,9 +692,9 @@ var ToolbarModule = /** @class */ (function () {
660
692
  toolbarItems.push(tempToolbarItems[i]);
661
693
  }
662
694
  if (isApplyOption) {
663
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
695
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
664
696
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
665
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
697
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
666
698
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
667
699
  }
668
700
  return toolbarItems;
@@ -671,15 +703,17 @@ var ToolbarModule = /** @class */ (function () {
671
703
  var toolbarItems = [];
672
704
  return toolbarItems;
673
705
  };
674
- ToolbarModule.prototype.updateContextualToolbar = function (type, cType) {
706
+ ToolbarModule.prototype.updateContextualToolbar = function (type, cType, isSelect) {
675
707
  var parent = this.parent;
676
- var toolbarArea = parent.element.querySelector('#' + parent.element.id + '_toolbarArea');
677
- var contextualToolbarArea = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
708
+ var id = parent.element.id;
709
+ var toolbarArea = parent.element.querySelector('#' + id + '_toolbarArea');
710
+ var contextualToolbarArea = parent.element.querySelector('#' + id + '_contextualToolbarArea');
678
711
  contextualToolbarArea.classList.remove('e-hide');
679
712
  contextualToolbarArea.style.left = toolbarArea.offsetLeft + 'px';
680
713
  if (type === 'filter') {
681
- if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
682
- getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
714
+ var toolbar_6 = document.getElementById(id + '_toolbar');
715
+ if (toolbar_6 && this.defToolbarItems.length > 0) {
716
+ getComponent(toolbar_6, 'toolbar').destroy();
683
717
  }
684
718
  if (Browser.isDevice) {
685
719
  this.initMainToolbar(false, true, true);
@@ -691,24 +725,49 @@ var ToolbarModule = /** @class */ (function () {
691
725
  this.initFilterToolbarItem();
692
726
  }
693
727
  else {
694
- if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
695
- getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
728
+ var ctxToolbar = document.querySelector('#' + id + '_contextualToolbar');
729
+ if (ctxToolbar.classList.contains('e-control')) {
730
+ getComponent(ctxToolbar, 'toolbar').destroy();
696
731
  }
697
732
  this.refreshSlider();
698
733
  if (type === 'frame') {
699
734
  this.initFrameToolbarItem();
700
735
  }
701
736
  else {
702
- this.renderSlider(cType);
737
+ this.renderSlider(cType, isSelect);
703
738
  }
704
739
  }
740
+ if (!isBlazor()) {
741
+ if (parent.toolbarTemplate) {
742
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').offsetHeight;
743
+ }
744
+ else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
745
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').offsetHeight;
746
+ }
747
+ parent.toolbarHeight = this.toolbarHeight;
748
+ }
705
749
  if (Browser.isDevice) {
706
- var cHt = contextualToolbarArea.offsetHeight;
707
- if (this.isFrameToolbar && parent.element.querySelector('#' + parent.element.id + '_customizeWrapper')) {
708
- cHt = parent.element.querySelector('#' + parent.element.id + '_customizeWrapper').offsetHeight;
750
+ var cHt = contextualToolbarArea.offsetHeight + 1;
751
+ var cusWrapper = parent.element.querySelector('#' + id + '_customizeWrapper');
752
+ if (this.isFrameToolbar && cusWrapper) {
753
+ cHt = cusWrapper.offsetHeight + 2;
709
754
  }
710
- var ht = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper').offsetHeight;
755
+ var ht = parent.element.querySelector('#' + id + '_canvasWrapper').offsetHeight;
711
756
  contextualToolbarArea.style.top = this.toolbarHeight + ht - cHt + 'px';
757
+ if (cType === 'straighten') {
758
+ parent.isStraightening = true;
759
+ var ctxToolbar = parent.element.querySelector('#' + id + '_contextualToolbarArea');
760
+ if (ctxToolbar.style.position === 'absolute') {
761
+ ctxToolbar.style.position = '';
762
+ parent.element.insertBefore(ctxToolbar, parent.element.querySelector('#' + id + '_bottomToolbarArea'));
763
+ parent.update();
764
+ if (isSelect) {
765
+ parent.notify('draw', { prop: 'select', onPropertyChange: false,
766
+ value: { type: this.getCropTextContent(document.getElementById(id + '_cropBtn')).toLowerCase(),
767
+ startX: null, startY: null, width: null, height: null } });
768
+ }
769
+ }
770
+ }
712
771
  }
713
772
  else {
714
773
  contextualToolbarArea.style.top = this.toolbarHeight + 'px';
@@ -761,8 +820,26 @@ var ToolbarModule = /** @class */ (function () {
761
820
  zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
762
821
  }
763
822
  };
823
+ ToolbarModule.prototype.widthPress = function (e) {
824
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
825
+ if (e.keyCode === 109) {
826
+ e.preventDefault();
827
+ return;
828
+ }
829
+ };
830
+ ToolbarModule.prototype.heightPress = function (e) {
831
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
832
+ if (e.keyCode === 109) {
833
+ e.preventDefault();
834
+ return;
835
+ }
836
+ };
764
837
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
765
838
  ToolbarModule.prototype.widthAspectRatio = function (e) {
839
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
840
+ if (e.keyCode === 109) {
841
+ return;
842
+ }
766
843
  var parent = this.parent;
767
844
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
768
845
  var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
@@ -770,26 +847,32 @@ var ToolbarModule = /** @class */ (function () {
770
847
  var originalWidth = parent.img.destWidth;
771
848
  var originalHeight = parent.img.destHeight;
772
849
  var aspectRatioHeightValue = parseFloat(aspectRatioHeight.value);
773
- var width = Math.floor((aspectRatioHeightValue / (originalHeight / originalWidth)));
850
+ var value = aspectRatioHeightValue / (originalHeight / originalWidth);
851
+ var width = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
774
852
  var widthNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
853
+ var heightNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
775
854
  if (icon) {
776
855
  if (width != null && !isNaN(width)) {
777
- if (isNullOrUndefined(widthNumeric.value)) {
778
- widthNumeric.placeholder = width + ' px';
856
+ if (isNullOrUndefined((widthNumeric).value)) {
857
+ (widthNumeric).placeholder = width + ' px';
779
858
  aspectRatioWidth.placeholder = width.toString() + ' px';
780
859
  }
781
860
  else {
782
- widthNumeric.value = width;
861
+ (widthNumeric).value = width;
783
862
  aspectRatioWidth.value = width.toString() + ' px';
784
863
  }
785
864
  }
786
865
  else {
787
- if (isNullOrUndefined(widthNumeric.value)) {
788
- widthNumeric.placeholder = '0 px';
866
+ if (isNullOrUndefined((widthNumeric).value)) {
867
+ (widthNumeric).placeholder = '0 px';
789
868
  aspectRatioWidth.placeholder = '0 px';
869
+ if (isNullOrUndefined(heightNumeric.value) && !isNullOrUndefined(heightNumeric.placeholder)) {
870
+ (widthNumeric).placeholder = "" + parent.img.srcWidth;
871
+ aspectRatioWidth.placeholder = "" + parent.img.srcWidth;
872
+ }
790
873
  }
791
874
  else {
792
- widthNumeric.value = 0;
875
+ (widthNumeric).value = 0;
793
876
  aspectRatioWidth.value = '0 px';
794
877
  }
795
878
  }
@@ -797,79 +880,94 @@ var ToolbarModule = /** @class */ (function () {
797
880
  };
798
881
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
799
882
  ToolbarModule.prototype.heightAspectRatio = function (e) {
883
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
884
+ if (e.keyCode === 109) {
885
+ return;
886
+ }
800
887
  var parent = this.parent;
801
- var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
802
- var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
803
- var icon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
888
+ var id = parent.element.id;
889
+ var aspectRatioHeight = parent.element.querySelector('#' + id + '_resizeHeight');
890
+ var aspectRatioWidth = parent.element.querySelector('#' + id + '_resizeWidth');
891
+ var icon = parent.element.querySelector('#' + id + '_aspectratio');
804
892
  var originalWidth = parent.img.destWidth;
805
893
  var originalHeight = parent.img.destHeight;
806
894
  var aspectRatioWidthValue = parseFloat(aspectRatioWidth.value);
807
- var height = Math.floor((aspectRatioWidthValue / (originalWidth / originalHeight)));
895
+ var value = aspectRatioWidthValue / (originalWidth / originalHeight);
896
+ var height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
808
897
  var heightNumeric = getComponent(aspectRatioHeight, 'numerictextbox');
898
+ var widthNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
809
899
  if (icon) {
810
900
  if (!isNaN(height)) {
811
- if (isNullOrUndefined(heightNumeric.value)) {
812
- heightNumeric.placeholder = height + ' px';
901
+ if (isNullOrUndefined((heightNumeric).value)) {
902
+ (heightNumeric).placeholder = height + ' px';
813
903
  aspectRatioHeight.placeholder = height.toString() + ' px';
814
904
  }
815
905
  else {
816
- heightNumeric.value = height;
906
+ (heightNumeric).value = height;
817
907
  aspectRatioHeight.value = height.toString() + ' px';
818
908
  }
819
909
  }
820
910
  else {
821
- if (isNullOrUndefined(heightNumeric.value)) {
822
- heightNumeric.placeholder = '0 px';
911
+ if (isNullOrUndefined((heightNumeric).value)) {
912
+ (heightNumeric).placeholder = '0 px';
823
913
  aspectRatioHeight.placeholder = '0 px';
914
+ if (isNullOrUndefined(widthNumeric.value) && !isNullOrUndefined(widthNumeric.placeholder)) {
915
+ (heightNumeric).placeholder = "" + parent.img.srcHeight;
916
+ aspectRatioHeight.placeholder = "" + parent.img.srcHeight;
917
+ }
824
918
  }
825
919
  else {
826
- heightNumeric.value = 0;
920
+ (heightNumeric).value = 0;
827
921
  aspectRatioHeight.value = '0 px';
828
922
  }
829
923
  }
830
924
  }
831
925
  };
832
926
  ToolbarModule.prototype.getResizeToolbarItem = function () {
833
- var toolbarItems = [];
834
- var isResize = this.parent.aspectWidth && this.parent.aspectHeight ? true : false;
927
+ var parent = this.parent;
928
+ var id = parent.element.id;
929
+ var isResize = parent.aspectWidth && parent.aspectHeight ? true : false;
835
930
  var width = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
836
931
  Math.ceil(this.parent.img.srcHeight).toString() : Math.ceil(this.parent.img.srcWidth).toString();
837
932
  var height = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
838
933
  Math.ceil(this.parent.img.srcWidth).toString() : Math.ceil(this.parent.img.srcHeight).toString();
934
+ var toolbarItems = [];
839
935
  var spanWidth = document.createElement('span');
840
936
  spanWidth.innerHTML = this.l10n.getConstant('W');
841
- toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
842
- toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
937
+ toolbarItems.push({ id: id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
938
+ toolbarItems.push({ id: id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
843
939
  tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
844
- showSpinButton: false, value: isResize ? this.parent.aspectWidth : null,
940
+ showSpinButton: false, value: isResize ? parent.aspectWidth : null,
845
941
  placeholder: isResize ? null : width, format: '###.## px' })
846
942
  });
847
943
  var spanHeight = document.createElement('span');
848
944
  spanHeight.innerHTML = this.l10n.getConstant('H');
849
- toolbarItems.push({ id: this.parent.element.id + '_height', cssClass: 'e-ie-resize-height', template: spanHeight, align: 'Center' });
850
- toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
945
+ toolbarItems.push({ id: id + '_height', cssClass: 'e-ie-resize-height', template: spanHeight, align: 'Center' });
946
+ toolbarItems.push({ id: id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
851
947
  tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
852
- showSpinButton: false, value: isResize ? this.parent.aspectHeight : null,
948
+ showSpinButton: false, value: isResize ? parent.aspectHeight : null,
853
949
  placeholder: isResize ? null : height, format: '###.## px' })
854
950
  });
855
951
  if (!this.isAspectRatio) {
856
- toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
952
+ toolbarItems.push({ id: id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
857
953
  this.isAspectRatio = true;
858
954
  }
859
955
  else {
860
- toolbarItems.push({ id: this.parent.element.id + '_nonaspectratio', prefixIcon: 'e-icons e-unlock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
956
+ toolbarItems.push({ id: id + '_nonaspectratio', prefixIcon: 'e-icons e-unlock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
861
957
  this.isAspectRatio = false;
862
958
  }
863
959
  if (!Browser.isDevice) {
864
- toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
960
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
865
961
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
866
- toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
962
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
867
963
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
868
964
  }
869
965
  return toolbarItems;
870
966
  };
871
967
  ToolbarModule.prototype.initResizeToolbar = function () {
872
968
  var _this = this;
969
+ var parent = this.parent;
970
+ var id = parent.element.id;
873
971
  var leftItem = this.getLeftToolbarItem(false, true);
874
972
  var rightItem = this.getRightToolbarItem();
875
973
  var mainItem = this.getResizeToolbarItem();
@@ -889,16 +987,16 @@ var ToolbarModule = /** @class */ (function () {
889
987
  if (!Browser.isDevice) {
890
988
  _this.renderSaveBtn();
891
989
  }
892
- _this.parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
990
+ parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
893
991
  if (Browser.isDevice) {
894
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar')))) {
992
+ if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(id + '_bottomToolbar')))) {
895
993
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
896
994
  toolbar.refreshOverflow();
897
995
  }
898
996
  }
899
997
  else {
900
998
  _this.createLeftToolbarControls();
901
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
999
+ if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(id + '_toolbar')))) {
902
1000
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
903
1001
  toolbar.refreshOverflow();
904
1002
  }
@@ -906,35 +1004,39 @@ var ToolbarModule = /** @class */ (function () {
906
1004
  }
907
1005
  });
908
1006
  if (Browser.isDevice) {
909
- toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
1007
+ toolbar.appendTo('#' + id + '_bottomToolbar');
910
1008
  }
911
1009
  else {
912
- toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
1010
+ toolbar.appendTo('#' + id + '_toolbar');
913
1011
  }
914
- this.parent.isResize = false;
1012
+ parent.isResize = false;
915
1013
  this.enableDisableTbrBtn();
916
- this.parent.isResize = true;
917
- this.parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
1014
+ parent.isResize = true;
1015
+ parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
918
1016
  };
919
1017
  ToolbarModule.prototype.wireResizeBtnEvents = function () {
920
1018
  var parent = this.parent;
921
- var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
922
- var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
1019
+ var id = parent.element.id;
1020
+ var aspectRatioHeight = parent.element.querySelector('#' + id + '_resizeHeight');
1021
+ var aspectRatioWidth = parent.element.querySelector('#' + id + '_resizeWidth');
923
1022
  if (!isNullOrUndefined(aspectRatioHeight)) {
1023
+ aspectRatioHeight.addEventListener('keydown', this.widthPress.bind(this));
924
1024
  aspectRatioWidth.addEventListener('keyup', this.heightAspectRatio.bind(this));
925
1025
  }
926
1026
  if (!isNullOrUndefined(aspectRatioWidth)) {
1027
+ aspectRatioWidth.addEventListener('keydown', this.heightPress.bind(this));
927
1028
  aspectRatioHeight.addEventListener('keyup', this.widthAspectRatio.bind(this));
928
1029
  }
929
1030
  };
930
1031
  ToolbarModule.prototype.enableDisableTbrBtn = function () {
931
1032
  var parent = this.parent;
1033
+ var id = parent.element.id;
932
1034
  if (!this.preventEnableDisableUr) {
933
1035
  var object = { appliedUndoRedoColl: [] };
934
1036
  parent.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
935
1037
  var undoRedoObj = { undoRedoStep: null };
936
1038
  parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
937
- var undo = parent.element.querySelector('#' + parent.element.id + '_undo');
1039
+ var undo = parent.element.querySelector('#' + id + '_undo');
938
1040
  if (undo && undoRedoObj['undoRedoStep'] === 0) {
939
1041
  undo.classList.add('e-disabled');
940
1042
  undo.parentElement.classList.add('e-overlay');
@@ -943,7 +1045,7 @@ var ToolbarModule = /** @class */ (function () {
943
1045
  undo.classList.remove('e-disabled');
944
1046
  undo.parentElement.classList.remove('e-overlay');
945
1047
  }
946
- var redo = parent.element.querySelector('#' + parent.element.id + '_redo');
1048
+ var redo = parent.element.querySelector('#' + id + '_redo');
947
1049
  if (redo && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
948
1050
  redo.classList.add('e-disabled');
949
1051
  redo.parentElement.classList.add('e-overlay');
@@ -957,7 +1059,7 @@ var ToolbarModule = /** @class */ (function () {
957
1059
  redo.parentElement.classList.remove('e-overlay');
958
1060
  }
959
1061
  }
960
- var zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
1062
+ var zoomIn = document.querySelector('#' + id + '_zoomIn');
961
1063
  if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
962
1064
  zoomIn.classList.add('e-disabled');
963
1065
  zoomIn.parentElement.classList.add('e-overlay');
@@ -966,7 +1068,7 @@ var ToolbarModule = /** @class */ (function () {
966
1068
  zoomIn.classList.remove('e-disabled');
967
1069
  zoomIn.parentElement.classList.remove('e-overlay');
968
1070
  }
969
- var zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
1071
+ var zoomOut = document.querySelector('#' + id + '_zoomOut');
970
1072
  if (zoomOut && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
971
1073
  zoomOut.classList.add('e-disabled');
972
1074
  zoomOut.parentElement.classList.add('e-overlay');
@@ -975,7 +1077,7 @@ var ToolbarModule = /** @class */ (function () {
975
1077
  zoomOut.classList.remove('e-disabled');
976
1078
  zoomOut.parentElement.classList.remove('e-overlay');
977
1079
  }
978
- var frame = document.querySelector('#' + parent.element.id + '_frame');
1080
+ var frame = document.querySelector('#' + id + '_frame');
979
1081
  if (frame && ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop)) {
980
1082
  frame.classList.add('e-disabled');
981
1083
  }
@@ -985,9 +1087,10 @@ var ToolbarModule = /** @class */ (function () {
985
1087
  };
986
1088
  ToolbarModule.prototype.createLeftToolbarControls = function () {
987
1089
  var parent = this.parent;
1090
+ var id = parent.element.id;
988
1091
  if (this.defToolbarItems !== undefined && this.defToolbarItems.length > 0 &&
989
- (document.getElementById(parent.element.id + '_toolbar'))) {
990
- var uploadDiv = document.getElementById(parent.element.id + '_toolbar')
1092
+ (document.getElementById(id + '_toolbar'))) {
1093
+ var uploadDiv = document.getElementById(id + '_toolbar')
991
1094
  .querySelector('.e-image-upload');
992
1095
  if (uploadDiv) {
993
1096
  var uploadElem = uploadDiv.getElementsByTagName('input')[0];
@@ -1003,7 +1106,8 @@ var ToolbarModule = /** @class */ (function () {
1003
1106
  };
1004
1107
  ToolbarModule.prototype.fileSelect = function (inputElement, args) {
1005
1108
  var type = inputElement.files[0].type.split('/')[1];
1006
- if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg' || type === 'svg+xml') {
1109
+ var filesTypes = ['png', 'jpg', 'jpeg', 'svg', 'svg+xml'];
1110
+ if (filesTypes.indexOf(type) > -1) {
1007
1111
  this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
1008
1112
  }
1009
1113
  else {
@@ -1015,6 +1119,7 @@ var ToolbarModule = /** @class */ (function () {
1015
1119
  var parent = this.parent;
1016
1120
  var isCustomized = false;
1017
1121
  var items = [];
1122
+ var id = parent.element.id;
1018
1123
  var defItems = ['Ellipse', 'Arrow', 'Line', 'Rectangle', 'Pen', 'Path', 'Text'];
1019
1124
  if (parent.toolbar) {
1020
1125
  for (var i = 0; i < defItems.length; i++) {
@@ -1050,9 +1155,9 @@ var ToolbarModule = /** @class */ (function () {
1050
1155
  }
1051
1156
  var obj = { freehandDrawSelectedId: null };
1052
1157
  parent.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: obj } });
1053
- var duplicateElement = document.querySelector('#' + parent.element.id + '_duplicate');
1054
- var removeElement = document.querySelector('#' + parent.element.id + '_remove');
1055
- var editTextElement = document.querySelector('#' + parent.element.id + '_editText');
1158
+ var duplicateElement = document.querySelector('#' + id + '_duplicate');
1159
+ var removeElement = document.querySelector('#' + id + '_remove');
1160
+ var editTextElement = document.querySelector('#' + id + '_editText');
1056
1161
  if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
1057
1162
  (isNullOrUndefined(parent.activeObj.pointColl) || (parent.activeObj.pointColl
1058
1163
  && parent.activeObj.pointColl.length === 0)) &&
@@ -1084,7 +1189,7 @@ var ToolbarModule = /** @class */ (function () {
1084
1189
  open: function (args) {
1085
1190
  if (parent.currObjType.isFiltered) {
1086
1191
  parent.okBtn();
1087
- parent.element.querySelector('#' + _this.parent.element.id + '_annotationBtn').click();
1192
+ parent.element.querySelector('#' + id + '_annotationBtn').click();
1088
1193
  }
1089
1194
  if (Browser.isDevice) {
1090
1195
  args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
@@ -1129,19 +1234,13 @@ var ToolbarModule = /** @class */ (function () {
1129
1234
  case 'text':
1130
1235
  _this.currentToolbar = 'text';
1131
1236
  parent.notify('shape', { prop: 'draw-shape-text' });
1132
- // this.setInitialShapeSettings(args);
1133
- // parent.activeObj.textFlip = parent.transform.currFlipState;
1134
- // parent.notify('selection', {prop: 'annotate', value: {shape: args.item.id }});
1135
- // parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: {type: 'text',
1136
- // isApplyBtn: null, isCropping: null, isZooming: null, cType: null}});
1137
1237
  break;
1138
1238
  case 'image':
1139
1239
  _this.currentToolbar = 'shapes';
1140
- parent.element.querySelector('#' + _this.parent.element.id + '_fileUpload').click();
1240
+ parent.element.querySelector('#' + id + '_fileUpload').click();
1141
1241
  break;
1142
1242
  default:
1143
1243
  _this.currentToolbar = 'shapes';
1144
- /// parent.notify('shape', { prop: 'draw-shape', value: {obj: (args.item.id).toLowerCase()}});
1145
1244
  _this.setInitialShapeSettings(args);
1146
1245
  parent.notify('selection', { prop: 'annotate', value: { shape: args.item.id } });
1147
1246
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
@@ -1149,10 +1248,36 @@ var ToolbarModule = /** @class */ (function () {
1149
1248
  break;
1150
1249
  }
1151
1250
  _this.updateToolbarItems();
1251
+ var tempTogglePen = parent.togglePen;
1252
+ if (args.item.id === 'pen') {
1253
+ parent.togglePen = false;
1254
+ }
1255
+ parent.notify('draw', { prop: 'redrawDownScale' });
1256
+ parent.togglePen = tempTogglePen;
1152
1257
  }
1153
1258
  });
1154
1259
  // Render initialized DropDownButton.
1155
- drpDownBtn.appendTo('#' + parent.element.id + '_annotationBtn');
1260
+ drpDownBtn.appendTo('#' + id + '_annotationBtn');
1261
+ };
1262
+ ToolbarModule.prototype.renderStraightenSlider = function () {
1263
+ var parent = this.parent;
1264
+ var id = parent.element.id;
1265
+ if ((isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Straightening') > -1)) &&
1266
+ parent.element.querySelector('#' + id + '_straightenSlider')) {
1267
+ var slider = this.createSlider(-45, 45, parent.cropObj.straighten, 'straighten');
1268
+ slider.appendTo('#' + id + '_straightenSlider');
1269
+ var sliderHandle = slider.element.querySelector('.e-handle');
1270
+ if (sliderHandle && !Browser.isDevice) {
1271
+ sliderHandle.addEventListener('mousedown', function (e) {
1272
+ e.preventDefault();
1273
+ e.stopPropagation();
1274
+ });
1275
+ sliderHandle.addEventListener('touchstart', function (e) {
1276
+ e.preventDefault();
1277
+ e.stopPropagation();
1278
+ });
1279
+ }
1280
+ }
1156
1281
  };
1157
1282
  ToolbarModule.prototype.renderCropBtn = function () {
1158
1283
  var _this = this;
@@ -1178,10 +1303,15 @@ var ToolbarModule = /** @class */ (function () {
1178
1303
  items.push({ text: this.l10n.getConstant('Square'), id: 'square', iconCss: 'e-icons e-square' });
1179
1304
  }
1180
1305
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('RatioSelection') > -1)) {
1306
+ items.push({ text: '2:3', id: '2:3', iconCss: 'e-icons e-custom-f' });
1181
1307
  items.push({ text: '3:2', id: '3:2', iconCss: 'e-icons e-custom-a' });
1308
+ items.push({ text: '3:4', id: '3:4', iconCss: 'e-icons e-custom-g' });
1182
1309
  items.push({ text: '4:3', id: '4:3', iconCss: 'e-icons e-custom-b' });
1310
+ items.push({ text: '4:5', id: '4:5', iconCss: 'e-icons e-custom-h' });
1183
1311
  items.push({ text: '5:4', id: '5:4', iconCss: 'e-icons e-custom-c' });
1312
+ items.push({ text: '5:7', id: '5:7', iconCss: 'e-icons e-custom-i' });
1184
1313
  items.push({ text: '7:5', id: '7:5', iconCss: 'e-icons e-custom-d' });
1314
+ items.push({ text: '9:16', id: '9:16', iconCss: 'e-icons e-custom-j' });
1185
1315
  items.push({ text: '16:9', id: '16:9', iconCss: 'e-icons e-custom-e' });
1186
1316
  }
1187
1317
  var iconCss;
@@ -1208,7 +1338,9 @@ var ToolbarModule = /** @class */ (function () {
1208
1338
  args.element.parentElement.offsetHeight + 'px';
1209
1339
  }
1210
1340
  if (parent.activeObj.shape && parent.activeObj.shape.split('-').length > 1) {
1211
- document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
1341
+ var elem = document.getElementById(parent.activeObj.shape.split('-')[1]);
1342
+ elem.classList.add('e-selected');
1343
+ elem.focus();
1212
1344
  }
1213
1345
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
1214
1346
  },
@@ -1216,10 +1348,10 @@ var ToolbarModule = /** @class */ (function () {
1216
1348
  select: function (args) {
1217
1349
  _this.cropSelect(args);
1218
1350
  drpDownBtn.iconCss = 'e-icons ' + _this.getCurrentShapeIcon('crop-' + args.item.id);
1219
- drpDownBtn.content = parent.toPascalCase(args.item.id);
1351
+ drpDownBtn.content = Browser.isDevice ? null : parent.toPascalCase(args.item.id);
1220
1352
  },
1221
- iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup',
1222
- content: parent.toPascalCase(shape.replace('crop-', ''))
1353
+ iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup e-ie-crop-ddb-popup',
1354
+ content: Browser.isDevice ? null : parent.toPascalCase(shape.replace('crop-', ''))
1223
1355
  });
1224
1356
  drpDownBtn.appendTo('#' + parent.element.id + '_cropBtn');
1225
1357
  };
@@ -1241,11 +1373,11 @@ var ToolbarModule = /** @class */ (function () {
1241
1373
  var drpDownBtn = new DropDownButton({
1242
1374
  open: function (args) {
1243
1375
  if (Browser.isDevice) {
1244
- var ht = args.element.parentElement.offsetHeight;
1245
- args.element.parentElement.style.display = 'none';
1246
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
1247
- ht + 'px';
1248
- args.element.parentElement.style.display = 'block';
1376
+ var elem = args.element.parentElement;
1377
+ var ht = elem.offsetHeight;
1378
+ elem.style.display = 'none';
1379
+ elem.style.top = drpDownBtn.element.getBoundingClientRect().top - ht + 'px';
1380
+ elem.style.display = 'block';
1249
1381
  }
1250
1382
  },
1251
1383
  items: items, select: parent.transformSelect.bind(this),
@@ -1255,107 +1387,127 @@ var ToolbarModule = /** @class */ (function () {
1255
1387
  };
1256
1388
  ToolbarModule.prototype.renderSaveBtn = function () {
1257
1389
  var parent = this.parent;
1390
+ var id = parent.element.id;
1258
1391
  var saveItems = [
1259
1392
  { text: 'JPEG', id: 'jpeg' },
1260
1393
  { text: 'PNG', id: 'png' },
1261
1394
  { text: 'SVG', id: 'svg' }
1262
1395
  ];
1263
- var ddbElem = document.getElementById(parent.element.id + '_saveBtn');
1396
+ var ddbElem = document.getElementById(id + '_saveBtn');
1264
1397
  if (ddbElem) {
1265
1398
  // Initialize the DropDownButton component.
1266
1399
  var saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
1267
1400
  select: function (args) {
1268
1401
  parent.export(args.item.text);
1402
+ parent.isChangesSaved = true;
1403
+ parent.notify('draw', { prop: 'redrawDownScale' });
1269
1404
  }
1270
1405
  });
1271
- saveDrpDownBtn.appendTo('#' + parent.element.id + '_saveBtn');
1406
+ saveDrpDownBtn.appendTo('#' + id + '_saveBtn');
1272
1407
  }
1273
1408
  };
1274
1409
  ToolbarModule.prototype.getCropTransformToolbarItem = function () {
1275
1410
  var parent = this.parent;
1411
+ var id = parent.element.id;
1276
1412
  var toolbarItems = [];
1277
- toolbarItems.push({ id: parent.element.id + '_crop', tooltipText: this.l10n.getConstant('CropSelection'), align: 'Center',
1278
- template: '<button id="' + parent.element.id + '_cropBtn"></button>'
1413
+ toolbarItems.push({ id: id + '_crop', tooltipText: this.l10n.getConstant('CropSelection'), align: 'Center',
1414
+ template: '<button id="' + id + '_cropBtn"></button>'
1279
1415
  });
1280
1416
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1281
1417
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('RotateLeft') > -1))) {
1282
- toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise', tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
1418
+ toolbarItems.push({ id: id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise', tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
1283
1419
  }
1284
1420
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('RotateRight') > -1))) {
1285
- toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise', tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
1421
+ toolbarItems.push({ id: id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise', tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
1286
1422
  }
1287
1423
  if (toolbarItems.length > 2) {
1288
1424
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1289
1425
  }
1290
1426
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('HorizontalFlip') > -1))) {
1291
- toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip', tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
1427
+ toolbarItems.push({ id: id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip', tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
1292
1428
  }
1293
1429
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Transform') > -1 || parent.toolbar.indexOf('VerticalFlip') > -1))) {
1294
- toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip', tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
1430
+ toolbarItems.push({ id: id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip', tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
1431
+ }
1432
+ if ((isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Straightening') > -1)) && !Browser.isDevice) {
1433
+ toolbarItems.push({ align: 'Center', type: 'Separator' });
1434
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && (parent.toolbar.indexOf('Straighten') > -1 || parent.toolbar.indexOf('Straighten') > -1))) {
1435
+ var spanWidth = document.createElement('span');
1436
+ spanWidth.innerHTML = this.l10n.getConstant('Straighten');
1437
+ toolbarItems.push({ id: id + '_straightenSpan', cssClass: 'e-ie-straighten-span', template: spanWidth, align: 'Center' });
1438
+ toolbarItems.push({ id: id + '_straighten',
1439
+ cssClass: 'top-icon e-straighten', tooltipText: this.l10n.getConstant('Straighten'), align: 'Center', type: 'Input',
1440
+ template: '<div id="' + id + '_straightenSlider"></div>' });
1441
+ var straightenSpan = document.createElement('span');
1442
+ straightenSpan.innerHTML = parent.transform.straighten.toString() + '&#176';
1443
+ toolbarItems.push({ id: id + '_straightenSpan', cssClass: 'e-ie-straighten-value-span',
1444
+ template: straightenSpan, align: 'Center' });
1445
+ }
1295
1446
  }
1296
1447
  if (!Browser.isDevice) {
1297
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1448
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1298
1449
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
1299
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1450
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1300
1451
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
1301
1452
  }
1302
1453
  return toolbarItems;
1303
1454
  };
1304
1455
  ToolbarModule.prototype.getShapesToolbarItem = function (items) {
1305
1456
  var parent = this.parent;
1457
+ var id = parent.element.id;
1306
1458
  var toolbarItems = [];
1307
1459
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
1308
- toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
1309
- template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
1460
+ toolbarItems.push({ id: id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
1461
+ template: '<button id="' + id + '_annotationBtn"></button>' });
1310
1462
  }
1311
1463
  if (items.indexOf('fillColor') > -1) {
1312
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_fillcolor',
1464
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_fillcolor',
1313
1465
  cssClass: 'top-icon e-fill', tooltipText: this.l10n.getConstant('FillColor'), align: 'Center', type: 'Input',
1314
- template: '<button id="' + parent.element.id + '_fillColorBtn"></button>' });
1466
+ template: '<button id="' + id + '_fillColorBtn"></button>' });
1315
1467
  }
1316
1468
  if (items.indexOf('strokeColor') > -1) {
1317
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_strokecolor',
1469
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_strokecolor',
1318
1470
  cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
1319
- template: '<button id="' + parent.element.id + '_borderColorBtn"></button>' });
1471
+ template: '<button id="' + id + '_borderColorBtn"></button>' });
1320
1472
  }
1321
1473
  if (items.indexOf('strokeWidth') > -1) {
1322
- toolbarItems.push({ id: parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
1323
- type: 'Input', template: '<button id="' + parent.element.id + '_borderWidthBtn"></button>' });
1474
+ toolbarItems.push({ id: id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
1475
+ type: 'Input', template: '<button id="' + id + '_borderWidthBtn"></button>' });
1324
1476
  }
1325
1477
  if (items.indexOf('start') > -1) {
1326
- toolbarItems.push({ id: parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
1327
- type: 'Input', template: '<button id="' + parent.element.id + '_startBtn"></button>' });
1478
+ toolbarItems.push({ id: id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
1479
+ type: 'Input', template: '<button id="' + id + '_startBtn"></button>' });
1328
1480
  }
1329
1481
  if (items.indexOf('end') > -1) {
1330
- toolbarItems.push({ id: parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
1331
- type: 'Input', template: '<button id="' + parent.element.id + '_endBtn"></button>' });
1482
+ toolbarItems.push({ id: id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
1483
+ type: 'Input', template: '<button id="' + id + '_endBtn"></button>' });
1332
1484
  }
1333
1485
  if (items.indexOf('flip') > -1) {
1334
- toolbarItems.push({ id: parent.element.id + '_rotLeft', prefixIcon: 'e-anti-clock-wise',
1486
+ toolbarItems.push({ id: id + '_rotLeft', prefixIcon: 'e-anti-clock-wise',
1335
1487
  tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
1336
- toolbarItems.push({ id: parent.element.id + '_rotRight', prefixIcon: 'e-clock-wise',
1488
+ toolbarItems.push({ id: id + '_rotRight', prefixIcon: 'e-clock-wise',
1337
1489
  tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
1338
- toolbarItems.push({ id: parent.element.id + '_hFlip', prefixIcon: 'e-horizontal-flip',
1490
+ toolbarItems.push({ id: id + '_hFlip', prefixIcon: 'e-horizontal-flip',
1339
1491
  tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
1340
- toolbarItems.push({ id: parent.element.id + '_vFlip', prefixIcon: 'e-vertical-flip',
1492
+ toolbarItems.push({ id: id + '_vFlip', prefixIcon: 'e-vertical-flip',
1341
1493
  tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
1342
1494
  }
1343
- toolbarItems.push({ align: 'Center', type: 'Separator' });
1344
1495
  if (items.indexOf('transparency') > -1) {
1345
- toolbarItems.push({ id: parent.element.id + '_transparency', prefixIcon: 'e-opacity',
1346
- tooltipText: this.l10n.getConstant('Transparency'), align: 'Center' });
1496
+ toolbarItems.push({ align: 'Center', type: 'Separator' });
1497
+ toolbarItems.push({ id: id + '_transparency', prefixIcon: 'e-opacity',
1498
+ tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
1347
1499
  }
1348
1500
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1349
1501
  if (items.indexOf('duplicate') > -1) {
1350
- toolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
1502
+ toolbarItems.push({ id: id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
1351
1503
  tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center' });
1352
1504
  }
1353
1505
  if (items.indexOf('remove') > -1) {
1354
- toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
1506
+ toolbarItems.push({ id: id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
1355
1507
  tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
1356
1508
  }
1357
1509
  if (items.indexOf('text') > -1) {
1358
- toolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
1510
+ toolbarItems.push({ id: id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
1359
1511
  tooltipText: this.l10n.getConstant('EditText'), align: 'Center' });
1360
1512
  }
1361
1513
  var tempToolbarItems = this.processSubToolbar(items);
@@ -1366,9 +1518,9 @@ var ToolbarModule = /** @class */ (function () {
1366
1518
  var obj = { shape: null };
1367
1519
  parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
1368
1520
  if (obj['shape'] !== 'path') {
1369
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1521
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1370
1522
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
1371
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1523
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1372
1524
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
1373
1525
  }
1374
1526
  }
@@ -1377,6 +1529,7 @@ var ToolbarModule = /** @class */ (function () {
1377
1529
  ToolbarModule.prototype.initCropTransformToolbar = function () {
1378
1530
  var _this = this;
1379
1531
  var parent = this.parent;
1532
+ var id = parent.element.id;
1380
1533
  var leftItem = this.getLeftToolbarItem();
1381
1534
  var rightItem = this.getRightToolbarItem();
1382
1535
  var mainItem = this.getCropTransformToolbarItem();
@@ -1393,13 +1546,14 @@ var ToolbarModule = /** @class */ (function () {
1393
1546
  clicked: this.defToolbarClicked.bind(this),
1394
1547
  created: function () {
1395
1548
  _this.renderCropBtn();
1549
+ _this.renderStraightenSlider();
1396
1550
  _this.wireZoomBtnEvents();
1397
1551
  if (!Browser.isDevice) {
1398
1552
  _this.renderSaveBtn();
1399
1553
  }
1400
1554
  parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1401
1555
  if (Browser.isDevice) {
1402
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
1556
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
1403
1557
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1404
1558
  toolbar.refreshOverflow();
1405
1559
  toolbar.refreshOverflow();
@@ -1408,87 +1562,82 @@ var ToolbarModule = /** @class */ (function () {
1408
1562
  }
1409
1563
  else {
1410
1564
  _this.createLeftToolbarControls();
1411
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1565
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
1412
1566
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1413
1567
  toolbar.refreshOverflow();
1414
1568
  }
1415
1569
  }
1416
- if (document.getElementById(parent.element.id + '_cropBtn')) {
1417
- parent.notify('draw', { prop: 'select', onPropertyChange: false,
1418
- value: { type: document.getElementById(parent.element.id + '_cropBtn').textContent.toLowerCase(),
1419
- startX: null, startY: null, width: null, height: null } });
1570
+ if (document.getElementById(id + '_cropBtn')) {
1571
+ if (!Browser.isDevice) {
1572
+ parent.notify('draw', { prop: 'select', onPropertyChange: false,
1573
+ value: { type: _this.getCropTextContent(document.getElementById(id + '_cropBtn')).toLowerCase(),
1574
+ startX: null, startY: null, width: null, height: null } });
1575
+ }
1420
1576
  }
1421
1577
  }
1422
1578
  });
1423
1579
  if (Browser.isDevice) {
1424
- toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
1580
+ toolbar.appendTo('#' + id + '_bottomToolbar');
1425
1581
  }
1426
1582
  else {
1427
- toolbar.appendTo('#' + parent.element.id + '_toolbar');
1583
+ toolbar.appendTo('#' + id + '_toolbar');
1584
+ }
1585
+ var slider = parent.element.querySelector('#' + id + '_straightenSlider');
1586
+ if ((isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Straightening') > -1))
1587
+ && slider && slider.parentElement.scrollHeight > this.toolbarHeight) {
1588
+ this.toolbarHeight = parent.toolbarHeight = slider.parentElement.scrollHeight;
1428
1589
  }
1590
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1591
+ toolbar.refreshOverflow();
1429
1592
  this.enableDisableTbrBtn();
1430
1593
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
1431
1594
  };
1432
- ToolbarModule.prototype.getCurrentShapeIcon = function (shape) {
1433
- var icon = '';
1434
- switch (shape) {
1435
- case 'rectangle':
1436
- icon = 'e-rectangle';
1437
- break;
1438
- case 'ellipse':
1439
- icon = 'e-circle';
1440
- break;
1441
- case 'line':
1442
- icon = 'e-line';
1443
- break;
1444
- case 'arrow':
1445
- icon = 'e-arrow-right-up';
1446
- break;
1447
- case 'path':
1448
- icon = 'e-critical-path';
1449
- break;
1450
- case 'text':
1451
- icon = 'e-add-text';
1452
- break;
1453
- case 'image':
1454
- icon = 'e-image';
1455
- break;
1456
- case 'pen':
1457
- icon = 'e-free-pen';
1458
- break;
1459
- case 'crop-custom':
1460
- icon = 'e-custom';
1461
- break;
1462
- case 'crop-circle':
1463
- icon = 'e-circle';
1464
- break;
1465
- case 'crop-square':
1466
- icon = 'e-square';
1467
- break;
1468
- case 'crop-3:2':
1469
- icon = 'e-custom-a';
1470
- break;
1471
- case 'crop-4:3':
1472
- icon = 'e-custom-b';
1473
- break;
1474
- case 'crop-5:4':
1475
- icon = 'e-custom-c';
1476
- break;
1477
- case 'crop-7:5':
1478
- icon = 'e-custom-d';
1479
- break;
1480
- case 'crop-16:9':
1481
- icon = 'e-custom-e';
1482
- break;
1483
- default:
1484
- icon = 'e-free-pen';
1485
- break;
1595
+ ToolbarModule.prototype.getCropTextContent = function (elem) {
1596
+ if (elem) {
1597
+ var classToContentMap = { 'e-custom': 'Custom', 'e-circle': 'Circle',
1598
+ 'e-square': 'Square', 'e-custom-a': '3:2', 'e-custom-b': '4:3', 'e-custom-c': '5:4', 'e-custom-d': '7:5',
1599
+ 'e-custom-e': '16:9', 'e-custom-f': '2:3', 'e-custom-g': '3:4', 'e-custom-h': '4:5', 'e-custom-i': '5:7',
1600
+ 'e-custom-j': '9:16',
1601
+ };
1602
+ var classList = elem.children[0].classList;
1603
+ for (var className in classToContentMap) {
1604
+ if (classList.contains(className)) {
1605
+ return classToContentMap[className];
1606
+ }
1607
+ }
1486
1608
  }
1487
- return icon;
1609
+ return '';
1610
+ };
1611
+ ToolbarModule.prototype.getCurrentShapeIcon = function (shape) {
1612
+ var shapeIcons = {
1613
+ rectangle: 'e-rectangle',
1614
+ ellipse: 'e-circle',
1615
+ line: 'e-line',
1616
+ arrow: 'e-arrow-right-up',
1617
+ path: 'e-critical-path',
1618
+ text: 'e-add-text',
1619
+ image: 'e-image',
1620
+ pen: 'e-free-pen',
1621
+ 'crop-custom': 'e-custom',
1622
+ 'crop-circle': 'e-circle',
1623
+ 'crop-square': 'e-square',
1624
+ 'crop-3:2': 'e-custom-a',
1625
+ 'crop-4:3': 'e-custom-b',
1626
+ 'crop-5:4': 'e-custom-c',
1627
+ 'crop-7:5': 'e-custom-d',
1628
+ 'crop-16:9': 'e-custom-e',
1629
+ 'crop-2:3': 'e-custom-f',
1630
+ 'crop-3:4': 'e-custom-g',
1631
+ 'crop-4:5': 'e-custom-h',
1632
+ 'crop-5:7': 'e-custom-i',
1633
+ 'crop-9:16': 'e-custom-j',
1634
+ };
1635
+ return shapeIcons[shape] || 'e-free-pen';
1488
1636
  };
1489
1637
  ToolbarModule.prototype.initShapesToolbarItem = function (items) {
1490
1638
  var _this = this;
1491
1639
  var parent = this.parent;
1640
+ var id = parent.element.id;
1492
1641
  var leftItem = this.getLeftToolbarItem();
1493
1642
  var rightItem = this.getRightToolbarItem();
1494
1643
  var mainItem = this.getShapesToolbarItem(items);
@@ -1517,7 +1666,7 @@ var ToolbarModule = /** @class */ (function () {
1517
1666
  }
1518
1667
  parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1519
1668
  if (Browser.isDevice) {
1520
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
1669
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
1521
1670
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1522
1671
  toolbar.refreshOverflow();
1523
1672
  toolbar.refreshOverflow();
@@ -1526,7 +1675,7 @@ var ToolbarModule = /** @class */ (function () {
1526
1675
  }
1527
1676
  else {
1528
1677
  _this.createLeftToolbarControls();
1529
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1678
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
1530
1679
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1531
1680
  toolbar.refreshOverflow();
1532
1681
  }
@@ -1534,24 +1683,60 @@ var ToolbarModule = /** @class */ (function () {
1534
1683
  }
1535
1684
  });
1536
1685
  if (Browser.isDevice) {
1537
- toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
1686
+ toolbar.appendTo('#' + id + '_bottomToolbar');
1538
1687
  }
1539
1688
  else {
1540
- toolbar.appendTo('#' + parent.element.id + '_toolbar');
1689
+ toolbar.appendTo('#' + id + '_toolbar');
1541
1690
  }
1542
1691
  this.enableDisableTbrBtn();
1543
1692
  };
1693
+ ToolbarModule.prototype.beforeModeSwitch = function (args, inst) {
1694
+ this.popupLeft = args.element.offsetParent.style.left;
1695
+ if (args.mode === 'Picker') {
1696
+ inst.showButtons = true;
1697
+ inst.dataBind();
1698
+ args.element.querySelector('.e-apply').title = this.l10n.getConstant('Apply');
1699
+ args.element.querySelector('.e-cancel').title = this.l10n.getConstant('Cancel');
1700
+ args.element.querySelector('.e-mode-switch-btn').title = this.l10n.getConstant('StandardColors');
1701
+ }
1702
+ else {
1703
+ inst.showButtons = false;
1704
+ inst.dataBind();
1705
+ args.element.querySelector('.e-mode-switch-btn').title = this.l10n.getConstant('MoreColors');
1706
+ }
1707
+ };
1544
1708
  ToolbarModule.prototype.createShapeColor = function (items) {
1709
+ var _this = this;
1545
1710
  var parent = this.parent;
1711
+ var id = parent.element.id;
1546
1712
  if (items.indexOf('fillColor') > -1) {
1547
1713
  parent.element.querySelector('.e-template.e-fill').appendChild(parent.createElement('input', {
1548
- id: parent.element.id + '_shape_fill'
1714
+ id: id + '_shape_fill'
1549
1715
  }));
1550
- var fillColor = new ColorPicker({
1551
- modeSwitcher: false, noColor: true, value: '',
1716
+ var fillColor_1 = new ColorPicker({
1717
+ modeSwitcher: true, noColor: true, value: '', inline: true,
1552
1718
  showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
1719
+ beforeModeSwitch: function (args) { return _this.beforeModeSwitch(args, fillColor_1); },
1720
+ presetColors: {
1721
+ 'custom': ['', '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#2196f3',
1722
+ '#03a9f4', '#00bcd4', '#009688', '#ffeb3b', '#ffffff', '#ffebee', '#fce4ec', '#f3e5f5', '#ede7f6', '#e3f2fd',
1723
+ '#e1f5fe', '#e0f7fa', '#e0f2f1', '#fffde7', '#f2f2f2', '#ffcdd2', '#f8bbd0', '#e1bee7', '#d1c4e9', '#bbdefb',
1724
+ '#b3e5fc', '#b2ebf2', '#b2dfdb', '#fff9c4', '#e6e6e6', '#ef9a9a', '#f48fb1', '#ce93d8', '#b39ddb', '#90caf9',
1725
+ '#81d4fa', '#80deea', '#80cbc4', '#fff59d', '#cccccc', '#e57373', '#f06292', '#ba68c8', '#9575cd', '#64b5f6',
1726
+ '#4fc3f7', '#4dd0e1', '#4db6ac', '#fff176', '#b3b3b3', '#ef5350', '#ec407a', '#ab47bc', '#7e57c2', '#42a5f5',
1727
+ '#29b6f6', '#26c6da', '#26a69a', '#ffee58', '#999999', '#e53935', '#d81b60', '#8e24aa', '#5e35b1', '#1e88e5',
1728
+ '#039be5', '#00acc1', '#00897b', '#fdd835', '#808080', '#d32f2f', '#c2185b', '#7b1fa2', '#512da8', '#1976d2',
1729
+ '#0288d1', '#0097a7', '#00796b', '#fbc02d', '#666666', '#c62828', '#ad1457', '#6a1b9a', '#4527a0', '#1565c0',
1730
+ '#0277bd', '#00838f', '#00695c', '#f9a825', '#4d4d4d', '#b71c1c', '#880e4f', '#4a148c', '#311b92', '#0d47a1',
1731
+ '#01579b', '#006064', '#004d40', '#f57f17']
1732
+ },
1733
+ beforeTileRender: function (args) {
1734
+ if (args.value === '') {
1735
+ args.element.classList.add('e-nocolor-item');
1736
+ }
1737
+ },
1553
1738
  change: function (args) {
1554
- parent.updateFillColor(args.currentValue.hex);
1739
+ parent.updateFillColor(args.value);
1555
1740
  if (args.currentValue.rgba === '') {
1556
1741
  fillDDB_1.element.children[0].classList.add('e-nocolor-item');
1557
1742
  }
@@ -1560,52 +1745,83 @@ var ToolbarModule = /** @class */ (function () {
1560
1745
  fillDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
1561
1746
  }
1562
1747
  fillDDB_1.toggle();
1748
+ },
1749
+ onModeSwitch: function (args) {
1750
+ if (Browser.isDevice) {
1751
+ args.element.parentElement.parentElement.style.left = _this.popupLeft;
1752
+ args.element.parentElement.parentElement.style.top = (fillDDB_1.element.getBoundingClientRect().top - args.element.parentElement.parentElement.offsetHeight) + 'px';
1753
+ }
1754
+ },
1755
+ beforeClose: function () {
1756
+ fillDDB_1.toggle();
1563
1757
  }
1564
- }, '#' + parent.element.id + '_shape_fill');
1758
+ }, '#' + id + '_shape_fill');
1565
1759
  var fillDDB_1 = new DropDownButton({
1566
1760
  open: function (args) {
1761
+ var parenElem = args.element.parentElement;
1567
1762
  if (Browser.isDevice) {
1568
- args.element.parentElement.style.top = fillDDB_1.element.getBoundingClientRect().top -
1569
- args.element.parentElement.offsetHeight + 'px';
1570
- args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
1763
+ parenElem.style.top = fillDDB_1.element.getBoundingClientRect().top -
1764
+ parenElem.offsetHeight + 'px';
1765
+ parenElem.style.left = parent.element.offsetLeft + 'px';
1571
1766
  }
1572
1767
  },
1573
1768
  target: '.e-shape-fill-color',
1574
- iconCss: 'e-dropdownbtn-preview'
1575
- }, '#' + parent.element.id + '_fillColorBtn');
1576
- fillColor.inline = true;
1769
+ iconCss: 'e-dropdownbtn-preview',
1770
+ cssClass: 'e-ie-ddb-popup'
1771
+ }, '#' + id + '_fillColorBtn');
1772
+ fillColor_1.inline = true;
1773
+ fillColor_1.value = fillColor_1.getValue(fillColor_1.value, 'rgba');
1577
1774
  parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
1578
1775
  }
1579
1776
  if (items.indexOf('strokeColor') > -1) {
1580
1777
  parent.element.querySelector('.e-template.e-stroke').appendChild(parent.createElement('input', {
1581
- id: parent.element.id + '_shape_stroke'
1778
+ id: id + '_shape_stroke'
1582
1779
  }));
1583
- var strokeColor = new ColorPicker({
1584
- modeSwitcher: false, noColor: false, value: '#fff',
1780
+ var strokeColor_1 = new ColorPicker({
1781
+ modeSwitcher: true, noColor: false, value: '#fff', inline: true,
1585
1782
  showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
1783
+ beforeModeSwitch: function (args) {
1784
+ _this.popupLeft = args.element.offsetParent.style.left;
1785
+ strokeColor_1.value = parent.activeObj.strokeSettings.strokeColor !== '#fff' ? parent.activeObj.strokeSettings.strokeColor : '#008000ff';
1786
+ _this.beforeModeSwitch(args, strokeColor_1);
1787
+ },
1788
+ presetColors: this.presetColors,
1586
1789
  change: function (args) {
1587
- parent.updateStrokeColor(args.currentValue.hex);
1790
+ parent.updateStrokeColor(args.value);
1588
1791
  strokeDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
1589
1792
  strokeDDB_1.toggle();
1793
+ },
1794
+ onModeSwitch: function (args) {
1795
+ if (Browser.isDevice) {
1796
+ args.element.parentElement.parentElement.style.left = _this.popupLeft;
1797
+ args.element.parentElement.parentElement.style.top = (strokeDDB_1.element.getBoundingClientRect().top - args.element.parentElement.parentElement.offsetHeight) + 'px';
1798
+ }
1799
+ },
1800
+ beforeClose: function () {
1801
+ strokeDDB_1.toggle();
1590
1802
  }
1591
- }, '#' + parent.element.id + '_shape_stroke');
1803
+ }, '#' + id + '_shape_stroke');
1592
1804
  var strokeDDB_1 = new DropDownButton({
1593
1805
  open: function (args) {
1806
+ var parenElem = args.element.parentElement;
1594
1807
  if (Browser.isDevice) {
1595
- args.element.parentElement.style.top = strokeDDB_1.element.getBoundingClientRect().top -
1596
- args.element.parentElement.offsetHeight + 'px';
1597
- args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
1808
+ parenElem.style.top = strokeDDB_1.element.getBoundingClientRect().top -
1809
+ parenElem.offsetHeight + 'px';
1810
+ parenElem.style.left = parent.element.offsetLeft + 'px';
1598
1811
  }
1599
1812
  },
1600
1813
  target: '.e-shape-stroke-color',
1601
- iconCss: 'e-dropdownbtn-preview'
1602
- }, '#' + parent.element.id + '_borderColorBtn');
1603
- strokeColor.inline = true;
1814
+ iconCss: 'e-dropdownbtn-preview',
1815
+ cssClass: 'e-ie-ddb-popup'
1816
+ }, '#' + id + '_borderColorBtn');
1817
+ strokeColor_1.inline = true;
1818
+ strokeColor_1.value = strokeColor_1.getValue(strokeColor_1.value, 'rgba');
1604
1819
  parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview').style.background = '#fff';
1605
1820
  }
1606
1821
  };
1607
1822
  ToolbarModule.prototype.createShapeBtn = function (items) {
1608
1823
  var parent = this.parent;
1824
+ var id = parent.element.id;
1609
1825
  var strokeWidthItems = [
1610
1826
  { id: '1', text: this.l10n.getConstant('XSmall') },
1611
1827
  { id: '2', text: this.l10n.getConstant('Small') },
@@ -1613,8 +1829,18 @@ var ToolbarModule = /** @class */ (function () {
1613
1829
  { id: '4', text: this.l10n.getConstant('Large') },
1614
1830
  { id: '5', text: this.l10n.getConstant('XLarge') }
1615
1831
  ];
1832
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
1833
+ strokeWidthItems = [
1834
+ { id: '1', text: this.l10n.getConstant('NoOutline') },
1835
+ { id: '2', text: this.l10n.getConstant('XSmall') },
1836
+ { id: '3', text: this.l10n.getConstant('Small') },
1837
+ { id: '4', text: this.l10n.getConstant('Medium') },
1838
+ { id: '5', text: this.l10n.getConstant('Large') },
1839
+ { id: '6', text: this.l10n.getConstant('XLarge') }
1840
+ ];
1841
+ }
1616
1842
  if (items.indexOf('strokeWidth') > -1) {
1617
- var strokeWidthBtn = document.getElementById(parent.element.id + '_borderWidthBtn');
1843
+ var strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
1618
1844
  var spanElem_1 = document.createElement('span');
1619
1845
  spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
1620
1846
  spanElem_1.className = 'e-shape-stroke-width';
@@ -1635,27 +1861,28 @@ var ToolbarModule = /** @class */ (function () {
1635
1861
  spanElem_1.textContent = args.item.text;
1636
1862
  parent.updateStrokeWidth(args.item.id);
1637
1863
  if (Browser.isDevice) {
1638
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
1864
+ if (document.getElementById(id + '_bottomToolbar')) {
1639
1865
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1640
- var toolbar_6 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
1641
- toolbar_6.refreshOverflow();
1866
+ var toolbar_7 = getComponent(id + '_bottomToolbar', 'toolbar');
1867
+ toolbar_7.refreshOverflow();
1642
1868
  }
1643
1869
  }
1644
1870
  else {
1645
- if (document.getElementById(parent.element.id + '_toolbar')) {
1871
+ if (document.getElementById(id + '_toolbar')) {
1646
1872
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1647
- var toolbar_7 = getComponent(parent.element.id + '_toolbar', 'toolbar');
1648
- toolbar_7.refreshOverflow();
1873
+ var toolbar_8 = getComponent(id + '_toolbar', 'toolbar');
1874
+ toolbar_8.refreshOverflow();
1649
1875
  }
1650
1876
  }
1651
1877
  }
1652
1878
  });
1653
1879
  // Render initialized DropDownButton.
1654
- drpDownBtn_1.appendTo('#' + parent.element.id + '_borderWidthBtn');
1880
+ drpDownBtn_1.appendTo('#' + id + '_borderWidthBtn');
1655
1881
  }
1656
1882
  };
1657
1883
  ToolbarModule.prototype.createStartBtn = function () {
1658
1884
  var parent = this.parent;
1885
+ var id = parent.element.id;
1659
1886
  var strokeWidthItems = [
1660
1887
  { id: '1', text: this.l10n.getConstant('None') },
1661
1888
  { id: '2', text: this.l10n.getConstant('Bar') },
@@ -1666,7 +1893,7 @@ var ToolbarModule = /** @class */ (function () {
1666
1893
  { id: '7', text: this.l10n.getConstant('Square') },
1667
1894
  { id: '8', text: this.l10n.getConstant('SquareSolid') }
1668
1895
  ];
1669
- var strokeWidthBtn = document.getElementById(parent.element.id + '_startBtn');
1896
+ var strokeWidthBtn = document.getElementById(id + '_startBtn');
1670
1897
  var spanElem = document.createElement('span');
1671
1898
  if (isNullOrUndefined(parent.activeObj.start)) {
1672
1899
  parent.activeObj.start = 'none';
@@ -1692,10 +1919,11 @@ var ToolbarModule = /** @class */ (function () {
1692
1919
  }
1693
1920
  });
1694
1921
  // Render initialized DropDownButton.
1695
- drpDownBtn.appendTo('#' + parent.element.id + '_startBtn');
1922
+ drpDownBtn.appendTo('#' + id + '_startBtn');
1696
1923
  };
1697
1924
  ToolbarModule.prototype.createEndBtn = function () {
1698
1925
  var parent = this.parent;
1926
+ var id = parent.element.id;
1699
1927
  var strokeWidthItems = [
1700
1928
  { id: '1', text: this.l10n.getConstant('None') },
1701
1929
  { id: '2', text: this.l10n.getConstant('Bar') },
@@ -1706,7 +1934,7 @@ var ToolbarModule = /** @class */ (function () {
1706
1934
  { id: '7', text: this.l10n.getConstant('Square') },
1707
1935
  { id: '8', text: this.l10n.getConstant('SquareSolid') }
1708
1936
  ];
1709
- var strokeEndBtn = document.getElementById(parent.element.id + '_endBtn');
1937
+ var strokeEndBtn = document.getElementById(id + '_endBtn');
1710
1938
  var spanElem = document.createElement('span');
1711
1939
  if (isNullOrUndefined(parent.activeObj.end)) {
1712
1940
  parent.activeObj.end = 'arrowSolid';
@@ -1732,74 +1960,90 @@ var ToolbarModule = /** @class */ (function () {
1732
1960
  }
1733
1961
  });
1734
1962
  // Render initialized DropDownButton.
1735
- drpDownBtn.appendTo('#' + parent.element.id + '_endBtn');
1963
+ drpDownBtn.appendTo('#' + id + '_endBtn');
1736
1964
  };
1737
1965
  ToolbarModule.prototype.getTextToolbarItem = function (items) {
1738
1966
  var parent = this.parent;
1967
+ var id = parent.element.id;
1739
1968
  var toolbarItems = [];
1740
1969
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
1741
- toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
1742
- template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
1970
+ toolbarItems.push({ id: id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
1971
+ template: '<button id="' + id + '_annotationBtn"></button>' });
1743
1972
  }
1744
1973
  if (items.indexOf('fontFamily') > -1) {
1745
- toolbarItems.push({ id: parent.element.id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
1974
+ toolbarItems.push({ id: id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
1746
1975
  tooltipText: this.l10n.getConstant('FontFamily'), align: 'Center',
1747
- template: '<button id="' + parent.element.id + '_fontFamilyBtn"></button>' });
1976
+ template: '<button id="' + id + '_fontFamilyBtn"></button>' });
1748
1977
  }
1749
1978
  if (items.indexOf('fontSize') > -1) {
1750
- toolbarItems.push({ id: parent.element.id + '_fontSize', cssClass: 'top-icon e-img-font-size',
1979
+ toolbarItems.push({ id: id + '_fontSize', cssClass: 'top-icon e-img-font-size',
1751
1980
  tooltipText: this.l10n.getConstant('FontSize'), align: 'Center',
1752
- template: '<button id="' + parent.element.id + '_fontSizeBtn"></button>' });
1981
+ template: '<button id="' + id + '_fontSizeBtn"></button>' });
1753
1982
  }
1754
1983
  if (items.indexOf('fontColor') > -1) {
1755
- toolbarItems.push({ cssClass: 'top-icon e-text-font-color', id: parent.element.id + '_text_strokecolor',
1984
+ toolbarItems.push({ cssClass: 'top-icon e-text-font-color', id: id + '_text_strokecolor',
1756
1985
  tooltipText: this.l10n.getConstant('FontColor'), align: 'Center',
1757
- type: 'Input', template: '<button id="' + parent.element.id + '_fontColorBtn"></button>' });
1986
+ type: 'Input', template: '<button id="' + id + '_fontColorBtn"></button>' });
1758
1987
  }
1759
1988
  if (items.indexOf('bold') > -1) {
1760
- toolbarItems.push({ id: parent.element.id + '_bold', prefixIcon: 'e-icons e-bold', cssClass: 'top-icon e-bold',
1989
+ toolbarItems.push({ id: id + '_bold', prefixIcon: 'e-icons e-bold', cssClass: 'top-icon e-bold',
1761
1990
  tooltipText: this.l10n.getConstant('Bold'), align: 'Center' });
1762
1991
  }
1763
1992
  if (items.indexOf('italic') > -1) {
1764
- toolbarItems.push({ id: parent.element.id + '_italic', prefixIcon: 'e-icons e-italic', cssClass: 'top-icon e-italic',
1993
+ toolbarItems.push({ id: id + '_italic', prefixIcon: 'e-icons e-italic', cssClass: 'top-icon e-italic',
1765
1994
  tooltipText: this.l10n.getConstant('Italic'), align: 'Center' });
1766
1995
  }
1996
+ if (items.indexOf('transparency') > -1) {
1997
+ toolbarItems.push({ id: id + '_transparency', prefixIcon: 'e-opacity',
1998
+ tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
1999
+ }
1767
2000
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1768
2001
  if (items.indexOf('duplicate') > -1) {
1769
- toolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
1770
- tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center', disabled: parent.textArea.style.display === 'block' ? true : false });
2002
+ toolbarItems.push({ id: id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
2003
+ tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center', disabled: (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ? true : false });
1771
2004
  }
1772
2005
  if (items.indexOf('remove') > -1) {
1773
- toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
1774
- tooltipText: this.l10n.getConstant('Remove'), align: 'Center', disabled: parent.textArea.style.display === 'block' ? true : false });
2006
+ toolbarItems.push({ id: id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
2007
+ tooltipText: this.l10n.getConstant('Remove'), align: 'Center', disabled: (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ? true : false });
1775
2008
  }
1776
2009
  if (items.indexOf('text') > -1) {
1777
- toolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
1778
- tooltipText: this.l10n.getConstant('EditText'), align: 'Center', disabled: parent.textArea.style.display === 'block' ? true : false });
2010
+ toolbarItems.push({ id: id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
2011
+ tooltipText: this.l10n.getConstant('EditText'), align: 'Center', disabled: (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ? true : false });
1779
2012
  }
1780
2013
  var tempToolbarItems = this.processSubToolbar(items);
1781
2014
  for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
1782
2015
  toolbarItems.push(tempToolbarItems[i]);
1783
2016
  }
1784
2017
  if (!Browser.isDevice) {
1785
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
2018
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1786
2019
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
1787
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
2020
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1788
2021
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
1789
2022
  }
1790
2023
  return toolbarItems;
1791
2024
  };
1792
2025
  ToolbarModule.prototype.getFontFamilyItems = function () {
1793
- if (Browser.isDevice) {
1794
- return [{ id: 'arial', text: 'ABC' }, { id: 'calibri', text: 'ABC' }, { id: 'georgia', text: 'ABC' },
1795
- { id: 'roboto', text: 'ABC' }, { id: 'tahoma', text: 'ABC' }];
2026
+ var parent = this.parent;
2027
+ var items = [];
2028
+ if (parent.fontFamily && parent.fontFamily.items && parent.fontFamily.items.length > 0) {
2029
+ items = parent.fontFamily.items;
1796
2030
  }
1797
- return [{ id: 'arial', text: 'Arial' }, { id: 'calibri', text: 'Calibri' }, { id: 'georgia', text: 'Georgia' },
1798
- { id: 'roboto', text: 'Roboto' }, { id: 'tahoma', text: 'Tahoma' }];
2031
+ else {
2032
+ if (Browser.isDevice) {
2033
+ items = [{ id: 'arial', text: 'ABC' }, { id: 'calibri', text: 'ABC' }, { id: 'georgia', text: 'ABC' },
2034
+ { id: 'roboto', text: 'ABC' }, { id: 'tahoma', text: 'ABC' }];
2035
+ }
2036
+ else {
2037
+ items = [{ id: 'arial', text: 'Arial' }, { id: 'calibri', text: 'Calibri' }, { id: 'georgia', text: 'Georgia' },
2038
+ { id: 'roboto', text: 'Roboto' }, { id: 'tahoma', text: 'Tahoma' }];
2039
+ }
2040
+ }
2041
+ return items;
1799
2042
  };
1800
2043
  ToolbarModule.prototype.initTextToolbarItem = function (items) {
1801
2044
  var _this = this;
1802
2045
  var parent = this.parent;
2046
+ var id = parent.element.id;
1803
2047
  var leftItem = this.getLeftToolbarItem();
1804
2048
  var rightItem = this.getRightToolbarItem();
1805
2049
  var mainItem = this.getTextToolbarItem(items);
@@ -1824,7 +2068,7 @@ var ToolbarModule = /** @class */ (function () {
1824
2068
  }
1825
2069
  parent.trigger('toolbarCreated', { toolbarType: 'text' });
1826
2070
  if (Browser.isDevice) {
1827
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
2071
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
1828
2072
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1829
2073
  toolbar.refreshOverflow();
1830
2074
  toolbar.refreshOverflow();
@@ -1833,7 +2077,7 @@ var ToolbarModule = /** @class */ (function () {
1833
2077
  }
1834
2078
  else {
1835
2079
  _this.createLeftToolbarControls();
1836
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2080
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
1837
2081
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1838
2082
  toolbar.refreshOverflow();
1839
2083
  }
@@ -1841,55 +2085,76 @@ var ToolbarModule = /** @class */ (function () {
1841
2085
  }
1842
2086
  });
1843
2087
  if (Browser.isDevice) {
1844
- toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
2088
+ toolbar.appendTo('#' + id + '_bottomToolbar');
1845
2089
  }
1846
2090
  else {
1847
- toolbar.appendTo('#' + parent.element.id + '_toolbar');
2091
+ toolbar.appendTo('#' + id + '_toolbar');
1848
2092
  }
1849
2093
  this.enableDisableTbrBtn();
1850
2094
  };
1851
2095
  ToolbarModule.prototype.createTextColor = function (items) {
2096
+ var _this = this;
1852
2097
  var parent = this.parent;
2098
+ var id = parent.element.id;
1853
2099
  if (items.indexOf('fontColor') > -1 && parent.element.querySelector('.e-template.e-text-font-color')) {
1854
2100
  parent.element.querySelector('.e-template.e-text-font-color').appendChild(parent.createElement('input', {
1855
- id: parent.element.id + '_text_font'
2101
+ id: id + '_text_font'
1856
2102
  }));
1857
- var fontColor = new ColorPicker({
1858
- modeSwitcher: false, value: '#fff',
2103
+ var fontColor_1 = new ColorPicker({
2104
+ modeSwitcher: true, noColor: false, value: '#fff', inline: true,
1859
2105
  showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
2106
+ beforeModeSwitch: function (args) {
2107
+ _this.popupLeft = args.element.offsetParent.style.left;
2108
+ fontColor_1.value = parent.activeObj.strokeSettings.strokeColor !== '#fff' ? parent.activeObj.strokeSettings.strokeColor : '#008000ff';
2109
+ _this.beforeModeSwitch(args, fontColor_1);
2110
+ },
2111
+ presetColors: this.presetColors,
1860
2112
  change: function (args) {
1861
- parent.updateFontColor(args.currentValue.hex);
2113
+ parent.updateFontColor(args.value);
1862
2114
  strokeDDB_2.element.children[0].style.backgroundColor = args.currentValue.rgba;
1863
2115
  strokeDDB_2.toggle();
2116
+ },
2117
+ onModeSwitch: function (args) {
2118
+ if (Browser.isDevice) {
2119
+ args.element.parentElement.parentElement.style.left = _this.popupLeft;
2120
+ args.element.parentElement.parentElement.style.top = (strokeDDB_2.element.getBoundingClientRect().top - args.element.parentElement.parentElement.offsetHeight) + 'px';
2121
+ }
2122
+ },
2123
+ beforeClose: function () {
2124
+ strokeDDB_2.toggle();
1864
2125
  }
1865
- }, '#' + parent.element.id + '_text_font');
2126
+ }, '#' + id + '_text_font');
1866
2127
  var strokeDDB_2 = new DropDownButton({
1867
2128
  open: function (args) {
2129
+ var parenElem = args.element.parentElement;
1868
2130
  if (Browser.isDevice) {
1869
- args.element.parentElement.style.top = strokeDDB_2.element.getBoundingClientRect().top -
1870
- args.element.parentElement.offsetHeight + 'px';
1871
- args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
2131
+ parenElem.style.top = strokeDDB_2.element.getBoundingClientRect().top -
2132
+ parenElem.offsetHeight + 'px';
2133
+ parenElem.style.left = parent.element.offsetLeft + 'px';
1872
2134
  }
1873
2135
  },
1874
2136
  target: '.e-text-fontt-color',
1875
- iconCss: 'e-dropdownbtn-preview'
1876
- }, '#' + parent.element.id + '_fontColorBtn');
1877
- fontColor.inline = true;
2137
+ iconCss: 'e-dropdownbtn-preview',
2138
+ cssClass: 'e-ie-ddb-popup'
2139
+ }, '#' + id + '_fontColorBtn');
2140
+ fontColor_1.inline = true;
2141
+ fontColor_1.value = fontColor_1.getValue(fontColor_1.value, 'rgba');
1878
2142
  parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview').style.background
1879
2143
  = '#fff';
1880
2144
  }
1881
2145
  };
1882
2146
  ToolbarModule.prototype.createTextBtn = function (items) {
1883
2147
  var parent = this.parent;
2148
+ var id = parent.element.id;
1884
2149
  if (items.indexOf('fontFamily') > -1) {
1885
- var fontNameBtn = document.getElementById(parent.element.id + '_fontFamilyBtn');
2150
+ var fontNameBtn = document.getElementById(id + '_fontFamilyBtn');
1886
2151
  var spanElem_2 = document.createElement('span');
1887
2152
  if (Browser.isDevice) {
1888
2153
  spanElem_2.innerHTML = 'ABC';
1889
- spanElem_2.setAttribute('style', 'font-family: arial');
2154
+ spanElem_2.setAttribute('style', 'font-family: ' + parent.fontFamily.default.toLowerCase() + "'");
1890
2155
  }
1891
2156
  else {
1892
- spanElem_2.innerHTML = 'Arial';
2157
+ spanElem_2.innerHTML = parent.fontFamily.default;
1893
2158
  }
1894
2159
  spanElem_2.className = 'e-text-font-family';
1895
2160
  if (fontNameBtn) {
@@ -1907,7 +2172,7 @@ var ToolbarModule = /** @class */ (function () {
1907
2172
  args.element.parentElement.offsetHeight + 'px';
1908
2173
  }
1909
2174
  var fontFamily;
1910
- if (parent.textArea.style.display === 'block') {
2175
+ if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
1911
2176
  fontFamily = parent.textArea.style.fontFamily;
1912
2177
  }
1913
2178
  else {
@@ -1924,10 +2189,10 @@ var ToolbarModule = /** @class */ (function () {
1924
2189
  parent.updateFontFamily(args.item.id);
1925
2190
  }
1926
2191
  });
1927
- fontFamilyBtn_1.appendTo('#' + parent.element.id + '_fontFamilyBtn');
2192
+ fontFamilyBtn_1.appendTo('#' + id + '_fontFamilyBtn');
1928
2193
  }
1929
2194
  if (items.indexOf('fontSize') > -1) {
1930
- var fontSizeBtnElem = document.getElementById(parent.element.id + '_fontSizeBtn');
2195
+ var fontSizeBtnElem = document.getElementById(id + '_fontSizeBtn');
1931
2196
  var fontSizeSpanElem_1 = document.createElement('span');
1932
2197
  var fontSizes = parent.getFontSizes();
1933
2198
  fontSizeSpanElem_1.innerHTML = fontSizes[0].text;
@@ -1949,11 +2214,12 @@ var ToolbarModule = /** @class */ (function () {
1949
2214
  parent.updateFontSize(args.item.text);
1950
2215
  }
1951
2216
  });
1952
- fontSizeBtn_1.appendTo('#' + parent.element.id + '_fontSizeBtn');
2217
+ fontSizeBtn_1.appendTo('#' + id + '_fontSizeBtn');
1953
2218
  }
1954
2219
  };
1955
2220
  ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType) {
1956
2221
  var parent = this.parent;
2222
+ var id = parent.element.id;
1957
2223
  if (!parent.isImageLoaded || parent.isCropToolbar) {
1958
2224
  return;
1959
2225
  }
@@ -1962,33 +2228,38 @@ var ToolbarModule = /** @class */ (function () {
1962
2228
  var aspectIcon;
1963
2229
  var nonAspectIcon;
1964
2230
  if (type !== 'filter' && type !== 'color') {
1965
- if (document.getElementById(parent.element.id + '_customizeWrapper') &&
1966
- (getComponent(document.getElementById(parent.element.id + '_customizeWrapper'), 'toolbar')) && this.defToolbarItems.length > 0) {
1967
- getComponent(document.getElementById(parent.element.id + '_customizeWrapper'), 'toolbar').destroy();
1968
- document.getElementById(parent.element.id + '_customizeWrapper').innerHTML = '';
2231
+ var toolbarElement = document.getElementById(id + '_toolbar');
2232
+ var cusWrapper = document.getElementById(id + '_customizeWrapper');
2233
+ var bottomToolbar = document.getElementById(id + '_bottomToolbar');
2234
+ if (cusWrapper && (getComponent(cusWrapper, 'toolbar')) && this.defToolbarItems.length > 0) {
2235
+ getComponent(cusWrapper, 'toolbar').destroy();
2236
+ cusWrapper.innerHTML = '';
1969
2237
  }
1970
- if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
1971
- getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
1972
- document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
2238
+ if (toolbarElement && this.defToolbarItems.length > 0) {
2239
+ getComponent(toolbarElement, 'toolbar').destroy();
2240
+ toolbarElement.innerHTML = '';
1973
2241
  }
1974
- if (document.getElementById(parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
1975
- if (document.getElementById(parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
1976
- getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
1977
- document.getElementById(parent.element.id + '_bottomToolbar').innerHTML = '';
2242
+ if (bottomToolbar && this.defToolbarItems.length > 0) {
2243
+ if (bottomToolbar.className.indexOf('e-control') > -1) {
2244
+ getComponent(bottomToolbar, 'toolbar').destroy();
2245
+ bottomToolbar.innerHTML = '';
1978
2246
  }
1979
2247
  }
1980
2248
  }
1981
2249
  this.refreshSlider();
2250
+ if (document.querySelector('.e-slider-tooltip')) {
2251
+ document.querySelector('.e-slider-tooltip').remove();
2252
+ }
1982
2253
  this.isFrameToolbar = false;
1983
2254
  parent.isCropTab = false;
1984
2255
  switch (type) {
1985
2256
  case 'main':
1986
2257
  if (Browser.isDevice) {
1987
2258
  if (isCropping) {
1988
- this.initMainToolbar(false, true, true);
2259
+ this.initMainToolbar(false, true, true, false, false, true);
1989
2260
  }
1990
2261
  else {
1991
- this.initMainToolbar(false, true, null);
2262
+ this.initMainToolbar(false, true, null, false, false, true);
1992
2263
  }
1993
2264
  }
1994
2265
  else if (!Browser.isDevice || isZooming) {
@@ -2034,7 +2305,7 @@ var ToolbarModule = /** @class */ (function () {
2034
2305
  if (Browser.isDevice) {
2035
2306
  this.initMainToolbar(false, true, true);
2036
2307
  }
2037
- args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove'];
2308
+ args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove', 'transparency'];
2038
2309
  parent.trigger('toolbarUpdating', args);
2039
2310
  this.initPenToolbarItem(args.toolbarItems);
2040
2311
  break;
@@ -2048,13 +2319,17 @@ var ToolbarModule = /** @class */ (function () {
2048
2319
  this.updateContextualToolbar(type);
2049
2320
  break;
2050
2321
  case 'resize':
2322
+ if (parent.isCircleCrop || (parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle')) {
2323
+ parent.aspectHeight = parent.aspectWidth;
2324
+ this.isAspectRatio = false;
2325
+ }
2051
2326
  this.initResizeToolbar();
2052
2327
  if (Browser.isDevice) {
2053
2328
  this.initMainToolbar(false, true, true, true);
2054
2329
  }
2055
- aspectIcon = parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
2056
- nonAspectIcon = parent.element.querySelector('#' + this.parent.element.id + '_nonaspectratio');
2057
- if (this.parent.aspectWidth && this.parent.aspectHeight) {
2330
+ aspectIcon = parent.element.querySelector('#' + id + '_aspectratio');
2331
+ nonAspectIcon = parent.element.querySelector('#' + id + '_nonaspectratio');
2332
+ if (parent.aspectWidth && parent.aspectHeight) {
2058
2333
  if (nonAspectIcon) {
2059
2334
  parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
2060
2335
  }
@@ -2074,6 +2349,9 @@ var ToolbarModule = /** @class */ (function () {
2074
2349
  }
2075
2350
  parent.updateCropTransformItems();
2076
2351
  this.initCropTransformToolbar();
2352
+ if (Browser.isDevice) {
2353
+ this.updateContextualToolbar('color', 'straighten', true);
2354
+ }
2077
2355
  break;
2078
2356
  case 'frame':
2079
2357
  this.isFrameToolbar = true;
@@ -2084,8 +2362,9 @@ var ToolbarModule = /** @class */ (function () {
2084
2362
  else {
2085
2363
  this.initMainToolbar(true, null, null, false, true);
2086
2364
  }
2087
- if (parent.element.querySelector('#' + parent.element.id + '_' + parent.frameObj.type)) {
2088
- parent.element.querySelector('#' + parent.element.id + '_' + parent.frameObj.type).classList.add('e-selected-btn');
2365
+ var frameElem = parent.element.querySelector('#' + id + '_' + parent.frameObj.type);
2366
+ if (frameElem) {
2367
+ frameElem.classList.add('e-selected-btn');
2089
2368
  }
2090
2369
  if (parent.frameObj.type !== 'none') {
2091
2370
  this.updateContextualToolbar(type, cType);
@@ -2096,10 +2375,23 @@ var ToolbarModule = /** @class */ (function () {
2096
2375
  this.currToolbar = type;
2097
2376
  this.refreshDropDownBtn(isCropping);
2098
2377
  };
2378
+ ToolbarModule.prototype.performCropTransformClick = function () {
2379
+ var parent = this.parent;
2380
+ parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
2381
+ parent.tempStraighten = parent.transform.straighten;
2382
+ if (parent.currObjType.isFiltered) {
2383
+ parent.okBtn();
2384
+ }
2385
+ parent.isStraightening = true;
2386
+ this.refreshToolbar('croptransform');
2387
+ parent.notify('draw', { prop: 'setDestForStraighten' });
2388
+ parent.notify('draw', { prop: 'setTempDestForStraighten' });
2389
+ };
2099
2390
  ToolbarModule.prototype.getAdjustmentToolbarItem = function () {
2100
2391
  var toolbarItems = [];
2101
2392
  var parent = this.parent;
2102
2393
  var isCustomized = false;
2394
+ var id = parent.element.id;
2103
2395
  var defItems = ['Brightness', 'Contrast', 'Hue', 'Saturation', 'Exposure', 'Opacity', 'Blur'];
2104
2396
  if (parent.toolbar) {
2105
2397
  for (var i = 0; i < defItems.length; i++) {
@@ -2110,31 +2402,31 @@ var ToolbarModule = /** @class */ (function () {
2110
2402
  }
2111
2403
  }
2112
2404
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Brightness') > -1)) {
2113
- toolbarItems.push({ id: parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
2405
+ toolbarItems.push({ id: id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
2114
2406
  tooltipText: this.l10n.getConstant('Brightness'), align: 'Center' });
2115
2407
  }
2116
2408
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Contrast') > -1)) {
2117
- toolbarItems.push({ id: parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
2409
+ toolbarItems.push({ id: id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
2118
2410
  tooltipText: this.l10n.getConstant('Contrast'), align: 'Center' });
2119
2411
  }
2120
2412
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Hue') > -1)) {
2121
- toolbarItems.push({ id: parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
2413
+ toolbarItems.push({ id: id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
2122
2414
  tooltipText: this.l10n.getConstant('Hue'), align: 'Center' });
2123
2415
  }
2124
2416
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Saturation') > -1)) {
2125
- toolbarItems.push({ id: parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
2417
+ toolbarItems.push({ id: id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
2126
2418
  tooltipText: this.l10n.getConstant('Saturation'), align: 'Center' });
2127
2419
  }
2128
2420
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Exposure') > -1)) {
2129
- toolbarItems.push({ id: parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
2421
+ toolbarItems.push({ id: id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
2130
2422
  tooltipText: this.l10n.getConstant('Exposure'), align: 'Center' });
2131
2423
  }
2132
2424
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Opacity') > -1)) {
2133
- toolbarItems.push({ id: parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
2425
+ toolbarItems.push({ id: id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
2134
2426
  tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
2135
2427
  }
2136
2428
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Blur') > -1)) {
2137
- toolbarItems.push({ id: parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
2429
+ toolbarItems.push({ id: id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
2138
2430
  tooltipText: this.l10n.getConstant('Blur'), align: 'Center' });
2139
2431
  }
2140
2432
  var tempToolbarItems = this.processToolbar('center');
@@ -2142,39 +2434,40 @@ var ToolbarModule = /** @class */ (function () {
2142
2434
  toolbarItems.push(tempToolbarItems[i]);
2143
2435
  }
2144
2436
  if (!Browser.isDevice) {
2145
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
2437
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
2146
2438
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
2147
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
2439
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
2148
2440
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
2149
2441
  }
2150
2442
  return toolbarItems;
2151
2443
  };
2152
2444
  ToolbarModule.prototype.getFrameToolbarItem = function () {
2153
2445
  var parent = this.parent;
2446
+ var id = parent.element.id;
2154
2447
  var toolbarItems = [];
2155
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_frameColor',
2448
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_frameColor',
2156
2449
  cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('Color'), align: 'Center', type: 'Input',
2157
- template: '<span>' + this.l10n.getConstant('Color') + '</span><button id="' + parent.element.id + '_frameColorBtn"></button>' });
2158
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_frameGradient',
2450
+ template: '<span>' + this.l10n.getConstant('Color') + '</span><button id="' + id + '_frameColorBtn"></button>' });
2451
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_frameGradient',
2159
2452
  cssClass: 'top-icon e-frame-stroke', tooltipText: this.l10n.getConstant('GradientColor'), align: 'Center', type: 'Input',
2160
- template: '<span>' + this.l10n.getConstant('GradientColor') + '</span><button id="' + parent.element.id + '_frameGradientColorBtn"></button>' });
2161
- toolbarItems.push({ id: parent.element.id + '_frameSize', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Size'), align: 'Center',
2162
- type: 'Input', template: '<span>' + this.l10n.getConstant('Size') + '</span><button id="' + parent.element.id + '_frameSizeBtn"></button>' });
2453
+ template: '<span>' + this.l10n.getConstant('GradientColor') + '</span><button id="' + id + '_frameGradientColorBtn"></button>' });
2454
+ toolbarItems.push({ id: id + '_frameSize', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Size'), align: 'Center',
2455
+ type: 'Input', template: '<span>' + this.l10n.getConstant('Size') + '</span><button id="' + id + '_frameSizeBtn"></button>' });
2163
2456
  if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset' || parent.frameObj.type === 'hook') {
2164
- toolbarItems.push({ id: parent.element.id + '_frameInset', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Inset'), align: 'Center',
2165
- type: 'Input', template: '<span>' + this.l10n.getConstant('Inset') + '</span><button id="' + parent.element.id + '_frameInsetBtn"></button>' });
2457
+ toolbarItems.push({ id: id + '_frameInset', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Inset'), align: 'Center',
2458
+ type: 'Input', template: '<span>' + this.l10n.getConstant('Inset') + '</span><button id="' + id + '_frameInsetBtn"></button>' });
2166
2459
  }
2167
2460
  if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset') {
2168
- toolbarItems.push({ id: parent.element.id + '_frameOffset', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Offset'), align: 'Center',
2169
- type: 'Input', template: '<span>' + this.l10n.getConstant('Offset') + '</span><button id="' + parent.element.id + '_frameOffsetBtn"></button>' });
2461
+ toolbarItems.push({ id: id + '_frameOffset', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Offset'), align: 'Center',
2462
+ type: 'Input', template: '<span>' + this.l10n.getConstant('Offset') + '</span><button id="' + id + '_frameOffsetBtn"></button>' });
2170
2463
  }
2171
2464
  if (parent.frameObj.type === 'line') {
2172
- toolbarItems.push({ id: parent.element.id + '_frameRadius', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Radius'), align: 'Center',
2173
- type: 'Input', template: '<span>' + this.l10n.getConstant('Radius') + '</span><button id="' + parent.element.id + '_frameRadiusBtn"></button>' });
2174
- toolbarItems.push({ id: parent.element.id + '_frameAmount', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Amount'), align: 'Center',
2175
- type: 'Input', template: '<span>' + this.l10n.getConstant('Amount') + '</span><button id="' + parent.element.id + '_frameAmountBtn"></button>' });
2176
- toolbarItems.push({ id: parent.element.id + '_frameBorder', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Border'), align: 'Center',
2177
- type: 'Input', template: '<span>' + this.l10n.getConstant('Border') + '</span><button id="' + parent.element.id + '_frameBorderBtn"></button>' });
2465
+ toolbarItems.push({ id: id + '_frameRadius', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Radius'), align: 'Center',
2466
+ type: 'Input', template: '<span>' + this.l10n.getConstant('Radius') + '</span><button id="' + id + '_frameRadiusBtn"></button>' });
2467
+ toolbarItems.push({ id: id + '_frameAmount', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Amount'), align: 'Center',
2468
+ type: 'Input', template: '<span>' + this.l10n.getConstant('Amount') + '</span><button id="' + id + '_frameAmountBtn"></button>' });
2469
+ toolbarItems.push({ id: id + '_frameBorder', cssClass: 'top-icon e-size', tooltipText: this.l10n.getConstant('Border'), align: 'Center',
2470
+ type: 'Input', template: '<span>' + this.l10n.getConstant('Border') + '</span><button id="' + id + '_frameBorderBtn"></button>' });
2178
2471
  }
2179
2472
  return toolbarItems;
2180
2473
  };
@@ -2182,6 +2475,7 @@ var ToolbarModule = /** @class */ (function () {
2182
2475
  var toolbarItems = [];
2183
2476
  var parent = this.parent;
2184
2477
  var isCustomized = false;
2478
+ var id = parent.element.id;
2185
2479
  var defItems = ['Default', 'Chrome', 'Cold', 'Warm', 'Grayscale', 'Sepia', 'Invert'];
2186
2480
  if (parent.toolbar) {
2187
2481
  for (var i = 0; i < defItems.length; i++) {
@@ -2192,39 +2486,39 @@ var ToolbarModule = /** @class */ (function () {
2192
2486
  }
2193
2487
  }
2194
2488
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
2195
- toolbarItems.push({ id: parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2489
+ toolbarItems.push({ id: id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2196
2490
  tooltipText: this.l10n.getConstant('Default'), align: 'Center',
2197
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
2491
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
2198
2492
  }
2199
2493
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
2200
- toolbarItems.push({ id: parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2494
+ toolbarItems.push({ id: id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2201
2495
  tooltipText: this.l10n.getConstant('Chrome'), align: 'Center',
2202
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_chromeCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Chrome') + '</span></div></div>' });
2496
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_chromeCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Chrome') + '</span></div></div>' });
2203
2497
  }
2204
2498
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Cold') > -1)) {
2205
- toolbarItems.push({ id: parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2499
+ toolbarItems.push({ id: id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2206
2500
  tooltipText: this.l10n.getConstant('Cold'), align: 'Center',
2207
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_coldCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Cold') + '</span></div></div>' });
2501
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_coldCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Cold') + '</span></div></div>' });
2208
2502
  }
2209
2503
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Warm') > -1)) {
2210
- toolbarItems.push({ id: parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2504
+ toolbarItems.push({ id: id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2211
2505
  tooltipText: this.l10n.getConstant('Warm'), align: 'Center',
2212
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_warmCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Warm') + '</span></div></div>' });
2506
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_warmCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Warm') + '</span></div></div>' });
2213
2507
  }
2214
2508
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Grayscale') > -1)) {
2215
- toolbarItems.push({ id: parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2509
+ toolbarItems.push({ id: id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2216
2510
  tooltipText: this.l10n.getConstant('Grayscale'), align: 'Center',
2217
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_grayscaleCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Grayscale') + '</span></div></div>' });
2511
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_grayscaleCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Grayscale') + '</span></div></div>' });
2218
2512
  }
2219
2513
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Sepia') > -1)) {
2220
- toolbarItems.push({ id: parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2514
+ toolbarItems.push({ id: id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2221
2515
  tooltipText: this.l10n.getConstant('Sepia'), align: 'Center',
2222
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_sepiaCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Sepia') + '</span></div></div>' });
2516
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_sepiaCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Sepia') + '</span></div></div>' });
2223
2517
  }
2224
2518
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Invert') > -1)) {
2225
- toolbarItems.push({ id: parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2519
+ toolbarItems.push({ id: id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
2226
2520
  tooltipText: this.l10n.getConstant('Invert'), align: 'Center',
2227
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_invertCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Invert') + '</span></div></div>' });
2521
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_invertCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Invert') + '</span></div></div>' });
2228
2522
  }
2229
2523
  var tempToolbarItems = this.processToolbar('center');
2230
2524
  for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
@@ -2234,25 +2528,26 @@ var ToolbarModule = /** @class */ (function () {
2234
2528
  };
2235
2529
  ToolbarModule.prototype.getPenToolbarItem = function (items) {
2236
2530
  var parent = this.parent;
2531
+ var id = parent.element.id;
2237
2532
  var toolbarItems = [];
2238
2533
  if (isNullOrUndefined(parent.toolbar) || parent.toolbar) {
2239
- toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
2240
- template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
2534
+ toolbarItems.push({ id: id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
2535
+ template: '<button id="' + id + '_annotationBtn"></button>' });
2241
2536
  }
2242
2537
  if (items.indexOf('strokeColor') > -1) {
2243
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_pen_strokecolor',
2538
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokecolor',
2244
2539
  cssClass: 'top-icon e-pen-stroke-color',
2245
2540
  tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
2246
- template: '<button id="' + parent.element.id + '_penColorBtn"></button>' });
2541
+ template: '<button id="' + id + '_penColorBtn"></button>' });
2247
2542
  }
2248
2543
  if (items.indexOf('strokeWidth') > -1) {
2249
2544
  toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
2250
2545
  tooltipText: this.l10n.getConstant('StrokeWidth'),
2251
- align: 'Center', type: 'Input', template: '<button id="' + parent.element.id + '_penStrokeWidth"></button>' });
2546
+ align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
2252
2547
  }
2253
2548
  toolbarItems.push({ align: 'Center', type: 'Separator' });
2254
2549
  if (items.indexOf('remove') > -1) {
2255
- toolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
2550
+ toolbarItems.push({ id: id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
2256
2551
  tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
2257
2552
  }
2258
2553
  var tempToolbarItems = this.processSubToolbar(items);
@@ -2260,9 +2555,9 @@ var ToolbarModule = /** @class */ (function () {
2260
2555
  toolbarItems.push(tempToolbarItems[i]);
2261
2556
  }
2262
2557
  if (!Browser.isDevice) {
2263
- toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
2558
+ toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
2264
2559
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
2265
- toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
2560
+ toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
2266
2561
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
2267
2562
  }
2268
2563
  return toolbarItems;
@@ -2270,6 +2565,7 @@ var ToolbarModule = /** @class */ (function () {
2270
2565
  ToolbarModule.prototype.initPenToolbarItem = function (items) {
2271
2566
  var _this = this;
2272
2567
  var parent = this.parent;
2568
+ var id = parent.element.id;
2273
2569
  var leftItem = this.getLeftToolbarItem();
2274
2570
  var rightItem = this.getRightToolbarItem();
2275
2571
  var mainItem = this.getPenToolbarItem(items);
@@ -2294,7 +2590,7 @@ var ToolbarModule = /** @class */ (function () {
2294
2590
  }
2295
2591
  parent.trigger('toolbarCreated', { toolbarType: 'pen' });
2296
2592
  if (Browser.isDevice) {
2297
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2593
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
2298
2594
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2299
2595
  toolbar.refreshOverflow();
2300
2596
  toolbar.refreshOverflow();
@@ -2302,7 +2598,7 @@ var ToolbarModule = /** @class */ (function () {
2302
2598
  }
2303
2599
  else {
2304
2600
  _this.createLeftToolbarControls();
2305
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2601
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
2306
2602
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2307
2603
  toolbar.refreshOverflow();
2308
2604
  }
@@ -2310,19 +2606,20 @@ var ToolbarModule = /** @class */ (function () {
2310
2606
  }
2311
2607
  });
2312
2608
  if (Browser.isDevice) {
2313
- toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
2609
+ toolbar.appendTo('#' + id + '_bottomToolbar');
2314
2610
  }
2315
2611
  else {
2316
- toolbar.appendTo('#' + parent.element.id + '_toolbar');
2612
+ toolbar.appendTo('#' + id + '_toolbar');
2317
2613
  }
2318
2614
  this.enableDisableTbrBtn();
2319
2615
  };
2320
2616
  ToolbarModule.prototype.createPenColor = function (items) {
2321
2617
  var _this = this;
2322
2618
  var parent = this.parent;
2619
+ var id = parent.element.id;
2323
2620
  if (items.indexOf('strokeColor') > -1) {
2324
2621
  parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
2325
- id: parent.element.id + '_pen_stroke'
2622
+ id: id + '_pen_stroke'
2326
2623
  }));
2327
2624
  var penColor = new ColorPicker({
2328
2625
  modeSwitcher: false, value: '#fff',
@@ -2333,19 +2630,22 @@ var ToolbarModule = /** @class */ (function () {
2333
2630
  strokeDDB_3.element.children[0].style.backgroundColor = args.currentValue.rgba;
2334
2631
  strokeDDB_3.toggle();
2335
2632
  }
2336
- }, '#' + parent.element.id + '_pen_stroke');
2633
+ }, '#' + id + '_pen_stroke');
2337
2634
  var strokeDDB_3 = new DropDownButton({
2338
2635
  open: function (args) {
2636
+ var parentElem = args.element.parentElement;
2339
2637
  if (Browser.isDevice) {
2340
- args.element.parentElement.style.top = strokeDDB_3.element.getBoundingClientRect().top -
2341
- args.element.parentElement.offsetHeight + 'px';
2342
- args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
2638
+ parentElem.style.top = strokeDDB_3.element.getBoundingClientRect().top -
2639
+ parentElem.offsetHeight + 'px';
2640
+ parentElem.style.left = parent.element.offsetLeft + 'px';
2343
2641
  }
2344
2642
  },
2345
2643
  target: '.e-pen-color',
2346
- iconCss: 'e-dropdownbtn-preview'
2347
- }, '#' + parent.element.id + '_penColorBtn');
2644
+ iconCss: 'e-dropdownbtn-preview',
2645
+ cssClass: 'e-ie-ddb-popup'
2646
+ }, '#' + id + '_penColorBtn');
2348
2647
  penColor.inline = true;
2648
+ penColor.value = penColor.getValue(parent.activeObj.strokeSettings.strokeColor, 'rgba');
2349
2649
  var obj = { tempFreeHandDrawEditingStyles: null };
2350
2650
  parent.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
2351
2651
  var indexObj = { freehandSelectedIndex: null };
@@ -2357,12 +2657,13 @@ var ToolbarModule = /** @class */ (function () {
2357
2657
  }
2358
2658
  else {
2359
2659
  parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
2360
- = '#fff';
2660
+ = penColor.value;
2361
2661
  }
2362
2662
  }
2363
2663
  };
2364
2664
  ToolbarModule.prototype.createPenBtn = function (items) {
2365
2665
  var parent = this.parent;
2666
+ var id = parent.element.id;
2366
2667
  var strokeWidthItems = [
2367
2668
  { id: '1', text: this.l10n.getConstant('XSmall') },
2368
2669
  { id: '2', text: this.l10n.getConstant('Small') },
@@ -2371,7 +2672,7 @@ var ToolbarModule = /** @class */ (function () {
2371
2672
  { id: '5', text: this.l10n.getConstant('XLarge') }
2372
2673
  ];
2373
2674
  if (items.indexOf('strokeWidth') > -1) {
2374
- var strokeWidthBtn = document.getElementById(parent.element.id + '_penStrokeWidth');
2675
+ var strokeWidthBtn = document.getElementById(id + '_penStrokeWidth');
2375
2676
  var spanElem_3 = document.createElement('span');
2376
2677
  var indexObj = { freehandSelectedIndex: null };
2377
2678
  parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
@@ -2396,23 +2697,23 @@ var ToolbarModule = /** @class */ (function () {
2396
2697
  spanElem_3.textContent = args.item.text;
2397
2698
  parent.updatePenStrokeWidth(args.item.id);
2398
2699
  if (Browser.isDevice) {
2399
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
2700
+ if (document.getElementById(id + '_bottomToolbar')) {
2400
2701
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2401
- var toolbar_8 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
2402
- toolbar_8.refreshOverflow();
2702
+ var toolbar_9 = getComponent(id + '_bottomToolbar', 'toolbar');
2703
+ toolbar_9.refreshOverflow();
2403
2704
  }
2404
2705
  }
2405
2706
  else {
2406
- if (document.getElementById(parent.element.id + '_toolbar')) {
2707
+ if (document.getElementById(id + '_toolbar')) {
2407
2708
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2408
- var toolbar_9 = getComponent(parent.element.id + '_toolbar', 'toolbar');
2409
- toolbar_9.refreshOverflow();
2709
+ var toolbar_10 = getComponent(id + '_toolbar', 'toolbar');
2710
+ toolbar_10.refreshOverflow();
2410
2711
  }
2411
2712
  }
2412
2713
  }
2413
2714
  });
2414
2715
  // Render initialized DropDownButton.
2415
- drpDownBtn_2.appendTo('#' + parent.element.id + '_penStrokeWidth');
2716
+ drpDownBtn_2.appendTo('#' + id + '_penStrokeWidth');
2416
2717
  }
2417
2718
  };
2418
2719
  ToolbarModule.prototype.getPenStroke = function (value) {
@@ -2432,6 +2733,7 @@ var ToolbarModule = /** @class */ (function () {
2432
2733
  ToolbarModule.prototype.initAdjustmentToolbarItem = function () {
2433
2734
  var _this = this;
2434
2735
  var parent = this.parent;
2736
+ var id = parent.element.id;
2435
2737
  var leftItem = this.getLeftToolbarItem(null);
2436
2738
  var rightItem = this.getRightToolbarItem();
2437
2739
  var mainItem = this.getAdjustmentToolbarItem();
@@ -2452,14 +2754,14 @@ var ToolbarModule = /** @class */ (function () {
2452
2754
  _this.renderSaveBtn();
2453
2755
  }
2454
2756
  if (Browser.isDevice) {
2455
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2757
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
2456
2758
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2457
2759
  toolbar.refreshOverflow();
2458
2760
  }
2459
2761
  }
2460
2762
  else {
2461
2763
  _this.createLeftToolbarControls();
2462
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2764
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
2463
2765
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2464
2766
  toolbar.refreshOverflow();
2465
2767
  }
@@ -2467,30 +2769,29 @@ var ToolbarModule = /** @class */ (function () {
2467
2769
  }
2468
2770
  });
2469
2771
  if (Browser.isDevice) {
2470
- toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
2772
+ toolbar.appendTo('#' + id + '_bottomToolbar');
2471
2773
  }
2472
2774
  else {
2473
- toolbar.appendTo('#' + parent.element.id + '_toolbar');
2775
+ toolbar.appendTo('#' + id + '_toolbar');
2474
2776
  }
2475
2777
  this.enableDisableTbrBtn();
2476
2778
  };
2477
2779
  ToolbarModule.prototype.initFrameToolbarItem = function () {
2478
2780
  var _this = this;
2479
2781
  var parent = this.parent;
2480
- var canvasWrapper = document.querySelector('#' + parent.element.id + '_contextualToolbarArea');
2481
- var frameWrapper = document.querySelector('#' + parent.element.id + '_frameWrapper');
2482
- if (!frameWrapper) {
2483
- frameWrapper = canvasWrapper.appendChild(parent.createElement('div', {
2484
- id: parent.element.id + '_frameWrapper',
2485
- className: 'e-frame-wrapper',
2486
- styles: 'position: relative'
2487
- }));
2782
+ var id = parent.element.id;
2783
+ var canvasWrapper = document.querySelector('#' + id + '_contextualToolbarArea');
2784
+ var frameWrapper = document.querySelector('#' + id + '_frameWrapper');
2785
+ if (frameWrapper) {
2786
+ frameWrapper.style.display = 'block';
2488
2787
  }
2489
2788
  else {
2490
- frameWrapper.style.display = 'block';
2789
+ frameWrapper = canvasWrapper.appendChild(parent.createElement('div', {
2790
+ id: id + '_frameWrapper', className: 'e-frame-wrapper', styles: 'position: relative'
2791
+ }));
2491
2792
  }
2492
2793
  frameWrapper.appendChild(parent.createElement('div', {
2493
- id: parent.element.id + '_customizeWrapper',
2794
+ id: id + '_customizeWrapper',
2494
2795
  styles: 'position: absolute'
2495
2796
  }));
2496
2797
  var mainItem = this.getFrameToolbarItem();
@@ -2501,22 +2802,23 @@ var ToolbarModule = /** @class */ (function () {
2501
2802
  created: function () {
2502
2803
  _this.createFrameColor();
2503
2804
  _this.createFrameSize();
2504
- if (parent.frameObj.type === 'line') {
2805
+ var frameType = parent.frameObj.type;
2806
+ if (frameType === 'line') {
2505
2807
  _this.createFrameRadius();
2506
2808
  }
2507
- if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset' || parent.frameObj.type === 'hook') {
2809
+ if (frameType === 'line' || frameType === 'inset' || frameType === 'hook') {
2508
2810
  _this.createFrameInset();
2509
2811
  }
2510
- if (parent.frameObj.type === 'line' || parent.frameObj.type === 'inset') {
2812
+ if (frameType === 'line' || frameType === 'inset') {
2511
2813
  _this.createFrameOffset();
2512
2814
  }
2513
- if (parent.frameObj.type === 'line') {
2815
+ if (frameType === 'line') {
2514
2816
  _this.createFrameAmount();
2515
2817
  _this.createFrameBorder();
2516
2818
  }
2517
2819
  _this.createFrameGradientColor();
2518
2820
  if (Browser.isDevice) {
2519
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
2821
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
2520
2822
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2521
2823
  toolbar.refreshOverflow();
2522
2824
  toolbar.refreshOverflow();
@@ -2525,22 +2827,23 @@ var ToolbarModule = /** @class */ (function () {
2525
2827
  }
2526
2828
  else {
2527
2829
  _this.createLeftToolbarControls();
2528
- if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2830
+ if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
2529
2831
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2530
2832
  toolbar.refreshOverflow();
2531
2833
  }
2532
2834
  }
2533
- parent.element.querySelector('#' + parent.element.id + '_' + parent.frameObj.type).focus();
2835
+ parent.element.querySelector('#' + id + '_' + frameType).focus();
2534
2836
  }
2535
2837
  });
2536
- toolbar.appendTo('#' + this.parent.element.id + '_customizeWrapper');
2838
+ toolbar.appendTo('#' + id + '_customizeWrapper');
2537
2839
  };
2538
2840
  ToolbarModule.prototype.createFrameGradientColor = function () {
2539
2841
  var parent = this.parent;
2540
2842
  var prevFrameSettings;
2541
2843
  var obj = { frameChangeEventArgs: null };
2844
+ var id = parent.element.id;
2542
2845
  parent.element.querySelector('.e-template.e-frame-stroke').appendChild(parent.createElement('input', {
2543
- id: parent.element.id + '_frame_gradient_fill'
2846
+ id: id + '_frame_gradient_fill'
2544
2847
  }));
2545
2848
  var fillColor = new ColorPicker({
2546
2849
  modeSwitcher: false, noColor: true, value: parent.frameObj.gradientColor,
@@ -2563,6 +2866,7 @@ var ToolbarModule = /** @class */ (function () {
2563
2866
  previousFilter: null, isCircleCrop: null
2564
2867
  } });
2565
2868
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
2869
+ parent.notify('draw', { prop: 'redrawDownScale' });
2566
2870
  if (args.currentValue.rgba === '') {
2567
2871
  fillDDB.element.children[0].classList.add('e-nocolor-item');
2568
2872
  }
@@ -2570,24 +2874,28 @@ var ToolbarModule = /** @class */ (function () {
2570
2874
  fillDDB.element.children[0].classList.remove('e-nocolor-item');
2571
2875
  fillDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
2572
2876
  }
2877
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
2878
+ parent.isFrameBtnClick = true;
2573
2879
  }
2574
2880
  else {
2575
2881
  parent.frameObj.gradientColor = temp;
2576
2882
  }
2577
2883
  fillDDB.toggle();
2578
2884
  }
2579
- }, '#' + parent.element.id + '_frame_gradient_fill');
2885
+ }, '#' + id + '_frame_gradient_fill');
2580
2886
  var fillDDB = new DropDownButton({
2581
2887
  open: function (args) {
2582
2888
  if (Browser.isDevice) {
2583
- args.element.parentElement.style.top = fillDDB.element.getBoundingClientRect().top -
2584
- args.element.parentElement.offsetHeight + 'px';
2585
- args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
2889
+ var parentElem = args.element.parentElement;
2890
+ parentElem.style.top = fillDDB.element.getBoundingClientRect().top -
2891
+ parentElem.offsetHeight + 'px';
2892
+ parentElem.style.left = parent.element.offsetLeft + 'px';
2586
2893
  }
2587
2894
  },
2588
2895
  target: '.e-frame-gradient-fill-color',
2589
- iconCss: 'e-dropdownbtn-preview'
2590
- }, '#' + parent.element.id + '_frameGradientColorBtn');
2896
+ iconCss: 'e-dropdownbtn-preview',
2897
+ cssClass: 'e-ie-ddb-popup'
2898
+ }, '#' + id + '_frameGradientColorBtn');
2591
2899
  fillColor.inline = true;
2592
2900
  if (parent.frameObj.gradientColor === '') {
2593
2901
  parent.element.querySelector('.e-frame-stroke.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
@@ -2600,8 +2908,9 @@ var ToolbarModule = /** @class */ (function () {
2600
2908
  var parent = this.parent;
2601
2909
  var prevFrameSettings;
2602
2910
  var obj = { frameChangeEventArgs: null };
2911
+ var id = parent.element.id;
2603
2912
  parent.element.querySelector('.e-template.e-stroke').appendChild(parent.createElement('input', {
2604
- id: parent.element.id + '_frame_fill'
2913
+ id: id + '_frame_fill'
2605
2914
  }));
2606
2915
  var fillColor = new ColorPicker({
2607
2916
  modeSwitcher: false, value: parent.frameObj.color,
@@ -2624,6 +2933,7 @@ var ToolbarModule = /** @class */ (function () {
2624
2933
  previousFilter: null, isCircleCrop: null
2625
2934
  } });
2626
2935
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
2936
+ parent.notify('draw', { prop: 'redrawDownScale' });
2627
2937
  if (args.currentValue.rgba === '') {
2628
2938
  fillDDB.element.children[0].classList.add('e-nocolor-item');
2629
2939
  }
@@ -2631,24 +2941,28 @@ var ToolbarModule = /** @class */ (function () {
2631
2941
  fillDDB.element.children[0].classList.remove('e-nocolor-item');
2632
2942
  fillDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
2633
2943
  }
2944
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
2945
+ parent.isFrameBtnClick = true;
2634
2946
  }
2635
2947
  else {
2636
2948
  parent.frameObj.color = temp;
2637
2949
  }
2638
2950
  fillDDB.toggle();
2639
2951
  }
2640
- }, '#' + parent.element.id + '_frame_fill');
2952
+ }, '#' + id + '_frame_fill');
2641
2953
  var fillDDB = new DropDownButton({
2642
2954
  open: function (args) {
2643
2955
  if (Browser.isDevice) {
2644
- args.element.parentElement.style.top = fillDDB.element.getBoundingClientRect().top -
2645
- args.element.parentElement.offsetHeight + 'px';
2646
- args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
2956
+ var parentElem = args.element.parentElement;
2957
+ parentElem.style.top = fillDDB.element.getBoundingClientRect().top -
2958
+ parentElem.offsetHeight + 'px';
2959
+ parentElem.style.left = parent.element.offsetLeft + 'px';
2647
2960
  }
2648
2961
  },
2649
2962
  target: '.e-frame-fill-color',
2650
- iconCss: 'e-dropdownbtn-preview'
2651
- }, '#' + parent.element.id + '_frameColorBtn');
2963
+ iconCss: 'e-dropdownbtn-preview',
2964
+ cssClass: 'e-ie-ddb-popup'
2965
+ }, '#' + id + '_frameColorBtn');
2652
2966
  fillColor.inline = true;
2653
2967
  parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview').style.background = parent.frameObj.color;
2654
2968
  };
@@ -2656,6 +2970,7 @@ var ToolbarModule = /** @class */ (function () {
2656
2970
  var parent = this.parent;
2657
2971
  var prevFrameSettings;
2658
2972
  var obj = { frameChangeEventArgs: null };
2973
+ var id = parent.element.id;
2659
2974
  var strokeWidthItems = [
2660
2975
  { id: '1', text: this.l10n.getConstant('20') },
2661
2976
  { id: '2', text: this.l10n.getConstant('40') },
@@ -2663,7 +2978,7 @@ var ToolbarModule = /** @class */ (function () {
2663
2978
  { id: '4', text: this.l10n.getConstant('80') },
2664
2979
  { id: '5', text: this.l10n.getConstant('100') }
2665
2980
  ];
2666
- var strokeWidthBtn = document.getElementById(parent.element.id + '_frameSizeBtn');
2981
+ var strokeWidthBtn = document.getElementById(id + '_frameSizeBtn');
2667
2982
  var spanElem = document.createElement('span');
2668
2983
  spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.size.toString());
2669
2984
  spanElem.className = 'e-frame-stroke-width';
@@ -2672,8 +2987,9 @@ var ToolbarModule = /** @class */ (function () {
2672
2987
  var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
2673
2988
  open: function (args) {
2674
2989
  if (Browser.isDevice) {
2675
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
2676
- args.element.parentElement.offsetHeight + 'px';
2990
+ var parentElem = args.element.parentElement;
2991
+ parentElem.style.top = drpDownBtn.element.getBoundingClientRect().top -
2992
+ parentElem.offsetHeight + 'px';
2677
2993
  }
2678
2994
  var activeBtn = drpDownBtn.element.childNodes[0].textContent;
2679
2995
  if (activeBtn !== '') {
@@ -2698,34 +3014,38 @@ var ToolbarModule = /** @class */ (function () {
2698
3014
  previousFilter: null, isCircleCrop: null
2699
3015
  } });
2700
3016
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3017
+ parent.notify('draw', { prop: 'redrawDownScale' });
2701
3018
  drpDownBtn.content = args.item.text;
3019
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3020
+ parent.isFrameBtnClick = true;
2702
3021
  }
2703
3022
  else {
2704
3023
  parent.frameObj.size = temp;
2705
3024
  }
2706
3025
  if (Browser.isDevice) {
2707
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
3026
+ if (document.getElementById(id + '_bottomToolbar')) {
2708
3027
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2709
- var toolbar_10 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
2710
- toolbar_10.refreshOverflow();
3028
+ var toolbar_11 = getComponent(id + '_bottomToolbar', 'toolbar');
3029
+ toolbar_11.refreshOverflow();
2711
3030
  }
2712
3031
  }
2713
3032
  else {
2714
- if (document.getElementById(parent.element.id + '_toolbar')) {
3033
+ if (document.getElementById(id + '_toolbar')) {
2715
3034
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2716
- var toolbar_11 = getComponent(parent.element.id + '_toolbar', 'toolbar');
2717
- toolbar_11.refreshOverflow();
3035
+ var toolbar_12 = getComponent(id + '_toolbar', 'toolbar');
3036
+ toolbar_12.refreshOverflow();
2718
3037
  }
2719
3038
  }
2720
3039
  }
2721
3040
  });
2722
3041
  // Render initialized DropDownButton.
2723
- drpDownBtn.appendTo('#' + parent.element.id + '_frameSizeBtn');
3042
+ drpDownBtn.appendTo('#' + id + '_frameSizeBtn');
2724
3043
  };
2725
3044
  ToolbarModule.prototype.createFrameInset = function () {
2726
3045
  var parent = this.parent;
2727
3046
  var prevFrameSettings;
2728
3047
  var obj = { frameChangeEventArgs: null };
3048
+ var id = parent.element.id;
2729
3049
  var strokeWidthItems = [
2730
3050
  { id: '1', text: this.l10n.getConstant('20') },
2731
3051
  { id: '2', text: this.l10n.getConstant('40') },
@@ -2733,7 +3053,7 @@ var ToolbarModule = /** @class */ (function () {
2733
3053
  { id: '4', text: this.l10n.getConstant('80') },
2734
3054
  { id: '5', text: this.l10n.getConstant('100') }
2735
3055
  ];
2736
- var strokeWidthBtn = document.getElementById(parent.element.id + '_frameInsetBtn');
3056
+ var strokeWidthBtn = document.getElementById(id + '_frameInsetBtn');
2737
3057
  var spanElem = document.createElement('span');
2738
3058
  spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.inset.toString());
2739
3059
  spanElem.className = 'e-frame-inset';
@@ -2742,8 +3062,9 @@ var ToolbarModule = /** @class */ (function () {
2742
3062
  var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
2743
3063
  open: function (args) {
2744
3064
  if (Browser.isDevice) {
2745
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
2746
- args.element.parentElement.offsetHeight + 'px';
3065
+ var parentElem = args.element.parentElement;
3066
+ parentElem.style.top = drpDownBtn.element.getBoundingClientRect().top -
3067
+ parentElem.offsetHeight + 'px';
2747
3068
  }
2748
3069
  var activeBtn = drpDownBtn.element.childNodes[0].textContent;
2749
3070
  if (activeBtn !== '') {
@@ -2768,34 +3089,38 @@ var ToolbarModule = /** @class */ (function () {
2768
3089
  previousFilter: null, isCircleCrop: null
2769
3090
  } });
2770
3091
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3092
+ parent.notify('draw', { prop: 'redrawDownScale' });
2771
3093
  drpDownBtn.content = args.item.text;
3094
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3095
+ parent.isFrameBtnClick = true;
2772
3096
  }
2773
3097
  else {
2774
3098
  parent.frameObj.inset = temp;
2775
3099
  }
2776
3100
  if (Browser.isDevice) {
2777
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
3101
+ if (document.getElementById(id + '_bottomToolbar')) {
2778
3102
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2779
- var toolbar_12 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
2780
- toolbar_12.refreshOverflow();
3103
+ var toolbar_13 = getComponent(id + '_bottomToolbar', 'toolbar');
3104
+ toolbar_13.refreshOverflow();
2781
3105
  }
2782
3106
  }
2783
3107
  else {
2784
- if (document.getElementById(parent.element.id + '_toolbar')) {
3108
+ if (document.getElementById(id + '_toolbar')) {
2785
3109
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2786
- var toolbar_13 = getComponent(parent.element.id + '_toolbar', 'toolbar');
2787
- toolbar_13.refreshOverflow();
3110
+ var toolbar_14 = getComponent(id + '_toolbar', 'toolbar');
3111
+ toolbar_14.refreshOverflow();
2788
3112
  }
2789
3113
  }
2790
3114
  }
2791
3115
  });
2792
3116
  // Render initialized DropDownButton.
2793
- drpDownBtn.appendTo('#' + parent.element.id + '_frameInsetBtn');
3117
+ drpDownBtn.appendTo('#' + id + '_frameInsetBtn');
2794
3118
  };
2795
3119
  ToolbarModule.prototype.createFrameOffset = function () {
2796
3120
  var parent = this.parent;
2797
3121
  var prevFrameSettings;
2798
3122
  var obj = { frameChangeEventArgs: null };
3123
+ var id = parent.element.id;
2799
3124
  var strokeWidthItems = [
2800
3125
  { id: '1', text: this.l10n.getConstant('20') },
2801
3126
  { id: '2', text: this.l10n.getConstant('40') },
@@ -2803,7 +3128,7 @@ var ToolbarModule = /** @class */ (function () {
2803
3128
  { id: '4', text: this.l10n.getConstant('80') },
2804
3129
  { id: '5', text: this.l10n.getConstant('100') }
2805
3130
  ];
2806
- var strokeWidthBtn = document.getElementById(parent.element.id + '_frameOffsetBtn');
3131
+ var strokeWidthBtn = document.getElementById(id + '_frameOffsetBtn');
2807
3132
  var spanElem = document.createElement('span');
2808
3133
  spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.offset.toString());
2809
3134
  spanElem.className = 'e-frame-offset';
@@ -2812,8 +3137,9 @@ var ToolbarModule = /** @class */ (function () {
2812
3137
  var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
2813
3138
  open: function (args) {
2814
3139
  if (Browser.isDevice) {
2815
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
2816
- args.element.parentElement.offsetHeight + 'px';
3140
+ var parentElem = args.element.parentElement;
3141
+ parentElem.style.top = drpDownBtn.element.getBoundingClientRect().top -
3142
+ parentElem.offsetHeight + 'px';
2817
3143
  }
2818
3144
  var activeBtn = drpDownBtn.element.childNodes[0].textContent;
2819
3145
  if (activeBtn !== '') {
@@ -2838,34 +3164,38 @@ var ToolbarModule = /** @class */ (function () {
2838
3164
  previousFilter: null, isCircleCrop: null
2839
3165
  } });
2840
3166
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3167
+ parent.notify('draw', { prop: 'redrawDownScale' });
2841
3168
  drpDownBtn.content = args.item.text;
3169
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3170
+ parent.isFrameBtnClick = true;
2842
3171
  }
2843
3172
  else {
2844
3173
  parent.frameObj.offset = temp;
2845
3174
  }
2846
3175
  if (Browser.isDevice) {
2847
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
3176
+ if (document.getElementById(id + '_bottomToolbar')) {
2848
3177
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2849
- var toolbar_14 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
2850
- toolbar_14.refreshOverflow();
3178
+ var toolbar_15 = getComponent(id + '_bottomToolbar', 'toolbar');
3179
+ toolbar_15.refreshOverflow();
2851
3180
  }
2852
3181
  }
2853
3182
  else {
2854
- if (document.getElementById(parent.element.id + '_toolbar')) {
3183
+ if (document.getElementById(id + '_toolbar')) {
2855
3184
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2856
- var toolbar_15 = getComponent(parent.element.id + '_toolbar', 'toolbar');
2857
- toolbar_15.refreshOverflow();
3185
+ var toolbar_16 = getComponent(id + '_toolbar', 'toolbar');
3186
+ toolbar_16.refreshOverflow();
2858
3187
  }
2859
3188
  }
2860
3189
  }
2861
3190
  });
2862
3191
  // Render initialized DropDownButton.
2863
- drpDownBtn.appendTo('#' + parent.element.id + '_frameOffsetBtn');
3192
+ drpDownBtn.appendTo('#' + id + '_frameOffsetBtn');
2864
3193
  };
2865
3194
  ToolbarModule.prototype.createFrameRadius = function () {
2866
3195
  var parent = this.parent;
2867
3196
  var prevFrameSettings;
2868
3197
  var obj = { frameChangeEventArgs: null };
3198
+ var id = parent.element.id;
2869
3199
  var strokeWidthItems = [
2870
3200
  { id: '1', text: this.l10n.getConstant('0') },
2871
3201
  { id: '2', text: this.l10n.getConstant('20') },
@@ -2874,7 +3204,7 @@ var ToolbarModule = /** @class */ (function () {
2874
3204
  { id: '5', text: this.l10n.getConstant('80') },
2875
3205
  { id: '6', text: this.l10n.getConstant('100') }
2876
3206
  ];
2877
- var strokeWidthBtn = document.getElementById(parent.element.id + '_frameRadiusBtn');
3207
+ var strokeWidthBtn = document.getElementById(id + '_frameRadiusBtn');
2878
3208
  var spanElem = document.createElement('span');
2879
3209
  spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.radius.toString());
2880
3210
  spanElem.className = 'e-frame-radius';
@@ -2883,8 +3213,9 @@ var ToolbarModule = /** @class */ (function () {
2883
3213
  var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
2884
3214
  open: function (args) {
2885
3215
  if (Browser.isDevice) {
2886
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
2887
- args.element.parentElement.offsetHeight + 'px';
3216
+ var parentElem = args.element.parentElement;
3217
+ parentElem.style.top = drpDownBtn.element.getBoundingClientRect().top -
3218
+ parentElem.offsetHeight + 'px';
2888
3219
  }
2889
3220
  var activeBtn = drpDownBtn.element.childNodes[0].textContent;
2890
3221
  if (activeBtn !== '') {
@@ -2909,34 +3240,38 @@ var ToolbarModule = /** @class */ (function () {
2909
3240
  previousFilter: null, isCircleCrop: null
2910
3241
  } });
2911
3242
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3243
+ parent.notify('draw', { prop: 'redrawDownScale' });
2912
3244
  drpDownBtn.content = args.item.text;
3245
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3246
+ parent.isFrameBtnClick = true;
2913
3247
  }
2914
3248
  else {
2915
3249
  parent.frameObj.radius = temp;
2916
3250
  }
2917
3251
  if (Browser.isDevice) {
2918
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
3252
+ if (document.getElementById(id + '_bottomToolbar')) {
2919
3253
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2920
- var toolbar_16 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
2921
- toolbar_16.refreshOverflow();
3254
+ var toolbar_17 = getComponent(id + '_bottomToolbar', 'toolbar');
3255
+ toolbar_17.refreshOverflow();
2922
3256
  }
2923
3257
  }
2924
3258
  else {
2925
- if (document.getElementById(parent.element.id + '_toolbar')) {
3259
+ if (document.getElementById(id + '_toolbar')) {
2926
3260
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2927
- var toolbar_17 = getComponent(parent.element.id + '_toolbar', 'toolbar');
2928
- toolbar_17.refreshOverflow();
3261
+ var toolbar_18 = getComponent(id + '_toolbar', 'toolbar');
3262
+ toolbar_18.refreshOverflow();
2929
3263
  }
2930
3264
  }
2931
3265
  }
2932
3266
  });
2933
3267
  // Render initialized DropDownButton.
2934
- drpDownBtn.appendTo('#' + parent.element.id + '_frameRadiusBtn');
3268
+ drpDownBtn.appendTo('#' + id + '_frameRadiusBtn');
2935
3269
  };
2936
3270
  ToolbarModule.prototype.createFrameAmount = function () {
2937
3271
  var parent = this.parent;
2938
3272
  var prevFrameSettings;
2939
3273
  var obj = { frameChangeEventArgs: null };
3274
+ var id = parent.element.id;
2940
3275
  var strokeWidthItems = [
2941
3276
  { id: '1', text: this.l10n.getConstant('1') },
2942
3277
  { id: '2', text: this.l10n.getConstant('2') },
@@ -2944,7 +3279,7 @@ var ToolbarModule = /** @class */ (function () {
2944
3279
  { id: '4', text: this.l10n.getConstant('4') },
2945
3280
  { id: '5', text: this.l10n.getConstant('5') }
2946
3281
  ];
2947
- var strokeWidthBtn = document.getElementById(parent.element.id + '_frameAmountBtn');
3282
+ var strokeWidthBtn = document.getElementById(id + '_frameAmountBtn');
2948
3283
  var spanElem = document.createElement('span');
2949
3284
  spanElem.innerHTML = this.l10n.getConstant(parent.frameObj.amount.toString());
2950
3285
  spanElem.className = 'e-frame-amount';
@@ -2953,8 +3288,9 @@ var ToolbarModule = /** @class */ (function () {
2953
3288
  var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
2954
3289
  open: function (args) {
2955
3290
  if (Browser.isDevice) {
2956
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
2957
- args.element.parentElement.offsetHeight + 'px';
3291
+ var parentElem = args.element.parentElement;
3292
+ parentElem.style.top = drpDownBtn.element.getBoundingClientRect().top -
3293
+ parentElem.offsetHeight + 'px';
2958
3294
  }
2959
3295
  var activeBtn = drpDownBtn.element.childNodes[0].textContent;
2960
3296
  if (activeBtn !== '') {
@@ -2979,40 +3315,44 @@ var ToolbarModule = /** @class */ (function () {
2979
3315
  previousFilter: null, isCircleCrop: null
2980
3316
  } });
2981
3317
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3318
+ parent.notify('draw', { prop: 'redrawDownScale' });
2982
3319
  drpDownBtn.content = args.item.text;
3320
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3321
+ parent.isFrameBtnClick = true;
2983
3322
  }
2984
3323
  else {
2985
3324
  parent.frameObj.amount = temp;
2986
3325
  }
2987
3326
  if (Browser.isDevice) {
2988
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
3327
+ if (document.getElementById(id + '_bottomToolbar')) {
2989
3328
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2990
- var toolbar_18 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
2991
- toolbar_18.refreshOverflow();
3329
+ var toolbar_19 = getComponent(id + '_bottomToolbar', 'toolbar');
3330
+ toolbar_19.refreshOverflow();
2992
3331
  }
2993
3332
  }
2994
3333
  else {
2995
- if (document.getElementById(parent.element.id + '_toolbar')) {
3334
+ if (document.getElementById(id + '_toolbar')) {
2996
3335
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2997
- var toolbar_19 = getComponent(parent.element.id + '_toolbar', 'toolbar');
2998
- toolbar_19.refreshOverflow();
3336
+ var toolbar_20 = getComponent(id + '_toolbar', 'toolbar');
3337
+ toolbar_20.refreshOverflow();
2999
3338
  }
3000
3339
  }
3001
3340
  }
3002
3341
  });
3003
3342
  // Render initialized DropDownButton.
3004
- drpDownBtn.appendTo('#' + parent.element.id + '_frameAmountBtn');
3343
+ drpDownBtn.appendTo('#' + id + '_frameAmountBtn');
3005
3344
  };
3006
3345
  ToolbarModule.prototype.createFrameBorder = function () {
3007
3346
  var parent = this.parent;
3008
3347
  var prevFrameSettings;
3009
3348
  var obj = { frameChangeEventArgs: null };
3349
+ var id = parent.element.id;
3010
3350
  var strokeWidthItems = [
3011
3351
  { id: '1', text: this.l10n.getConstant('Solid') },
3012
3352
  { id: '2', text: this.l10n.getConstant('Dashed') },
3013
3353
  { id: '3', text: this.l10n.getConstant('Dotted') },
3014
3354
  ];
3015
- var strokeWidthBtn = document.getElementById(parent.element.id + '_frameBorderBtn');
3355
+ var strokeWidthBtn = document.getElementById(id + '_frameBorderBtn');
3016
3356
  var spanElem = document.createElement('span');
3017
3357
  spanElem.innerHTML = this.l10n.getConstant(parent.toPascalCase(parent.frameObj.border));
3018
3358
  spanElem.className = 'e-frame-border';
@@ -3021,8 +3361,9 @@ var ToolbarModule = /** @class */ (function () {
3021
3361
  var drpDownBtn = new DropDownButton({ items: strokeWidthItems,
3022
3362
  open: function (args) {
3023
3363
  if (Browser.isDevice) {
3024
- args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
3025
- args.element.parentElement.offsetHeight + 'px';
3364
+ var parentElem = args.element.parentElement;
3365
+ parentElem.style.top = drpDownBtn.element.getBoundingClientRect().top -
3366
+ parentElem.offsetHeight + 'px';
3026
3367
  }
3027
3368
  var activeBtn = drpDownBtn.element.childNodes[0].textContent;
3028
3369
  if (activeBtn !== '') {
@@ -3047,36 +3388,40 @@ var ToolbarModule = /** @class */ (function () {
3047
3388
  previousFilter: null, isCircleCrop: null
3048
3389
  } });
3049
3390
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3391
+ parent.notify('draw', { prop: 'redrawDownScale' });
3050
3392
  drpDownBtn.content = args.item.text;
3393
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3394
+ parent.isFrameBtnClick = true;
3051
3395
  }
3052
3396
  else {
3053
3397
  parent.frameObj.border = temp;
3054
3398
  }
3055
3399
  if (Browser.isDevice) {
3056
- if (document.getElementById(parent.element.id + '_bottomToolbar')) {
3400
+ if (document.getElementById(id + '_bottomToolbar')) {
3057
3401
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3058
- var toolbar_20 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
3059
- toolbar_20.refreshOverflow();
3402
+ var toolbar_21 = getComponent(id + '_bottomToolbar', 'toolbar');
3403
+ toolbar_21.refreshOverflow();
3060
3404
  }
3061
3405
  }
3062
3406
  else {
3063
- if (document.getElementById(parent.element.id + '_toolbar')) {
3407
+ if (document.getElementById(id + '_toolbar')) {
3064
3408
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3065
- var toolbar_21 = getComponent(parent.element.id + '_toolbar', 'toolbar');
3066
- toolbar_21.refreshOverflow();
3409
+ var toolbar_22 = getComponent(id + '_toolbar', 'toolbar');
3410
+ toolbar_22.refreshOverflow();
3067
3411
  }
3068
3412
  }
3069
3413
  }
3070
3414
  });
3071
3415
  // Render initialized DropDownButton.
3072
- drpDownBtn.appendTo('#' + parent.element.id + '_frameBorderBtn');
3416
+ drpDownBtn.appendTo('#' + id + '_frameBorderBtn');
3073
3417
  };
3074
3418
  ToolbarModule.prototype.initFilterToolbarItem = function () {
3075
3419
  var _this = this;
3076
3420
  var parent = this.parent;
3421
+ var id = parent.element.id;
3077
3422
  var mainItem = this.getFilterToolbarItem();
3078
- if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
3079
- getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
3423
+ if (document.querySelector('#' + id + '_contextualToolbar').classList.contains('e-control')) {
3424
+ getComponent(document.getElementById(id + '_contextualToolbar'), 'toolbar').destroy();
3080
3425
  }
3081
3426
  var toolbar = new Toolbar({
3082
3427
  width: '100%',
@@ -3086,20 +3431,21 @@ var ToolbarModule = /** @class */ (function () {
3086
3431
  _this.updatePrivateVariables();
3087
3432
  _this.createCanvasFilter();
3088
3433
  if (parent.currentFilter === '') {
3089
- parent.currentFilter = parent.element.id + '_default';
3434
+ parent.currentFilter = id + '_default';
3090
3435
  }
3091
- var hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
3436
+ var hdrWrapper = document.querySelector('#' + id + '_headWrapper');
3092
3437
  if (hdrWrapper) {
3093
3438
  hdrWrapper.style.display = 'none';
3094
3439
  }
3095
- if (document.getElementById(parent.currentFilter + 'Canvas')) {
3096
- document.getElementById(parent.currentFilter + 'Canvas').parentElement.parentElement.classList.add('e-selected');
3440
+ var filterElem = document.getElementById(parent.currentFilter + 'Canvas');
3441
+ if (filterElem) {
3442
+ filterElem.parentElement.parentElement.classList.add('e-selected');
3097
3443
  }
3098
3444
  _this.enableDisableTbrBtn();
3099
3445
  toolbar.refreshOverflow();
3100
3446
  }
3101
3447
  });
3102
- toolbar.appendTo('#' + parent.element.id + '_contextualToolbar');
3448
+ toolbar.appendTo('#' + id + '_contextualToolbar');
3103
3449
  };
3104
3450
  ToolbarModule.prototype.drawDashedLine = function (ctx) {
3105
3451
  ctx.beginPath();
@@ -3141,6 +3487,7 @@ var ToolbarModule = /** @class */ (function () {
3141
3487
  };
3142
3488
  ToolbarModule.prototype.getQuickAccessToolbarItem = function (isPenEdit) {
3143
3489
  var parent = this.parent;
3490
+ var id = parent.element.id;
3144
3491
  var args = { cancel: false, toolbarItems: [] };
3145
3492
  var toolbarItems = [];
3146
3493
  if (isNullOrUndefined(isPenEdit)) {
@@ -3168,21 +3515,21 @@ var ToolbarModule = /** @class */ (function () {
3168
3515
  for (var i = 0; i < args.toolbarItems.length; i++) {
3169
3516
  switch (args.toolbarItems[i]) {
3170
3517
  case 'Clone':
3171
- orgToolbarItems.push({ id: parent.element.id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
3518
+ orgToolbarItems.push({ id: id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
3172
3519
  tooltipText: this.l10n.getConstant('Duplicate'), align: 'Left' });
3173
3520
  break;
3174
3521
  case 'Delete':
3175
- orgToolbarItems.push({ id: parent.element.id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
3522
+ orgToolbarItems.push({ id: id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
3176
3523
  tooltipText: this.l10n.getConstant('Remove'), align: 'Left' });
3177
3524
  break;
3178
3525
  case 'EditText':
3179
- orgToolbarItems.push({ id: parent.element.id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
3526
+ orgToolbarItems.push({ id: id + '_editText', prefixIcon: 'e-icons e-annotation-edit', cssClass: 'top-icon e-annotation-edit',
3180
3527
  tooltipText: this.l10n.getConstant('EditText'), align: 'Left' });
3181
3528
  break;
3182
3529
  case 'Flip':
3183
- orgToolbarItems.push({ id: parent.element.id + '_hFlip', prefixIcon: 'e-icons e-horizontal-flip',
3530
+ orgToolbarItems.push({ id: id + '_hFlip', prefixIcon: 'e-icons e-horizontal-flip',
3184
3531
  tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Left' });
3185
- orgToolbarItems.push({ id: parent.element.id + '_vFlip', prefixIcon: 'e-icons e-vertical-flip',
3532
+ orgToolbarItems.push({ id: id + '_vFlip', prefixIcon: 'e-icons e-vertical-flip',
3186
3533
  tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Left' });
3187
3534
  break;
3188
3535
  default:
@@ -3195,8 +3542,9 @@ var ToolbarModule = /** @class */ (function () {
3195
3542
  };
3196
3543
  ToolbarModule.prototype.renderQAT = function (isPenEdit) {
3197
3544
  var parent = this.parent;
3545
+ var id = parent.element.id;
3198
3546
  if (parent.activeObj && parent.showQuickAccessToolbar) {
3199
- var qtArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
3547
+ var qtArea = document.getElementById(id + '_quickAccessToolbarArea');
3200
3548
  if (qtArea) {
3201
3549
  this.destroyQuickAccessToolbar();
3202
3550
  qtArea.style.display = 'block';
@@ -3210,7 +3558,7 @@ var ToolbarModule = /** @class */ (function () {
3210
3558
  items: items,
3211
3559
  clicked: this.quickAccessToolbarClicked.bind(this)
3212
3560
  });
3213
- toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
3561
+ toolbarObj.appendTo('#' + id + '_quickAccessToolbar');
3214
3562
  }
3215
3563
  var height = this.toolbarHeight && this.toolbarHeight !== 0 ? this.toolbarHeight : qtArea.clientHeight;
3216
3564
  if (isNullOrUndefined(isPenEdit)) {
@@ -3272,7 +3620,8 @@ var ToolbarModule = /** @class */ (function () {
3272
3620
  return;
3273
3621
  }
3274
3622
  var parent = this.parent;
3275
- var annotation = document.querySelector('#' + parent.element.id + '_annotationBtn');
3623
+ var id = parent.element.id;
3624
+ var annotation = document.querySelector('#' + id + '_annotationBtn');
3276
3625
  if (annotation) {
3277
3626
  if (isDisabled) {
3278
3627
  annotation.classList.add('e-disabled');
@@ -3284,7 +3633,7 @@ var ToolbarModule = /** @class */ (function () {
3284
3633
  }
3285
3634
  getComponent(annotation, 'dropdown-btn').disabled = isDisabled;
3286
3635
  }
3287
- var transform = document.querySelector('#' + parent.element.id + '_transformBtn');
3636
+ var transform = document.querySelector('#' + id + '_transformBtn');
3288
3637
  if (transform) {
3289
3638
  if (isDisabled) {
3290
3639
  transform.classList.add('e-disabled');
@@ -3296,7 +3645,7 @@ var ToolbarModule = /** @class */ (function () {
3296
3645
  }
3297
3646
  getComponent(transform, 'dropdown-btn').disabled = isDisabled;
3298
3647
  }
3299
- var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
3648
+ var adjustment = document.querySelector('#' + id + '_adjustment');
3300
3649
  if (adjustment) {
3301
3650
  if (isDisabled) {
3302
3651
  adjustment.classList.add('e-disabled');
@@ -3308,7 +3657,7 @@ var ToolbarModule = /** @class */ (function () {
3308
3657
  }
3309
3658
  getComponent(adjustment, 'btn').disabled = isDisabled;
3310
3659
  }
3311
- var filter = document.querySelector('#' + parent.element.id + '_filter');
3660
+ var filter = document.querySelector('#' + id + '_filter');
3312
3661
  if (filter) {
3313
3662
  if (isDisabled) {
3314
3663
  filter.classList.add('e-disabled');
@@ -3332,17 +3681,20 @@ var ToolbarModule = /** @class */ (function () {
3332
3681
  var text = args.item.id;
3333
3682
  this.currentToolbar = 'crop';
3334
3683
  parent.currSelectionPoint = null;
3684
+ parent.notify('draw', { prop: 'setIsCropSelect', value: { bool: true } });
3685
+ var obj = { prevObj: null };
3686
+ parent.notify('crop', { prop: 'getPreviousCropCurrentObj', value: { obj: obj } });
3335
3687
  parent.notify('draw', { prop: 'select', onPropertyChange: false,
3336
3688
  value: { type: text, startX: null, startY: null, width: null, height: null } });
3689
+ parent.notify('crop', { prop: 'setPreviousCropCurrentObj', value: { obj: obj['prevObj'] } });
3337
3690
  this.enableDisableTbrBtn();
3338
3691
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
3339
3692
  };
3340
3693
  ToolbarModule.prototype.quickAccessToolbarClicked = function (args, isContextualToolbar) {
3341
3694
  var parent = this.parent;
3695
+ var id = parent.element.id;
3342
3696
  var points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
3343
3697
  if (args.item) {
3344
- var duplicateObj = void 0;
3345
- var objColl = void 0;
3346
3698
  var isPreventUndoRedo = null;
3347
3699
  var obj = { prevActObj: null };
3348
3700
  var object = { tempObj: null };
@@ -3352,89 +3704,25 @@ var ToolbarModule = /** @class */ (function () {
3352
3704
  var pathObject = { isNewPath: null };
3353
3705
  var ctx = void 0;
3354
3706
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
3355
- switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
3707
+ var type = args.item.id.replace(id + '_', '').toLowerCase();
3708
+ switch (type) {
3356
3709
  case 'duplicate':
3357
- if (!parent.element.querySelector('#' + parent.element.id + '_duplicate').classList.contains('e-disabled')) {
3710
+ if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
3358
3711
  this.refreshSlider();
3359
3712
  if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
3360
3713
  isPreventUndoRedo = true;
3361
3714
  }
3362
- duplicateObj = extend({}, parent.activeObj, {}, true);
3363
- if (duplicateObj.shape === 'image') {
3364
- objColl = extend([], parent.objColl, [], true);
3365
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
3366
- }
3367
- if (isNullOrUndefined(parent.activeObj.currIndex)) {
3368
- parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
3369
- }
3370
- else if (obj['prevActObj']) {
3371
- parent.activeObj.currIndex = null;
3372
- duplicateObj.currIndex = null;
3373
- parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
3374
- }
3375
- else {
3376
- parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
3377
- }
3378
- if (pathObject['isNewPath']) {
3379
- parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
3380
- }
3381
- objColl = extend([], parent.objColl, [], true);
3382
- duplicateObj.activePoint.startX += 10;
3383
- duplicateObj.activePoint.startY -= 10;
3384
- duplicateObj.activePoint.endX += 10;
3385
- duplicateObj.activePoint.endY -= 10;
3386
- if (duplicateObj.shape === 'path') {
3387
- for (var i = 0; i < duplicateObj.pointColl.length; i++) {
3388
- duplicateObj.pointColl[i].x += 10;
3389
- duplicateObj.pointColl[i].y -= 10;
3390
- }
3391
- }
3392
- else if (duplicateObj.shape === 'image') {
3393
- duplicateObj.imageCanvas = parent.createElement('canvas');
3394
- }
3395
- parent.activeObj = extend({}, duplicateObj, {}, true);
3396
- if (parent.activeObj.shape === 'image') {
3397
- if (parent.activeObj.isHorImageFlip && parent.activeObj.isVerImageFlip) {
3398
- parent.activeObj.isHorImageFlip = parent.activeObj.isVerImageFlip = false;
3399
- parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3400
- value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: true } });
3401
- parent.activeObj.isHorImageFlip = parent.activeObj.isVerImageFlip = true;
3402
- }
3403
- else if (parent.activeObj.isHorImageFlip) {
3404
- parent.activeObj.isHorImageFlip = false;
3405
- parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3406
- value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: null } });
3407
- parent.activeObj.isHorImageFlip = true;
3408
- }
3409
- else if (parent.activeObj.isVerImageFlip) {
3410
- parent.activeObj.isVerImageFlip = false;
3411
- parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3412
- value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: true } });
3413
- parent.activeObj.isVerImageFlip = true;
3414
- }
3415
- else {
3416
- parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3417
- value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: null } });
3418
- }
3419
- }
3420
- if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
3421
- parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
3422
- value: { obj: parent.activeObj } });
3423
- }
3424
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj,
3425
- isCropRatio: null, points: null, isPreventDrag: true } });
3426
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
3427
- this.renderQAT();
3715
+ this.duplicateShape(isPreventUndoRedo);
3428
3716
  }
3429
3717
  break;
3430
3718
  case 'remove':
3431
- if (!parent.element.querySelector('#' + parent.element.id + '_remove').classList.contains('e-disabled')) {
3719
+ if (!parent.element.querySelector('#' + id + '_remove').classList.contains('e-disabled')) {
3432
3720
  this.refreshSlider();
3433
3721
  parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
3434
3722
  }
3435
3723
  break;
3436
3724
  case 'edittext':
3437
- if (!parent.element.querySelector('#' + parent.element.id + '_editText').classList.contains('e-disabled')) {
3725
+ if (!parent.element.querySelector('#' + id + '_editText').classList.contains('e-disabled')) {
3438
3726
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3439
3727
  parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
3440
3728
  value: { obj: extend({}, parent.activeObj, {}, true) } });
@@ -3443,59 +3731,156 @@ var ToolbarModule = /** @class */ (function () {
3443
3731
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
3444
3732
  value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
3445
3733
  if (parent.activeObj.rotatedAngle !== 0) {
3446
- points.x = parent.activeObj.horTopLinePointColl[0].x;
3447
- points.y = parent.activeObj.horTopLinePointColl[0].y;
3734
+ var object_1 = { x: points.x, y: points.y };
3735
+ parent.notify('shape', { prop: 'getTextBoxPosition', onPropertyChange: false,
3736
+ value: { obj: parent.activeObj, object: object_1 } });
3737
+ points.x = object_1['x'];
3738
+ points.y = object_1['y'];
3739
+ var object1 = { x: points.x, y: points.y };
3740
+ parent.notify('shape', { prop: 'setFlipState', onPropertyChange: false,
3741
+ value: { x: points.x, y: points.y, obj: parent.activeObj, object: object1 } });
3742
+ points.x = object1['x'];
3743
+ points.y = object1['y'];
3448
3744
  }
3449
3745
  parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
3450
3746
  value: { x: points.x, y: points.y, actObj: parent.activeObj } });
3451
3747
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
3452
3748
  parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
3453
3749
  }
3454
- else if (obj['prevActObj']) {
3455
- parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
3456
- }
3457
- if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
3458
- document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
3750
+ if (document.getElementById(id + '_quickAccessToolbarArea')) {
3751
+ document.getElementById(id + '_quickAccessToolbarArea').style.display = 'none';
3459
3752
  }
3460
3753
  }
3461
3754
  break;
3462
3755
  case 'rotleft':
3463
3756
  case 'rotright':
3464
- if (!parent.element.querySelector('#' + parent.element.id + '_rotLeft').classList.contains('e-disabled') ||
3465
- !parent.element.querySelector('#' + parent.element.id + '_rotRight').classList.contains('e-disabled')) {
3466
- parent.rotateImage(args.item.id.replace(parent.element.id + '_', '').toLowerCase());
3757
+ if (!parent.element.querySelector('#' + id + '_rotLeft').classList.contains('e-disabled') ||
3758
+ !parent.element.querySelector('#' + id + '_rotRight').classList.contains('e-disabled')) {
3759
+ parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
3467
3760
  }
3468
3761
  break;
3469
3762
  case 'hflip':
3470
- if (!parent.element.querySelector('#' + parent.element.id + '_hFlip').classList.contains('e-disabled')) {
3763
+ if (!parent.element.querySelector('#' + id + '_hFlip').classList.contains('e-disabled')) {
3471
3764
  ctx = parent.activeObj.imageCanvas.getContext('2d');
3472
3765
  parent.horizontalFlip(ctx);
3473
3766
  }
3474
3767
  break;
3475
3768
  case 'vflip':
3476
- if (!parent.element.querySelector('#' + parent.element.id + '_vFlip').classList.contains('e-disabled')) {
3769
+ if (!parent.element.querySelector('#' + id + '_vFlip').classList.contains('e-disabled')) {
3477
3770
  ctx = parent.activeObj.imageCanvas.getContext('2d');
3478
3771
  parent.verticalFlip(ctx);
3479
3772
  }
3480
3773
  break;
3481
3774
  }
3775
+ if (type === 'duplicate' || type === 'remove') {
3776
+ parent.notify('draw', { prop: 'redrawDownScale' });
3777
+ }
3482
3778
  }
3483
3779
  if (isNullOrUndefined(isContextualToolbar)) {
3484
3780
  parent.trigger('quickAccessToolbarItemClick', args);
3485
3781
  }
3486
3782
  };
3783
+ ToolbarModule.prototype.duplicateShape = function (isPreventUndoRedo, isPublicMethod) {
3784
+ var parent = this.parent;
3785
+ var tempObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
3786
+ flipObjColl: [], triangle: [], triangleRatio: [] };
3787
+ parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
3788
+ value: { obj: tempObj } });
3789
+ var obj = { prevActObj: null };
3790
+ parent.notify('draw', { prop: 'getPrevActObj', onPropertyChange: false, value: { obj: obj } });
3791
+ var pathObject = { isNewPath: null };
3792
+ parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
3793
+ var objColl;
3794
+ var duplicateObj = extend({}, parent.activeObj, {}, true);
3795
+ if (duplicateObj.shape === 'image') {
3796
+ objColl = extend([], parent.objColl, [], true);
3797
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
3798
+ }
3799
+ if (isNullOrUndefined(parent.activeObj.currIndex)) {
3800
+ parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
3801
+ }
3802
+ else if (obj['prevActObj'] || isPublicMethod) {
3803
+ parent.activeObj.currIndex = null;
3804
+ duplicateObj.currIndex = null;
3805
+ parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
3806
+ }
3807
+ else {
3808
+ parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
3809
+ }
3810
+ if (pathObject['isNewPath']) {
3811
+ parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
3812
+ }
3813
+ objColl = extend([], parent.objColl, [], true);
3814
+ duplicateObj.activePoint.startX += 10;
3815
+ duplicateObj.activePoint.startY -= 10;
3816
+ duplicateObj.activePoint.endX += 10;
3817
+ duplicateObj.activePoint.endY -= 10;
3818
+ if (duplicateObj.shape === 'path') {
3819
+ for (var i = 0; i < duplicateObj.pointColl.length; i++) {
3820
+ duplicateObj.pointColl[i].x += 10;
3821
+ duplicateObj.pointColl[i].y -= 10;
3822
+ }
3823
+ }
3824
+ else if (duplicateObj.shape === 'image') {
3825
+ duplicateObj.imageCanvas = parent.createElement('canvas');
3826
+ }
3827
+ parent.activeObj = extend({}, duplicateObj, {}, true);
3828
+ if (parent.activeObj.shape === 'image') {
3829
+ var activePoint = extend({}, duplicateObj.activePoint, {}, true);
3830
+ var dimObj = { width: 0, height: 0 };
3831
+ parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
3832
+ value: { width: parent.activeObj.imageElement.width, height: parent.activeObj.imageElement.height, obj: dimObj, isImgShape: null } });
3833
+ parent.activeObj.activePoint.width = dimObj['width'];
3834
+ parent.activeObj.activePoint.height = dimObj['height'];
3835
+ if (parent.activeObj.isHorImageFlip && parent.activeObj.isVerImageFlip) {
3836
+ parent.activeObj.isHorImageFlip = parent.activeObj.isVerImageFlip = false;
3837
+ parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3838
+ value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: true } });
3839
+ parent.activeObj.isHorImageFlip = parent.activeObj.isVerImageFlip = true;
3840
+ }
3841
+ else if (parent.activeObj.isHorImageFlip) {
3842
+ parent.activeObj.isHorImageFlip = false;
3843
+ parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3844
+ value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: null } });
3845
+ parent.activeObj.isHorImageFlip = true;
3846
+ }
3847
+ else if (parent.activeObj.isVerImageFlip) {
3848
+ parent.activeObj.isVerImageFlip = false;
3849
+ parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3850
+ value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: true } });
3851
+ parent.activeObj.isVerImageFlip = true;
3852
+ }
3853
+ else {
3854
+ parent.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
3855
+ value: { ctx: duplicateObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: null } });
3856
+ }
3857
+ parent.activeObj.activePoint = activePoint;
3858
+ }
3859
+ if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
3860
+ parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
3861
+ value: { obj: parent.activeObj } });
3862
+ }
3863
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj,
3864
+ isCropRatio: null, points: null, isPreventDrag: true } });
3865
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
3866
+ this.renderQAT();
3867
+ };
3487
3868
  ToolbarModule.prototype.defToolbarClicked = function (args) {
3488
3869
  var parent = this.parent;
3870
+ var id = parent.element.id;
3489
3871
  var isContextualToolbar = false;
3490
3872
  var isFilterFinetune = false;
3491
3873
  if (!this.isFrameToolbar && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
3492
3874
  if (!parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hide')) {
3493
3875
  isContextualToolbar = isFilterFinetune = true;
3494
3876
  }
3495
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3877
+ var straightenObj = { bool: parent.isStraightening };
3878
+ if (!Browser.isDevice || (Browser.isDevice && !straightenObj['bool'])) {
3879
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3880
+ }
3496
3881
  }
3497
3882
  if (args.item) {
3498
- var type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
3883
+ var type = args.item.id.replace(id + '_', '').toLowerCase();
3499
3884
  if (type === 'duplicate' || type === 'remove' || type === 'edittext' ||
3500
3885
  type === 'hflip' || type === 'vflip' || type === 'rotleft' || type === 'rotright') {
3501
3886
  this.quickAccessToolbarClicked(args, true);
@@ -3504,23 +3889,33 @@ var ToolbarModule = /** @class */ (function () {
3504
3889
  else {
3505
3890
  var isDisabledFilter = false;
3506
3891
  var isDisabledAdjustment = false;
3507
- var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
3892
+ var adjustment = document.querySelector('#' + id + '_adjustment');
3508
3893
  if (adjustment && adjustment.classList.contains('e-disabled')) {
3509
3894
  isDisabledAdjustment = true;
3510
3895
  }
3511
- var filter = document.querySelector('#' + parent.element.id + '_filter');
3896
+ var filter = document.querySelector('#' + id + '_filter');
3512
3897
  if (filter && filter.classList.contains('e-disabled')) {
3513
3898
  isDisabledFilter = true;
3514
3899
  }
3515
3900
  this.enableDisableTbrBtn();
3516
3901
  this.performDefTbrClick(type, isContextualToolbar, isDisabledAdjustment, isDisabledFilter, isFilterFinetune);
3517
3902
  parent.trigger('toolbarItemClicked', args);
3903
+ if (parent.isStraightening) {
3904
+ parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
3905
+ }
3906
+ var validTypes = ['undo', 'redo', 'cancel', 'aspectratio', 'nonaspectratio',
3907
+ 'save', 'duplicate', 'filter', 'frame', 'none', 'mat', 'bevel', 'line', 'inset', 'hook', 'resize',
3908
+ 'remove'];
3909
+ if (validTypes.indexOf(type) !== -1) {
3910
+ parent.notify('draw', { prop: 'redrawDownScale' });
3911
+ }
3518
3912
  }
3519
3913
  }
3520
3914
  };
3521
3915
  ToolbarModule.prototype.performDefTbrClick = function (type, isContextualToolbar, isDisabledAdjustment, isDisabledFilter, isFilterFinetune) {
3522
3916
  var parent = this.parent;
3523
- var zoomIn = parent.element.querySelector('#' + parent.element.id + '_zoomIn');
3917
+ var id = parent.element.id;
3918
+ var zoomIn = parent.element.querySelector('#' + id + '_zoomIn');
3524
3919
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
3525
3920
  var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
3526
3921
  var isCropSelection = false;
@@ -3580,23 +3975,33 @@ var ToolbarModule = /** @class */ (function () {
3580
3975
  parent.okBtn();
3581
3976
  this.refreshDropDownBtn(false);
3582
3977
  this.currentToolbar = 'main';
3978
+ parent.isStraightening = false;
3583
3979
  break;
3584
3980
  case 'crop':
3585
3981
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
3982
+ if (Browser.isDevice) {
3983
+ this.updateContextualToolbar('color', 'straighten');
3984
+ }
3586
3985
  break;
3587
3986
  case 'reset':
3588
3987
  parent.reset();
3589
3988
  this.imageHeight = null;
3590
3989
  this.imageWidth = null;
3591
- this.parent.aspectHeight = null;
3592
- this.parent.aspectWidth = null;
3990
+ parent.aspectHeight = null;
3991
+ parent.aspectWidth = null;
3593
3992
  this.isAspectRatio = true;
3594
3993
  this.currentToolbar = 'main';
3595
3994
  break;
3596
3995
  case 'undo':
3996
+ if (parent.togglePen) {
3997
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar } });
3998
+ }
3597
3999
  parent.notify('undo-redo', { prop: 'call-undo' });
3598
4000
  break;
3599
4001
  case 'redo':
4002
+ if (parent.togglePen) {
4003
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar } });
4004
+ }
3600
4005
  parent.notify('undo-redo', { prop: 'call-redo' });
3601
4006
  break;
3602
4007
  case 'aspectratio':
@@ -3607,6 +4012,11 @@ var ToolbarModule = /** @class */ (function () {
3607
4012
  parent.aspectHeight = getComponent(aspectRatioHeight, 'numerictextbox').value;
3608
4013
  parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: null, isAspectRatio: true } });
3609
4014
  }
4015
+ else if (getComponent(aspectRatioHeight, 'numerictextbox').value) {
4016
+ parent.aspectWidth = parseFloat(getComponent(aspectRatioWidth, 'numerictextbox').placeholder);
4017
+ parent.aspectHeight = getComponent(aspectRatioHeight, 'numerictextbox').value;
4018
+ parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: true } });
4019
+ }
3610
4020
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
3611
4021
  height: parent.img.srcHeight };
3612
4022
  this.refreshToolbar('resize');
@@ -3623,6 +4033,7 @@ var ToolbarModule = /** @class */ (function () {
3623
4033
  parseFloat(getComponent(aspectRatioHeight, 'numerictextbox').placeholder);
3624
4034
  parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
3625
4035
  }
4036
+ parent.cancelCropSelection = null;
3626
4037
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
3627
4038
  height: parent.img.srcHeight };
3628
4039
  this.refreshToolbar('resize');
@@ -3640,6 +4051,8 @@ var ToolbarModule = /** @class */ (function () {
3640
4051
  }
3641
4052
  this.refreshToolbar('adjustment');
3642
4053
  parent.setTempFilterProperties();
4054
+ parent.notify('draw', { prop: 'updateFinetune' });
4055
+ parent.notify('filter', { prop: 'setTempAdjVal' });
3643
4056
  this.openSlider('brightness');
3644
4057
  }
3645
4058
  break;
@@ -3695,11 +4108,11 @@ var ToolbarModule = /** @class */ (function () {
3695
4108
  parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
3696
4109
  value: { item: 'bold' } });
3697
4110
  }
3698
- if (parent.element.querySelector('#' + parent.element.id + '_bold').classList.contains('e-selected-btn')) {
3699
- parent.element.querySelector('#' + parent.element.id + '_bold').classList.remove('e-selected-btn');
4111
+ if (parent.element.querySelector('#' + id + '_bold').classList.contains('e-selected-btn')) {
4112
+ parent.element.querySelector('#' + id + '_bold').classList.remove('e-selected-btn');
3700
4113
  }
3701
4114
  else {
3702
- parent.element.querySelector('#' + parent.element.id + '_bold').classList.add('e-selected-btn');
4115
+ parent.element.querySelector('#' + id + '_bold').classList.add('e-selected-btn');
3703
4116
  }
3704
4117
  break;
3705
4118
  case 'italic':
@@ -3720,36 +4133,41 @@ var ToolbarModule = /** @class */ (function () {
3720
4133
  parent.notify('shape', { prop: 'applyFontStyle', onPropertyChange: false,
3721
4134
  value: { item: 'italic' } });
3722
4135
  }
3723
- if (parent.element.querySelector('#' + parent.element.id + '_italic').classList.contains('e-selected-btn')) {
3724
- parent.element.querySelector('#' + parent.element.id + '_italic').classList.remove('e-selected-btn');
4136
+ if (parent.element.querySelector('#' + id + '_italic').classList.contains('e-selected-btn')) {
4137
+ parent.element.querySelector('#' + id + '_italic').classList.remove('e-selected-btn');
3725
4138
  }
3726
4139
  else {
3727
- parent.element.querySelector('#' + parent.element.id + '_italic').classList.add('e-selected-btn');
4140
+ parent.element.querySelector('#' + id + '_italic').classList.add('e-selected-btn');
3728
4141
  }
3729
4142
  break;
3730
4143
  case 'croptransform':
3731
- if (parent.currObjType.isFiltered) {
3732
- parent.okBtn();
3733
- }
3734
- this.refreshToolbar('croptransform');
4144
+ this.performCropTransformClick();
3735
4145
  break;
3736
4146
  case 'rotateleft':
3737
4147
  case 'rotateright':
3738
4148
  case 'horizontalflip':
3739
4149
  case 'verticalflip':
3740
4150
  parent.transformSelect(type);
4151
+ if (type === 'rotateleft' || type === 'rotateright') {
4152
+ parent.notify('draw', { prop: 'resetStraightenDestPoints' });
4153
+ parent.notify('draw', { prop: 'setDestForStraighten' });
4154
+ }
3741
4155
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
4156
+ if (Browser.isDevice) {
4157
+ this.updateContextualToolbar('color', 'straighten');
4158
+ }
3742
4159
  break;
3743
4160
  case 'save':
3744
- if (parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.contains('e-hide')) {
3745
- parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.remove('e-hide');
4161
+ if (parent.element.querySelector('#' + id + '_saveBtn').classList.contains('e-hide')) {
4162
+ parent.element.querySelector('#' + id + '_saveBtn').classList.remove('e-hide');
4163
+ parent.element.querySelector('#' + id + '_saveBtn').focus();
3746
4164
  break;
3747
4165
  }
3748
4166
  else {
3749
4167
  parent.okBtn();
3750
4168
  }
3751
- parent.element.querySelector('#' + parent.element.id + '_saveBtn').classList.add('e-hide');
3752
- parent.element.querySelector('#' + parent.element.id + '_saveBtn').click();
4169
+ parent.element.querySelector('#' + id + '_saveBtn').classList.add('e-hide');
4170
+ parent.element.querySelector('#' + id + '_saveBtn').click();
3753
4171
  break;
3754
4172
  case 'transparency':
3755
4173
  this.updateContextualToolbar('transparency', 'transparency');
@@ -3764,8 +4182,8 @@ var ToolbarModule = /** @class */ (function () {
3764
4182
  case 'inset':
3765
4183
  case 'hook':
3766
4184
  this.unselectFrameBtn();
3767
- if (parent.element.querySelector('#' + parent.element.id + '_' + type)) {
3768
- parent.element.querySelector('#' + parent.element.id + '_' + type).classList.add('e-selected-btn');
4185
+ if (parent.element.querySelector('#' + id + '_' + type)) {
4186
+ parent.element.querySelector('#' + id + '_' + type).classList.add('e-selected-btn');
3769
4187
  }
3770
4188
  parent.frameObj.type = type;
3771
4189
  parent.frameObj.size = 20;
@@ -3780,16 +4198,20 @@ var ToolbarModule = /** @class */ (function () {
3780
4198
  }
3781
4199
  this.refreshToolbar('frame');
3782
4200
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
4201
+ parent.isFrameBtnClick = true;
4202
+ parent.curFrameObjEvent = { previousFrameSetting: parent.tempFrameObj, currentFrameSetting: parent.frameObj };
3783
4203
  break;
3784
4204
  }
3785
4205
  }
3786
4206
  };
3787
4207
  ToolbarModule.prototype.frameToolbarClick = function () {
3788
4208
  var parent = this.parent;
3789
- var frame = document.querySelector('#' + parent.element.id + '_frame');
4209
+ var id = parent.element.id;
4210
+ var frame = document.querySelector('#' + id + '_frame');
3790
4211
  var zoom;
3791
4212
  var frameObj;
3792
4213
  var tempFrameObj;
4214
+ parent.notify('draw', { prop: 'updateCropSelection', onPropertyChange: false });
3793
4215
  if (parent.currObjType.isFiltered) {
3794
4216
  parent.okBtn();
3795
4217
  }
@@ -3802,7 +4224,7 @@ var ToolbarModule = /** @class */ (function () {
3802
4224
  this.callFrameToolbar();
3803
4225
  parent.frameObj.type = 'mat';
3804
4226
  this.callFrameToolbar();
3805
- parent.cxtTbarHeight = parent.element.querySelector('#' + parent.element.id + '_customizeWrapper').clientHeight;
4227
+ parent.cxtTbarHeight = parent.element.querySelector('#' + id + '_customizeWrapper').scrollHeight;
3806
4228
  parent.frameObj = frameObj;
3807
4229
  parent.tempFrameObj = tempFrameObj;
3808
4230
  }
@@ -3831,20 +4253,21 @@ var ToolbarModule = /** @class */ (function () {
3831
4253
  this.isFrameToolbar = true;
3832
4254
  };
3833
4255
  ToolbarModule.prototype.resizeClick = function () {
3834
- this.parent.upperCanvas.style.cursor = 'default';
3835
- this.parent.notify('transform', { prop: 'updateResize', value: { bool: false } });
4256
+ var parent = this.parent;
4257
+ parent.notify('draw', { prop: 'updateCropSelection', onPropertyChange: false });
4258
+ parent.upperCanvas.style.cursor = 'default';
4259
+ parent.notify('transform', { prop: 'updateResize', value: { bool: false } });
3836
4260
  if (this.isAspectRatio) {
3837
4261
  this.isAspectRatio = false;
3838
4262
  }
3839
4263
  else {
3840
4264
  this.isAspectRatio = true;
3841
4265
  }
3842
- this.parent.isResize = true;
4266
+ parent.isResize = true;
3843
4267
  this.refreshToolbar('resize');
3844
4268
  };
3845
4269
  ToolbarModule.prototype.callFrameToolbar = function () {
3846
4270
  var parent = this.parent;
3847
- parent.notify('draw', { prop: 'setTempFrame', value: { frame: parent.frameObj.type } });
3848
4271
  extend(parent.tempFrameObj, parent.frameObj);
3849
4272
  var undoRedoObj = { appliedUndoRedoColl: [] };
3850
4273
  parent.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: undoRedoObj } });
@@ -3875,8 +4298,11 @@ var ToolbarModule = /** @class */ (function () {
3875
4298
  document.getElementById(args.item.id + 'Canvas').parentElement.parentElement.classList.add('e-selected');
3876
4299
  parent.currObjType.isFiltered = true;
3877
4300
  parent.notify('filter', { prop: 'applyImageFilter', value: { option: type.toLowerCase() } });
4301
+ parent.notify('draw', { prop: 'redrawDownScale' });
3878
4302
  parent.currentFilter = args.item.id;
3879
4303
  this.enableDisableTbrBtn();
4304
+ parent.isFilterCanvasClick = true;
4305
+ parent.curFilterObjEvent = imageFiltering;
3880
4306
  };
3881
4307
  ToolbarModule.prototype.refreshShapeDrawing = function () {
3882
4308
  var parent = this.parent;
@@ -3889,69 +4315,93 @@ var ToolbarModule = /** @class */ (function () {
3889
4315
  }
3890
4316
  };
3891
4317
  ToolbarModule.prototype.zoomInBtnClickHandler = function (e) {
3892
- var parent = this.parent;
3893
- if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
3894
- if (parent.currObjType.isFiltered) {
3895
- parent.okBtn();
3896
- }
3897
- this.refreshShapeDrawing();
3898
- if (Browser.isDevice && e.type === 'touchstart') {
3899
- if (!e.returnValue) {
3900
- return;
4318
+ if (e) {
4319
+ var parent_1 = this.parent;
4320
+ if ((parent_1.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
4321
+ if (parent_1.currObjType.isFiltered) {
4322
+ parent_1.okBtn();
4323
+ }
4324
+ this.refreshShapeDrawing();
4325
+ if (Browser.isDevice && e.type === 'touchstart') {
4326
+ if (!e.returnValue) {
4327
+ return;
4328
+ }
4329
+ e.preventDefault();
4330
+ }
4331
+ var zoomIn = document.querySelector('#' + parent_1.element.id + '_zoomIn');
4332
+ EventHandler.trigger(zoomIn, 'click');
4333
+ var obj = { bool: false };
4334
+ parent_1.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
4335
+ if (obj['bool']) {
4336
+ parent_1.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
4337
+ this.destroyQuickAccessToolbar();
4338
+ }
4339
+ parent_1.isZoomBtnClick = true;
4340
+ this.applyPreviewFilter();
4341
+ parent_1.currObjType.isFiltered = false;
4342
+ if (parent_1.togglePen) {
4343
+ parent_1.currObjType.isZoomed = true;
4344
+ parent_1.freeHandDraw(false);
4345
+ parent_1.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
4346
+ }
4347
+ parent_1.notify('draw', { prop: 'resetCurrentSelectionPoint' });
4348
+ parent_1.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4349
+ value: { zoomFactor: .1, zoomPoint: null, isResize: null } });
4350
+ parent_1.notify('draw', { prop: 'redrawDownScale' });
4351
+ if (parent_1.isCropTab || parent_1.activeObj.shape) {
4352
+ parent_1.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
4353
+ parent_1.notify('freehand-draw', { prop: 'resetStraightenPoint' });
4354
+ }
4355
+ if (parent_1.isStraightening) {
4356
+ parent_1.notify('draw', { prop: 'resetStraightenDestPoints' });
4357
+ parent_1.notify('draw', { prop: 'setDestForStraighten' });
3901
4358
  }
3902
- e.preventDefault();
3903
- }
3904
- var zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
3905
- EventHandler.trigger(zoomIn, 'click');
3906
- var obj = { bool: false };
3907
- parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
3908
- if (obj['bool']) {
3909
- parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
3910
- this.destroyQuickAccessToolbar();
3911
- }
3912
- this.applyPreviewFilter();
3913
- parent.currObjType.isFiltered = false;
3914
- if (parent.togglePen) {
3915
- parent.currObjType.isZoomed = true;
3916
- parent.freeHandDraw(false);
3917
- parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
3918
4359
  }
3919
- parent.notify('draw', { prop: 'resetCurrentSelectionPoint' });
3920
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3921
- value: { zoomFactor: .1, zoomPoint: null, isResize: null } });
3922
4360
  }
3923
4361
  };
3924
4362
  ToolbarModule.prototype.zoomOutBtnClickHandler = function (e) {
3925
- var parent = this.parent;
3926
- if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
3927
- if (parent.currObjType.isFiltered) {
3928
- parent.okBtn();
3929
- }
3930
- this.refreshShapeDrawing();
3931
- if (Browser.isDevice && e.type === 'touchstart') {
3932
- if (!e.returnValue) {
3933
- return;
4363
+ if (e) {
4364
+ var parent_2 = this.parent;
4365
+ if ((parent_2.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
4366
+ if (parent_2.currObjType.isFiltered) {
4367
+ parent_2.okBtn();
4368
+ }
4369
+ this.refreshShapeDrawing();
4370
+ if (Browser.isDevice && e.type === 'touchstart') {
4371
+ if (!e.returnValue) {
4372
+ return;
4373
+ }
4374
+ e.preventDefault();
4375
+ }
4376
+ var zoomOut = document.querySelector('#' + parent_2.element.id + '_zoomOut');
4377
+ EventHandler.trigger(zoomOut, 'click');
4378
+ var obj = { bool: false };
4379
+ parent_2.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
4380
+ if (obj['bool']) {
4381
+ parent_2.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
4382
+ this.destroyQuickAccessToolbar();
4383
+ }
4384
+ parent_2.isZoomBtnClick = true;
4385
+ this.applyPreviewFilter();
4386
+ parent_2.currObjType.isFiltered = false;
4387
+ if (parent_2.togglePen) {
4388
+ parent_2.currObjType.isZoomed = true;
4389
+ parent_2.freeHandDraw(false);
4390
+ parent_2.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
4391
+ }
4392
+ parent_2.notify('draw', { prop: 'resetCurrentSelectionPoint' });
4393
+ parent_2.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4394
+ value: { zoomFactor: -.1, zoomPoint: null, isResize: null } });
4395
+ parent_2.notify('draw', { prop: 'redrawDownScale' });
4396
+ if (parent_2.isCropTab || parent_2.activeObj.shape) {
4397
+ parent_2.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
4398
+ parent_2.notify('freehand-draw', { prop: 'resetStraightenPoint' });
4399
+ }
4400
+ if (parent_2.isStraightening) {
4401
+ parent_2.notify('draw', { prop: 'resetStraightenDestPoints' });
4402
+ parent_2.notify('draw', { prop: 'setDestForStraighten' });
3934
4403
  }
3935
- e.preventDefault();
3936
- }
3937
- var zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
3938
- EventHandler.trigger(zoomOut, 'click');
3939
- var obj = { bool: false };
3940
- parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
3941
- if (obj['bool']) {
3942
- parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
3943
- this.destroyQuickAccessToolbar();
3944
- }
3945
- this.applyPreviewFilter();
3946
- parent.currObjType.isFiltered = false;
3947
- if (parent.togglePen) {
3948
- parent.currObjType.isZoomed = true;
3949
- parent.freeHandDraw(false);
3950
- parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
3951
4404
  }
3952
- parent.notify('draw', { prop: 'resetCurrentSelectionPoint' });
3953
- parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
3954
- value: { zoomFactor: -.1, zoomPoint: null, isResize: null } });
3955
4405
  }
3956
4406
  };
3957
4407
  ToolbarModule.prototype.zoomInBtnMouseDownHandler = function (e) {
@@ -3968,63 +4418,71 @@ var ToolbarModule = /** @class */ (function () {
3968
4418
  };
3969
4419
  ToolbarModule.prototype.closeContextualToolbar = function () {
3970
4420
  var parent = this.parent;
4421
+ var id = parent.element.id;
3971
4422
  var isContextualToolbar = false;
3972
- if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
3973
- !parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
3974
- (parent.element.querySelector('#' + parent.element.id + '_headWrapper')
3975
- && !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
3976
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3977
- parent.okBtn();
3978
- this.refreshMainToolbar();
3979
- isContextualToolbar = true;
4423
+ var straightenObj = { bool: parent.isStraightening };
4424
+ if (!Browser.isDevice || (Browser.isDevice && !straightenObj['bool'])) {
4425
+ if ((parent.element.querySelector('#' + id + '_contextualToolbar') &&
4426
+ !parent.element.querySelector('#' + id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
4427
+ (parent.element.querySelector('#' + id + '_headWrapper')
4428
+ && !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
4429
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
4430
+ parent.okBtn();
4431
+ this.refreshMainToolbar();
4432
+ isContextualToolbar = true;
4433
+ }
3980
4434
  }
3981
4435
  return isContextualToolbar;
3982
4436
  };
3983
4437
  ToolbarModule.prototype.destroyQuickAccessToolbar = function () {
3984
4438
  var parent = this.parent;
3985
- var quickToolbar = document.getElementById(parent.element.id + '_quickAccessToolbar');
4439
+ var id = parent.element.id;
4440
+ var quickToolbar = document.getElementById(id + '_quickAccessToolbar');
3986
4441
  if (quickToolbar && quickToolbar.classList.contains('e-control')) {
3987
4442
  getComponent(quickToolbar, 'toolbar').destroy();
3988
4443
  }
3989
- var qatArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
4444
+ var qatArea = document.getElementById(id + '_quickAccessToolbarArea');
3990
4445
  if (qatArea) {
3991
4446
  qatArea.style.display = 'none';
3992
4447
  }
3993
4448
  };
3994
- ToolbarModule.prototype.renderSlider = function (type) {
4449
+ ToolbarModule.prototype.renderSlider = function (type, isSelect) {
3995
4450
  var parent = this.parent;
3996
- var canvasWrapper = document.querySelector('#' + parent.element.id + '_contextualToolbarArea');
3997
- var hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
3998
- var labelWrapper = document.querySelector('#' + parent.element.id + '_labelWrapper');
3999
- if (!hdrWrapper) {
4000
- hdrWrapper = canvasWrapper.appendChild(parent.createElement('div', {
4001
- id: parent.element.id + '_headWrapper',
4002
- styles: 'position: relative'
4451
+ var id = parent.element.id;
4452
+ var canvasWrapper = document.querySelector('#' + id + '_contextualToolbarArea');
4453
+ var hdrWrapper = document.querySelector('#' + id + '_headWrapper');
4454
+ var labelWrapper = document.querySelector('#' + id + '_labelWrapper');
4455
+ if (hdrWrapper) {
4456
+ hdrWrapper.remove();
4457
+ labelWrapper.remove();
4458
+ }
4459
+ hdrWrapper = canvasWrapper.appendChild(parent.createElement('div', {
4460
+ id: id + '_headWrapper',
4461
+ styles: 'position: relative'
4462
+ }));
4463
+ if (type === 'transparency') {
4464
+ labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
4465
+ id: id + '_labelWrapper',
4466
+ styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4467
+ : 'position: absolute; top: 25%; left: calc(50% - 250px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4003
4468
  }));
4004
- if (type === 'transparency') {
4005
- labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
4006
- id: parent.element.id + '_labelWrapper',
4007
- styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 175px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4008
- : 'position: absolute; top: 25%; left: calc(50% - 250px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4009
- }));
4010
- }
4011
- else {
4012
- labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
4013
- id: parent.element.id + '_labelWrapper',
4014
- styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4015
- : 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4016
- }));
4017
- }
4018
4469
  }
4019
4470
  else {
4020
- hdrWrapper.style.display = 'block';
4471
+ labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
4472
+ id: id + '_labelWrapper',
4473
+ styles: Browser.isDevice ? ('position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;')
4474
+ : 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4475
+ }));
4021
4476
  }
4022
- labelWrapper.textContent = this.l10n.getConstant(parent.toPascalCase(type));
4477
+ labelWrapper.textContent = this.l10n.getConstant(parent.toPascalCase(type === 'transparency' ? 'opacity' : type));
4023
4478
  var sliderWrapper = hdrWrapper.appendChild(parent.createElement('div', {
4024
- id: parent.element.id + '_sliderWrapper',
4479
+ id: id + '_sliderWrapper',
4025
4480
  styles: 'position: absolute'
4026
4481
  }));
4027
4482
  var value = parent.getCurrAdjustmentValue(type);
4483
+ if (isSelect && type === 'straighten' && Browser.isDevice) {
4484
+ value = parent.cropObj.straighten;
4485
+ }
4028
4486
  var min;
4029
4487
  var max;
4030
4488
  var slider;
@@ -4087,34 +4545,106 @@ var ToolbarModule = /** @class */ (function () {
4087
4545
  max = 100;
4088
4546
  slider = this.createSlider(min, max, value, type);
4089
4547
  }
4090
- slider.appendTo('#' + parent.element.id + '_sliderWrapper');
4548
+ else if (type === 'straighten') {
4549
+ min = -45;
4550
+ max = 45;
4551
+ slider = this.createSlider(min, max, value, type);
4552
+ }
4553
+ slider.appendTo('#' + id + '_sliderWrapper');
4091
4554
  sliderWrapper.style.left = (parseFloat(canvasWrapper.style.width) - parseFloat(slider.width)) / 2 + 'px';
4555
+ if (type === 'straighten' && Browser.isDevice) {
4556
+ var sLabelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
4557
+ id: id + '_sLabelWrapper',
4558
+ className: 'e-ie-straighten-value-span',
4559
+ styles: 'position: absolute; top: 25%; margin-left: 20px; font-size: 15px; text-transform: capitalize; font-weight: 400;'
4560
+ }));
4561
+ sLabelWrapper.innerHTML = parent.transform.straighten.toString() + '&#176';
4562
+ sliderWrapper.parentElement.classList.add('e-straighten-slider');
4563
+ }
4564
+ if (type !== 'straighten') {
4565
+ hdrWrapper.appendChild(parent.createElement('label', {
4566
+ id: id + '_finetuneSpan',
4567
+ className: 'e-ie-finetune-value-span',
4568
+ styles: Browser.isDevice ? ('position: absolute; top: 25%; margin-left: 20px; font-size: 15px; text-transform: capitalize; font-weight: 400;') :
4569
+ 'position: absolute; top: 25%; left: calc(50% + 190px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
4570
+ }));
4571
+ sliderWrapper.parentElement.classList.add('e-finetune-slider');
4572
+ this.updateFinetuneSpan(type);
4573
+ }
4092
4574
  };
4093
4575
  ToolbarModule.prototype.createSlider = function (min, max, value, type) {
4094
4576
  var _this = this;
4095
4577
  var parent = this.parent;
4578
+ var step = type === 'straighten' ? 3 : 1;
4096
4579
  return new Slider({
4097
- value: value,
4098
- tooltip: { isVisible: true, placement: 'Before', showOn: 'Always' },
4099
- type: 'MinRange',
4100
- min: min,
4101
- max: max,
4102
- step: 10,
4103
- width: Browser.isDevice ? '200px' : '300px',
4580
+ value: value, type: 'MinRange', min: min, max: max,
4581
+ step: step, width: Browser.isDevice ? '180px' : (type === 'straighten' ? '200px' : '300px'),
4104
4582
  cssClass: 'e-slider',
4105
4583
  change: function (args) {
4106
4584
  if (type === 'transparency') {
4107
- parent.activeObj.imageTransparency = args.value / 100;
4108
- _this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
4109
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
4585
+ if (parent.activeObj.shape) {
4586
+ var prevCropObj = void 0;
4587
+ var prevObj = void 0;
4588
+ if (isNullOrUndefined(parent.activeObj.imageRatio)) {
4589
+ parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
4590
+ }
4591
+ parent.notify('shape', { prop: 'pushActItemIntoObj' });
4592
+ prevCropObj = extend({}, parent.cropObj, {}, true);
4593
+ var object = { currObj: {} };
4594
+ parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
4595
+ prevObj = object['currObj'];
4596
+ prevObj.objColl = extend([], parent.objColl, [], true);
4597
+ prevObj.pointColl = extend([], parent.pointColl, [], true);
4598
+ prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
4599
+ var selPointCollObj = { selPointColl: null };
4600
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
4601
+ value: { obj: selPointCollObj } });
4602
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
4603
+ parent.objColl.pop();
4604
+ parent.activeObj.opacity = args.value / 100;
4605
+ _this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
4606
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
4607
+ parent.objColl.push(parent.activeObj);
4608
+ parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
4609
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
4610
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
4611
+ previousCropObj: prevCropObj, previousText: null,
4612
+ currentText: null, previousFilter: null, isCircleCrop: null } });
4613
+ parent.notify('selection', { prop: 'redrawShape', value: { obj: parent.objColl[parent.objColl.length - 1] } });
4614
+ _this.updateFinetuneSpan(type);
4615
+ }
4616
+ }
4617
+ else if (type === 'straighten') {
4618
+ parent.setStraighten(args.value);
4110
4619
  }
4111
4620
  else {
4621
+ if (parent.transform.zoomFactor && parent.transform.zoomFactor < 0) {
4622
+ parent.isFinetuning = true;
4623
+ }
4624
+ parent.notify('selection', { prop: 'setSliding', value: { bool: true } });
4112
4625
  parent.setCurrAdjustmentValue(type, args.value);
4626
+ _this.updateFinetuneSpan(type);
4113
4627
  _this.enableDisableTbrBtn();
4628
+ parent.isFinetuning = false;
4629
+ }
4630
+ },
4631
+ changed: function () {
4632
+ if (type !== 'transparency' && type !== 'straighten') {
4633
+ parent.notify('selection', { prop: 'setSliding', value: { bool: false } });
4634
+ parent.notify('draw', { prop: 'redrawDownScale' });
4114
4635
  }
4115
4636
  }
4116
4637
  });
4117
4638
  };
4639
+ ToolbarModule.prototype.updateFinetuneSpan = function (type) {
4640
+ var parent = this.parent;
4641
+ var ftValPan = parent.element.querySelector('.e-ie-finetune-value-span');
4642
+ if (ftValPan) {
4643
+ var adjObj = { adjustmentLevel: null };
4644
+ parent.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false, value: { obj: adjObj } });
4645
+ ftValPan.innerHTML = Math.round(adjObj['adjustmentLevel'][type]).toString();
4646
+ }
4647
+ };
4118
4648
  ToolbarModule.prototype.applyPreviewFilter = function () {
4119
4649
  var parent = this.parent;
4120
4650
  if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
@@ -4126,14 +4656,15 @@ var ToolbarModule = /** @class */ (function () {
4126
4656
  };
4127
4657
  ToolbarModule.prototype.unselectBtn = function () {
4128
4658
  var parent = this.parent;
4659
+ var id = parent.element.id;
4129
4660
  var selectors = [
4130
- '#' + parent.element.id + '_brightness',
4131
- '#' + parent.element.id + '_contrast',
4132
- '#' + parent.element.id + '_hue',
4133
- '#' + parent.element.id + '_saturation',
4134
- '#' + parent.element.id + '_opacity',
4135
- '#' + parent.element.id + '_blur',
4136
- '#' + parent.element.id + '_exposure'
4661
+ '#' + id + '_brightness',
4662
+ '#' + id + '_contrast',
4663
+ '#' + id + '_hue',
4664
+ '#' + id + '_saturation',
4665
+ '#' + id + '_opacity',
4666
+ '#' + id + '_blur',
4667
+ '#' + id + '_exposure'
4137
4668
  ];
4138
4669
  for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) {
4139
4670
  var selector = selectors_1[_i];
@@ -4151,10 +4682,11 @@ var ToolbarModule = /** @class */ (function () {
4151
4682
  document.getElementById(this.parent.element.id + '_' + type).classList.add('e-selected-btn');
4152
4683
  };
4153
4684
  ToolbarModule.prototype.refreshSlider = function () {
4154
- var sliderWrapper = document.querySelector('#' + this.parent.element.id + '_sliderWrapper');
4685
+ var id = this.parent.element.id;
4686
+ var sliderWrapper = document.querySelector('#' + id + '_sliderWrapper');
4155
4687
  // eslint-disable-next-line
4156
4688
  var slider = document.querySelector('.e-slider');
4157
- var hdrWrapper = document.querySelector('#' + this.parent.element.id + '_headWrapper');
4689
+ var hdrWrapper = document.querySelector('#' + id + '_headWrapper');
4158
4690
  if (hdrWrapper) {
4159
4691
  hdrWrapper.style.display = 'none';
4160
4692
  }
@@ -4165,13 +4697,14 @@ var ToolbarModule = /** @class */ (function () {
4165
4697
  };
4166
4698
  ToolbarModule.prototype.unselectFrameBtn = function () {
4167
4699
  var parent = this.parent;
4700
+ var id = parent.element.id;
4168
4701
  var selectors = [
4169
- '#' + parent.element.id + '_none',
4170
- '#' + parent.element.id + '_mat',
4171
- '#' + parent.element.id + '_line',
4172
- '#' + parent.element.id + '_inset',
4173
- '#' + parent.element.id + '_bevel',
4174
- '#' + parent.element.id + '_hook'
4702
+ '#' + id + '_none',
4703
+ '#' + id + '_mat',
4704
+ '#' + id + '_line',
4705
+ '#' + id + '_inset',
4706
+ '#' + id + '_bevel',
4707
+ '#' + id + '_hook'
4175
4708
  ];
4176
4709
  for (var _i = 0, selectors_2 = selectors; _i < selectors_2.length; _i++) {
4177
4710
  var selector = selectors_2[_i];
@@ -4184,6 +4717,7 @@ var ToolbarModule = /** @class */ (function () {
4184
4717
  };
4185
4718
  ToolbarModule.prototype.updateToolbarItems = function () {
4186
4719
  var parent = this.parent;
4720
+ var id = parent.element.id;
4187
4721
  if (!parent.isImageLoaded) {
4188
4722
  return;
4189
4723
  }
@@ -4194,78 +4728,93 @@ var ToolbarModule = /** @class */ (function () {
4194
4728
  var strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
4195
4729
  var fontFamilyElem = parent.element.querySelector('.e-text-font-family');
4196
4730
  var fontSizeElem = parent.element.querySelector('.e-text-font-size');
4197
- var boldBtn = parent.element.querySelector('#' + parent.element.id + '_bold');
4198
- var italicBtn = parent.element.querySelector('#' + parent.element.id + '_italic');
4199
- if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
4200
- parent.activeObj.strokeSettings.strokeWidth = 2;
4201
- }
4202
- if (selFillElem) {
4203
- if (parent.activeObj.strokeSettings.fillColor === '') {
4204
- selFillElem.classList.add('e-nocolor-item');
4731
+ var boldBtn = parent.element.querySelector('#' + id + '_bold');
4732
+ var italicBtn = parent.element.querySelector('#' + id + '_italic');
4733
+ if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
4734
+ if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
4735
+ parent.activeObj.strokeSettings.strokeWidth = 2;
4205
4736
  }
4206
- else {
4207
- selFillElem.classList.remove('e-nocolor-item');
4208
- selFillElem.style.background = parent.activeObj.strokeSettings.fillColor;
4737
+ if (selFillElem) {
4738
+ var value = parent.activeObj.strokeSettings.fillColor;
4739
+ if (parent.activeObj.strokeSettings.fillColor === '') {
4740
+ selFillElem.classList.add('e-nocolor-item');
4741
+ }
4742
+ else {
4743
+ selFillElem.classList.remove('e-nocolor-item');
4744
+ selFillElem.style.background = value;
4745
+ }
4746
+ if (document.querySelector('#' + id + '_shape_fill')) {
4747
+ getComponent(id + '_shape_fill', 'colorpicker').value = value;
4748
+ }
4209
4749
  }
4210
- getComponent(parent.element.id + '_shape_fill', 'colorpicker').value
4211
- = parent.activeObj.strokeSettings.fillColor + 'ff';
4212
- }
4213
- if (selStrokeElem) {
4214
- selStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
4215
- getComponent(parent.element.id + '_shape_stroke', 'colorpicker').value
4216
- = parent.activeObj.strokeSettings.strokeColor + 'ff';
4217
- }
4218
- if (selTextStrokeElem) {
4219
- selTextStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
4220
- getComponent(parent.element.id + '_text_font', 'colorpicker').value
4221
- = parent.activeObj.strokeSettings.strokeColor + 'ff';
4222
- }
4223
- if (selPenStrokeElem) {
4224
- selPenStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
4225
- getComponent(parent.element.id + '_pen_stroke', 'colorpicker').value
4226
- = parent.activeObj.strokeSettings.strokeColor + 'ff';
4227
- }
4228
- if (fontFamilyElem) {
4229
- if (Browser.isDevice) {
4230
- fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
4750
+ if (selStrokeElem) {
4751
+ var value = parent.activeObj.strokeSettings.strokeColor;
4752
+ selStrokeElem.style.background = value;
4753
+ if (document.querySelector('#' + id + '_shape_stroke')) {
4754
+ getComponent(id + '_shape_stroke', 'colorpicker').value = value;
4755
+ }
4231
4756
  }
4232
- else {
4233
- fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
4757
+ if (selTextStrokeElem) {
4758
+ var value = parent.activeObj.strokeSettings.strokeColor;
4759
+ selTextStrokeElem.style.background = value;
4760
+ if (document.querySelector('#' + id + '_text_font')) {
4761
+ getComponent(id + '_text_font', 'colorpicker').value = value;
4762
+ }
4234
4763
  }
4235
- }
4236
- if (fontSizeElem) {
4237
- for (var i = 0; i < parent.fontSizeColl.length; i++) {
4238
- if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
4239
- fontSizeElem.textContent = (i + 1).toString();
4240
- break;
4764
+ if (selPenStrokeElem) {
4765
+ var value = parent.activeObj.strokeSettings.strokeColor;
4766
+ selPenStrokeElem.style.background = value;
4767
+ if (document.querySelector('#' + id + '_pen_stroke')) {
4768
+ getComponent(id + '_pen_stroke', 'colorpicker').value = value;
4241
4769
  }
4770
+ var obj = { penOpacity: 1 };
4771
+ parent.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
4242
4772
  }
4243
- }
4244
- if (boldBtn) {
4245
- if (parent.activeObj.textSettings.bold) {
4246
- boldBtn.classList.add('e-selected-btn');
4773
+ if (fontFamilyElem) {
4774
+ if (Browser.isDevice) {
4775
+ fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
4776
+ }
4777
+ else {
4778
+ fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
4779
+ }
4247
4780
  }
4248
- else {
4249
- boldBtn.classList.remove('e-selected-btn');
4781
+ if (fontSizeElem) {
4782
+ for (var i = 0; i < parent.fontSizeColl.length; i++) {
4783
+ if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
4784
+ fontSizeElem.textContent = (i + 1).toString();
4785
+ break;
4786
+ }
4787
+ }
4250
4788
  }
4251
- }
4252
- if (italicBtn) {
4253
- if (parent.activeObj.textSettings.italic) {
4254
- italicBtn.classList.add('e-selected-btn');
4789
+ if (boldBtn) {
4790
+ if (parent.activeObj.textSettings.bold) {
4791
+ boldBtn.classList.add('e-selected-btn');
4792
+ }
4793
+ else {
4794
+ boldBtn.classList.remove('e-selected-btn');
4795
+ }
4255
4796
  }
4256
- else {
4257
- italicBtn.classList.remove('e-selected-btn');
4797
+ if (italicBtn) {
4798
+ if (parent.activeObj.textSettings.italic) {
4799
+ italicBtn.classList.add('e-selected-btn');
4800
+ }
4801
+ else {
4802
+ italicBtn.classList.remove('e-selected-btn');
4803
+ }
4804
+ }
4805
+ if (strokeWidthElem) {
4806
+ var strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
4807
+ strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
4258
4808
  }
4259
- }
4260
- if (strokeWidthElem) {
4261
- var strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
4262
- strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
4263
4809
  }
4264
4810
  };
4265
4811
  ToolbarModule.prototype.getStrokeWidth = function (text) {
4266
4812
  var strokeWidth;
4267
4813
  var currentWidth = parseInt(text, 10) / 2;
4268
4814
  switch (currentWidth) {
4815
+ case 0:
4816
+ strokeWidth = this.l10n.getConstant('NoOutline');
4817
+ break;
4269
4818
  case 1:
4270
4819
  strokeWidth = this.l10n.getConstant('XSmall');
4271
4820
  break;