@syncfusion/ej2-image-editor 23.2.7 → 24.1.43

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