@syncfusion/ej2-image-editor 25.2.4 → 26.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.eslintrc.json +3 -2
  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 +2691 -830
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +2788 -887
  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 +13 -12
  12. package/src/image-editor/action/crop.d.ts +0 -1
  13. package/src/image-editor/action/crop.js +35 -77
  14. package/src/image-editor/action/draw.d.ts +3 -0
  15. package/src/image-editor/action/draw.js +198 -83
  16. package/src/image-editor/action/export.d.ts +3 -0
  17. package/src/image-editor/action/export.js +99 -41
  18. package/src/image-editor/action/filter.d.ts +0 -1
  19. package/src/image-editor/action/filter.js +4 -24
  20. package/src/image-editor/action/freehand-draw.js +30 -8
  21. package/src/image-editor/action/selection.d.ts +10 -0
  22. package/src/image-editor/action/selection.js +444 -99
  23. package/src/image-editor/action/shape.d.ts +11 -1
  24. package/src/image-editor/action/shape.js +520 -127
  25. package/src/image-editor/action/transform.d.ts +0 -1
  26. package/src/image-editor/action/transform.js +53 -69
  27. package/src/image-editor/action/undo-redo.d.ts +2 -0
  28. package/src/image-editor/action/undo-redo.js +114 -29
  29. package/src/image-editor/base/enum.d.ts +5 -1
  30. package/src/image-editor/base/enum.js +4 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +8 -6
  32. package/src/image-editor/base/image-editor.d.ts +116 -7
  33. package/src/image-editor/base/image-editor.js +385 -53
  34. package/src/image-editor/base/interface.d.ts +17 -0
  35. package/src/image-editor/base/interface.js +0 -1
  36. package/src/image-editor/renderer/toolbar.d.ts +14 -1
  37. package/src/image-editor/renderer/toolbar.js +831 -191
  38. package/styles/bootstrap-dark.css +279 -97
  39. package/styles/bootstrap-dark.scss +13 -1
  40. package/styles/bootstrap.css +282 -98
  41. package/styles/bootstrap.scss +13 -1
  42. package/styles/bootstrap4.css +280 -97
  43. package/styles/bootstrap4.scss +13 -1
  44. package/styles/bootstrap5-dark.css +280 -101
  45. package/styles/bootstrap5-dark.scss +13 -1
  46. package/styles/bootstrap5.css +280 -101
  47. package/styles/bootstrap5.scss +13 -1
  48. package/styles/fabric-dark.css +281 -97
  49. package/styles/fabric-dark.scss +13 -1
  50. package/styles/fabric.css +284 -97
  51. package/styles/fabric.scss +13 -1
  52. package/styles/fluent-dark.css +287 -101
  53. package/styles/fluent-dark.scss +13 -1
  54. package/styles/fluent.css +287 -101
  55. package/styles/fluent.scss +13 -1
  56. package/styles/fluent2.css +1852 -0
  57. package/styles/fluent2.scss +13 -0
  58. package/styles/highcontrast-light.css +279 -97
  59. package/styles/highcontrast-light.scss +13 -1
  60. package/styles/highcontrast.css +284 -97
  61. package/styles/highcontrast.scss +13 -1
  62. package/styles/image-editor/_bds-definition.scss +5 -0
  63. package/styles/image-editor/_bootstrap-dark-definition.scss +5 -0
  64. package/styles/image-editor/_bootstrap-definition.scss +5 -0
  65. package/styles/image-editor/_bootstrap4-definition.scss +5 -0
  66. package/styles/image-editor/_bootstrap5-definition.scss +5 -0
  67. package/styles/image-editor/_bootstrap5.3-definition.scss +26 -0
  68. package/styles/image-editor/_fabric-dark-definition.scss +5 -0
  69. package/styles/image-editor/_fabric-definition.scss +5 -0
  70. package/styles/image-editor/_fluent-definition.scss +5 -0
  71. package/styles/image-editor/_fluent2-definition.scss +26 -0
  72. package/styles/image-editor/_fusionnew-definition.scss +5 -0
  73. package/styles/image-editor/_highcontrast-definition.scss +5 -0
  74. package/styles/image-editor/_highcontrast-light-definition.scss +5 -0
  75. package/styles/image-editor/_layout.scss +355 -13
  76. package/styles/image-editor/_material-dark-definition.scss +5 -0
  77. package/styles/image-editor/_material-definition.scss +5 -0
  78. package/styles/image-editor/_material3-definition.scss +5 -0
  79. package/styles/image-editor/_tailwind-definition.scss +5 -0
  80. package/styles/image-editor/bootstrap-dark.css +279 -97
  81. package/styles/image-editor/bootstrap.css +282 -98
  82. package/styles/image-editor/bootstrap4.css +280 -97
  83. package/styles/image-editor/bootstrap5-dark.css +280 -101
  84. package/styles/image-editor/bootstrap5.css +280 -101
  85. package/styles/image-editor/fabric-dark.css +281 -97
  86. package/styles/image-editor/fabric.css +284 -97
  87. package/styles/image-editor/fluent-dark.css +287 -101
  88. package/styles/image-editor/fluent.css +287 -101
  89. package/styles/image-editor/fluent2.css +1852 -0
  90. package/styles/image-editor/fluent2.scss +13 -0
  91. package/styles/image-editor/highcontrast-light.css +279 -97
  92. package/styles/image-editor/highcontrast.css +284 -97
  93. package/styles/image-editor/icons/_bds.scss +1 -162
  94. package/styles/image-editor/icons/_bootstrap-dark.scss +1 -162
  95. package/styles/image-editor/icons/_bootstrap.scss +1 -162
  96. package/styles/image-editor/icons/_bootstrap4.scss +1 -162
  97. package/styles/image-editor/icons/_bootstrap5.3.scss +250 -0
  98. package/styles/image-editor/icons/_bootstrap5.scss +1 -168
  99. package/styles/image-editor/icons/_fabric-dark.scss +1 -162
  100. package/styles/image-editor/icons/_fabric.scss +1 -162
  101. package/styles/image-editor/icons/_fluent.scss +1 -168
  102. package/styles/image-editor/icons/_fluent2.scss +256 -0
  103. package/styles/image-editor/icons/_fusionnew.scss +1 -138
  104. package/styles/image-editor/icons/_highcontrast-light.scss +1 -162
  105. package/styles/image-editor/icons/_highcontrast.scss +1 -162
  106. package/styles/image-editor/icons/_material-dark.scss +2 -163
  107. package/styles/image-editor/icons/_material.scss +1 -162
  108. package/styles/image-editor/icons/_material3.scss +2 -169
  109. package/styles/image-editor/icons/_tailwind.scss +1 -162
  110. package/styles/image-editor/material-dark.css +299 -100
  111. package/styles/image-editor/material.css +302 -100
  112. package/styles/image-editor/material3-dark.css +314 -103
  113. package/styles/image-editor/material3.css +314 -103
  114. package/styles/image-editor/tailwind-dark.css +284 -97
  115. package/styles/image-editor/tailwind.css +284 -97
  116. package/styles/material-dark.css +299 -100
  117. package/styles/material-dark.scss +13 -1
  118. package/styles/material.css +302 -100
  119. package/styles/material.scss +13 -1
  120. package/styles/material3-dark.css +314 -103
  121. package/styles/material3-dark.scss +13 -1
  122. package/styles/material3.css +314 -103
  123. package/styles/material3.scss +13 -1
  124. package/styles/tailwind-dark.css +284 -97
  125. package/styles/tailwind-dark.scss +13 -1
  126. package/styles/tailwind.css +284 -97
  127. package/styles/tailwind.scss +13 -1
  128. package/CHANGELOG.md +0 -289
@@ -2,10 +2,12 @@ import { extend, Browser, detach, select } 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';
5
+ import { Button } from '@syncfusion/ej2-buttons';
5
6
  import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
6
- import { ColorPicker, Uploader, Slider } from '@syncfusion/ej2-inputs';
7
+ import { ColorPicker, Uploader, Slider, TextBox } from '@syncfusion/ej2-inputs';
7
8
  import { ZoomTrigger, ShapeType } from '../index';
8
- import { hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
9
+ import { Dialog, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
10
+ import { addClass, removeClass } from '@syncfusion/ej2-base';
9
11
  var ToolbarModule = /** @class */ (function () {
10
12
  function ToolbarModule(parent) {
11
13
  this.defToolbarItems = [];
@@ -30,6 +32,9 @@ var ToolbarModule = /** @class */ (function () {
30
32
  '#0277bd', '#00838f', '#00695c', '#f9a825', '#4d4d4d', '#b71c1c', '#880e4f', '#4a148c', '#311b92', '#0d47a1',
31
33
  '#01579b', '#006064', '#004d40', '#f57f17']
32
34
  };
35
+ this.isSlider = false;
36
+ this.currentQuality = 1;
37
+ this.imageQuality = 'highest';
33
38
  this.parent = parent;
34
39
  this.addEventListener();
35
40
  this.initLocale();
@@ -174,7 +179,23 @@ var ToolbarModule = /** @class */ (function () {
174
179
  ImageErrorDialogContent: 'Please select only one image to open.',
175
180
  Straighten: 'Straighten',
176
181
  NoOutline: 'No outline',
177
- DlgOK: 'OK'
182
+ DlgOK: 'OK',
183
+ SaveAs: 'Save As',
184
+ ImageName: 'Image name',
185
+ Format: 'Format',
186
+ Quality: 'Quality',
187
+ Download: 'Download',
188
+ Close: 'Close',
189
+ ImageSize: 'Image Size',
190
+ QualityInfo: 'The image quality option is only available for JPEG format',
191
+ Good: 'Good',
192
+ Great: 'Great',
193
+ Highest: 'Highest',
194
+ BringForward: 'Bring Forward',
195
+ SendBackward: 'Send Backward',
196
+ SendToBack: 'Send to Back',
197
+ BringToFront: 'Bring to Front',
198
+ ZOrder: 'Z-Order'
178
199
  };
179
200
  this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
180
201
  };
@@ -316,6 +337,9 @@ var ToolbarModule = /** @class */ (function () {
316
337
  case 'editText':
317
338
  this.editText();
318
339
  break;
340
+ case 'setInitialSize':
341
+ this.initialSize = Number(args.value['value']);
342
+ break;
319
343
  }
320
344
  };
321
345
  ToolbarModule.prototype.updatePrivateVariables = function () {
@@ -524,7 +548,6 @@ var ToolbarModule = /** @class */ (function () {
524
548
  _this.renderAnnotationBtn();
525
549
  }
526
550
  _this.wireZoomBtnEvents();
527
- _this.renderSaveBtn();
528
551
  parent.trigger('toolbarCreated', { toolbarType: 'main' });
529
552
  }
530
553
  });
@@ -576,11 +599,11 @@ var ToolbarModule = /** @class */ (function () {
576
599
  var toolbarItems = [];
577
600
  if (!isOkBtn || isResize) {
578
601
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Open') > -1)) {
579
- 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 }) });
602
+ toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
580
603
  toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
581
604
  }
582
605
  else if (Browser.isDevice && (parent.toolbar && parent.toolbar.indexOf('Open') === -1)) {
583
- toolbarItems.push({ visible: false, id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
606
+ toolbarItems.push({ visible: false, id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
584
607
  toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
585
608
  }
586
609
  }
@@ -626,8 +649,8 @@ var ToolbarModule = /** @class */ (function () {
626
649
  }
627
650
  if (!isOkBtn) {
628
651
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Save') > -1)) {
629
- toolbarItems.push({ id: id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
630
- tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + id + '_saveBtn"></button>' });
652
+ toolbarItems.push({ id: id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'e-caret-hide top-icon e-save',
653
+ tooltipText: this.l10n.getConstant('Save'), align: 'Right' });
631
654
  }
632
655
  }
633
656
  var tempToolbarItems = this.processToolbar('right');
@@ -746,10 +769,10 @@ var ToolbarModule = /** @class */ (function () {
746
769
  }
747
770
  }
748
771
  if (parent.toolbarTemplate) {
749
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
772
+ this.toolbarHeight = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
750
773
  }
751
- else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
752
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
774
+ else if (parent.element.querySelector('#' + id + '_toolbar')) {
775
+ this.toolbarHeight = parent.element.querySelector('#' + id + '_toolbar').clientHeight;
753
776
  }
754
777
  parent.toolbarHeight = this.toolbarHeight;
755
778
  if (Browser.isDevice) {
@@ -840,21 +863,21 @@ var ToolbarModule = /** @class */ (function () {
840
863
  return;
841
864
  }
842
865
  };
843
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
844
866
  ToolbarModule.prototype.widthAspectRatio = function (e) {
845
867
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
846
868
  if (e.keyCode === 109) {
847
869
  return;
848
870
  }
849
871
  var parent = this.parent;
850
- var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
851
- var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
852
- var icon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
872
+ var id = parent.element.id;
873
+ var aspectRatioHeight = parent.element.querySelector('#' + id + '_resizeHeight');
874
+ var aspectRatioWidth = parent.element.querySelector('#' + id + '_resizeWidth');
875
+ var icon = parent.element.querySelector('#' + id + '_aspectratio');
853
876
  var originalWidth = parent.img.destWidth;
854
877
  var originalHeight = parent.img.destHeight;
855
878
  var aspectRatioHeightValue = parseFloat(aspectRatioHeight.value);
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);
879
+ var val = aspectRatioHeightValue / (originalHeight / originalWidth);
880
+ var width = val % 1 >= 0.5 || val % 1 <= -0.5 ? Math.round(val) : (val < 0) ? Math.ceil(val) : Math.floor(val);
858
881
  var widthNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
859
882
  var heightNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
860
883
  if (icon) {
@@ -884,7 +907,6 @@ var ToolbarModule = /** @class */ (function () {
884
907
  }
885
908
  }
886
909
  };
887
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
888
910
  ToolbarModule.prototype.heightAspectRatio = function (e) {
889
911
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
890
912
  if (e.keyCode === 109) {
@@ -899,18 +921,18 @@ var ToolbarModule = /** @class */ (function () {
899
921
  var originalHeight = parent.img.destHeight;
900
922
  var aspectRatioWidthValue = parseFloat(aspectRatioWidth.value);
901
923
  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);
924
+ var ht = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
903
925
  var heightNumeric = getComponent(aspectRatioHeight, 'numerictextbox');
904
926
  var widthNumeric = getComponent(aspectRatioWidth, 'numerictextbox');
905
927
  if (icon) {
906
- if (!isNaN(height)) {
928
+ if (!isNaN(ht)) {
907
929
  if (isNullOrUndefined((heightNumeric).value)) {
908
- (heightNumeric).placeholder = height + ' px';
909
- aspectRatioHeight.placeholder = height.toString() + ' px';
930
+ (heightNumeric).placeholder = ht + ' px';
931
+ aspectRatioHeight.placeholder = ht.toString() + ' px';
910
932
  }
911
933
  else {
912
- (heightNumeric).value = height;
913
- aspectRatioHeight.value = height.toString() + ' px';
934
+ (heightNumeric).value = ht;
935
+ aspectRatioHeight.value = ht.toString() + ' px';
914
936
  }
915
937
  }
916
938
  else {
@@ -942,7 +964,7 @@ var ToolbarModule = /** @class */ (function () {
942
964
  spanWidth.innerHTML = this.l10n.getConstant('W');
943
965
  toolbarItems.push({ id: id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
944
966
  toolbarItems.push({ id: id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
945
- tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
967
+ tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: '4' },
946
968
  showSpinButton: false, value: isResize ? parent.aspectWidth : null,
947
969
  placeholder: isResize ? null : width, format: '###.## px' })
948
970
  });
@@ -950,7 +972,7 @@ var ToolbarModule = /** @class */ (function () {
950
972
  spanHeight.innerHTML = this.l10n.getConstant('H');
951
973
  toolbarItems.push({ id: id + '_height', cssClass: 'e-ie-resize-height', template: spanHeight, align: 'Center' });
952
974
  toolbarItems.push({ id: id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
953
- tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
975
+ tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: '4' },
954
976
  showSpinButton: false, value: isResize ? parent.aspectHeight : null,
955
977
  placeholder: isResize ? null : height, format: '###.## px' })
956
978
  });
@@ -993,9 +1015,6 @@ var ToolbarModule = /** @class */ (function () {
993
1015
  clicked: this.defToolbarClicked.bind(this),
994
1016
  created: function () {
995
1017
  _this.wireResizeBtnEvents();
996
- if (!Browser.isDevice) {
997
- _this.renderSaveBtn();
998
- }
999
1018
  parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1000
1019
  if (Browser.isDevice) {
1001
1020
  if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(id + '_bottomToolbar')))) {
@@ -1114,8 +1133,13 @@ var ToolbarModule = /** @class */ (function () {
1114
1133
  }
1115
1134
  };
1116
1135
  ToolbarModule.prototype.fileSelect = function (inputElement, args) {
1136
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1117
1137
  var type = inputElement.files[0].type.split('/')[1];
1118
1138
  var filesTypes = ['png', 'jpg', 'jpeg', 'svg', 'svg+xml'];
1139
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1140
+ this.fileName = inputElement.files[0].name.split('.')[0];
1141
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1142
+ this.parent.notify('toolbar', { prop: 'setInitialSize', value: { value: inputElement.files[0].size } });
1119
1143
  if (filesTypes.indexOf(type) > -1) {
1120
1144
  this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
1121
1145
  }
@@ -1171,6 +1195,7 @@ var ToolbarModule = /** @class */ (function () {
1171
1195
  var duplicateElement = document.querySelector('#' + id + '_duplicate');
1172
1196
  var removeElement = document.querySelector('#' + id + '_remove');
1173
1197
  var editTextElement = document.querySelector('#' + id + '_editText');
1198
+ var zOrderElement = document.querySelector('#' + id + '_zOrderBtn');
1174
1199
  if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
1175
1200
  (isNullOrUndefined(parent.activeObj.pointColl) || (parent.activeObj.pointColl
1176
1201
  && parent.activeObj.pointColl.length === 0)) &&
@@ -1184,6 +1209,9 @@ var ToolbarModule = /** @class */ (function () {
1184
1209
  if (editTextElement) {
1185
1210
  editTextElement.classList.add('e-disabled');
1186
1211
  }
1212
+ if (zOrderElement) {
1213
+ zOrderElement.classList.add('e-disabled');
1214
+ }
1187
1215
  }
1188
1216
  else {
1189
1217
  if (duplicateElement) {
@@ -1195,6 +1223,9 @@ var ToolbarModule = /** @class */ (function () {
1195
1223
  if (editTextElement) {
1196
1224
  editTextElement.classList.remove('e-disabled');
1197
1225
  }
1226
+ if (zOrderElement) {
1227
+ zOrderElement.classList.remove('e-disabled');
1228
+ }
1198
1229
  }
1199
1230
  var iconCss = isContextualToolbar ? this.getCurrentShapeIcon(parent.activeObj.shape) : 'e-annotation';
1200
1231
  var drpDownBtn = new DropDownButton({ items: items, iconCss: 'e-icons ' + iconCss,
@@ -1216,6 +1247,7 @@ var ToolbarModule = /** @class */ (function () {
1216
1247
  }
1217
1248
  },
1218
1249
  select: function (args) {
1250
+ parent.noPushUndo = false;
1219
1251
  _this.triggerTbarClickEvent(args);
1220
1252
  parent.okBtn();
1221
1253
  var isCropSelection = false;
@@ -1241,8 +1273,11 @@ var ToolbarModule = /** @class */ (function () {
1241
1273
  var shapeSettings;
1242
1274
  var shapeChangingArgs;
1243
1275
  drpDownBtn.iconCss = 'e-icons ' + _this.getCurrentShapeIcon(args.item.id);
1276
+ parent.notify('draw', { prop: 'updateTempObjColl' });
1277
+ parent.notify('draw', { prop: 'updateTempPointColl' });
1244
1278
  switch (args.item.id) {
1245
1279
  case 'pen':
1280
+ parent.drawingShape = null;
1246
1281
  parent.notify('draw', { prop: 'setTempFreehandCounter', value: { tempFreehandCounter: parent.freehandCounter } });
1247
1282
  parent.notify('draw', { prop: 'setTempCurrentFreehandDrawIndex', value: { tempCurrentFreehandDrawIndex: obj['currentFreehandDrawIndex'] } });
1248
1283
  _this.currentToolbar = 'pen';
@@ -1256,9 +1291,15 @@ var ToolbarModule = /** @class */ (function () {
1256
1291
  break;
1257
1292
  case 'text':
1258
1293
  _this.currentToolbar = 'text';
1259
- parent.notify('shape', { prop: 'draw-shape-text' });
1294
+ parent.drawingShape = args.item.id;
1295
+ _this.currentToolbar = 'text';
1296
+ _this.setInitialShapeSettings(args);
1297
+ parent.notify('selection', { prop: 'annotate', value: { shape: args.item.id } });
1298
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
1299
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
1260
1300
  break;
1261
1301
  case 'image':
1302
+ parent.drawingShape = null;
1262
1303
  _this.currentToolbar = 'shapes';
1263
1304
  parent.element.querySelector('#' + id + '_fileUpload').click();
1264
1305
  break;
@@ -1267,6 +1308,7 @@ var ToolbarModule = /** @class */ (function () {
1267
1308
  case 'line':
1268
1309
  case 'rectangle':
1269
1310
  case 'path':
1311
+ parent.drawingShape = args.item.id;
1270
1312
  _this.currentToolbar = 'shapes';
1271
1313
  _this.setInitialShapeSettings(args);
1272
1314
  parent.notify('selection', { prop: 'annotate', value: { shape: args.item.id } });
@@ -1353,7 +1395,9 @@ var ToolbarModule = /** @class */ (function () {
1353
1395
  iconCss = this.getCurrentShapeIcon(shapeString);
1354
1396
  shape = shapeString;
1355
1397
  }
1356
- else if (parent.activeObj.shape) {
1398
+ else if (parent.activeObj.shape &&
1399
+ (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) ||
1400
+ (parent.activeObj.shape === 'path' && parent.activeObj.pointColl.length > 0)) {
1357
1401
  iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
1358
1402
  shape = parent.activeObj.shape;
1359
1403
  }
@@ -1376,8 +1420,10 @@ var ToolbarModule = /** @class */ (function () {
1376
1420
  }
1377
1421
  if (parent.activeObj.shape && parent.activeObj.shape.split('-').length > 1) {
1378
1422
  var elem = document.getElementById(parent.activeObj.shape.split('-')[1]);
1379
- elem.classList.add('e-selected');
1380
- elem.focus();
1423
+ if (elem) {
1424
+ elem.classList.add('e-selected');
1425
+ elem.focus();
1426
+ }
1381
1427
  }
1382
1428
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
1383
1429
  },
@@ -1428,28 +1474,373 @@ var ToolbarModule = /** @class */ (function () {
1428
1474
  });
1429
1475
  drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
1430
1476
  };
1431
- ToolbarModule.prototype.renderSaveBtn = function () {
1477
+ ToolbarModule.prototype.saveDialogPopup = function () {
1432
1478
  var _this = this;
1433
1479
  var parent = this.parent;
1434
1480
  var id = parent.element.id;
1435
- var saveItems = [
1436
- { text: 'JPEG', id: 'jpeg' },
1437
- { text: 'PNG', id: 'png' },
1438
- { text: 'SVG', id: 'svg' }
1481
+ var quality = ['Good', 'Great', 'Highest'];
1482
+ parent.element.appendChild(parent.createElement('div', { id: id + '_saveDialog' }));
1483
+ var dialogContent = parent.createElement('div', {
1484
+ id: id + '_dialogContent', attrs: { style: 'display: flex;' }
1485
+ });
1486
+ var dialogImgContent = dialogContent.appendChild(parent.createElement('div', {
1487
+ id: id + '_dialogImgContent', className: 'e-ie-dlg-img-content'
1488
+ }));
1489
+ dialogImgContent.appendChild(parent.createElement('canvas', {
1490
+ id: id + '_imgPic', className: 'e-ie-img-dlg-canvas'
1491
+ }));
1492
+ var imageNameContainer = dialogImgContent.appendChild(parent.createElement('div', {
1493
+ id: id + '_imageNameContainer', className: 'e-ie-img-size'
1494
+ }));
1495
+ imageNameContainer.appendChild(parent.createElement('span', {
1496
+ id: id + '_imageNameLabel', className: 'e-ie-quality-info'
1497
+ }));
1498
+ var dialogRightContent = dialogContent.appendChild(parent.createElement('div', {
1499
+ id: id + '_dialogRightContent', className: 'e-ie-dlg-right-content'
1500
+ }));
1501
+ var imageNameDiv = dialogRightContent.appendChild(parent.createElement('div', {
1502
+ id: id + '_namediv', className: 'e-ie-img-save-name'
1503
+ }));
1504
+ imageNameDiv.appendChild(parent.createElement('span', {
1505
+ id: id + '_labelImgname', className: 'e-ie-img-label-name', innerHTML: this.l10n.getConstant('ImageName')
1506
+ }));
1507
+ imageNameDiv.appendChild(parent.createElement('input', {
1508
+ id: id + '_imgNametext', className: 'e-ie-img-input', attrs: { type: 'text' }
1509
+ }));
1510
+ var formatNameDiv = dialogRightContent.appendChild(parent.createElement('div', {
1511
+ id: id + '_imgNamediv', className: 'e-ie-img-save-dlg'
1512
+ }));
1513
+ formatNameDiv.appendChild(parent.createElement('span', {
1514
+ id: id + '_labelname', className: 'e-ie-img-label-name', innerHTML: this.l10n.getConstant('Format')
1515
+ }));
1516
+ formatNameDiv.appendChild(parent.createElement('button', {
1517
+ id: id + '_saveDropdownbtn', attrs: { tabindex: '1' }
1518
+ }));
1519
+ var qualityNameDiv = dialogRightContent.appendChild(parent.createElement('div', {
1520
+ id: id + '_imgQualitydiv', className: 'e-ie-img-quality-name'
1521
+ }));
1522
+ var qualityDiv = parent.createElement('div', {
1523
+ id: id + '_qualityContainer'
1524
+ });
1525
+ qualityDiv.appendChild(parent.createElement('span', {
1526
+ id: id + '_qualityLabel', className: 'e-ie-img-quality-label',
1527
+ innerHTML: this.l10n.getConstant('Quality')
1528
+ }));
1529
+ qualityDiv.appendChild(parent.createElement('span', {
1530
+ id: id + '_qualityInfo', className: 'e-circle-info e-icons e-ie-quality-span',
1531
+ attrs: { title: this.l10n.getConstant('QualityInfo') }
1532
+ }));
1533
+ var qualityValueElem = qualityDiv.appendChild(parent.createElement('div', {
1534
+ id: id + '_imgsizeSpan',
1535
+ className: 'e-ie-img-size-value-span'
1536
+ }));
1537
+ qualityValueElem.appendChild(parent.createElement('span', {
1538
+ id: id + '_imgsizeValueSpan', className: ''
1539
+ }));
1540
+ qualityNameDiv.appendChild(qualityDiv);
1541
+ var qualityOptionDiv = parent.createElement('div', {
1542
+ id: id + '_qualityOptionContainer', className: 'e-ie-quality-option-container'
1543
+ });
1544
+ var buttonGroup = qualityNameDiv.appendChild(parent.createElement('div', {
1545
+ id: id + '_qualityButtonGroup', className: 'e-btn-group'
1546
+ }));
1547
+ // eslint-disable-next-line @typescript-eslint/tslint/config
1548
+ quality.forEach(function (option) {
1549
+ var input = document.createElement('input');
1550
+ input.type = 'radio';
1551
+ input.id = id + '_' + option.toLowerCase();
1552
+ input.name = 'quality';
1553
+ input.value = option.toLowerCase();
1554
+ var label = document.createElement('label');
1555
+ label.className = 'e-btn';
1556
+ label.htmlFor = option.toLowerCase();
1557
+ label.textContent = _this.l10n.getConstant(option);
1558
+ buttonGroup.appendChild(input);
1559
+ buttonGroup.appendChild(label);
1560
+ });
1561
+ qualityOptionDiv.appendChild(buttonGroup);
1562
+ qualityOptionDiv.appendChild(parent.createElement('div', {
1563
+ id: id + '_qualitySlider', className: 'e-ie-img-quality-slider'
1564
+ }));
1565
+ qualityOptionDiv.appendChild(parent.createElement('button', { id: id + '_qualitybuttonIcon', className: 'e-ie-img-icon-button', attrs: { type: 'button' } }));
1566
+ qualityNameDiv.appendChild(qualityOptionDiv);
1567
+ if (Browser.isDevice) {
1568
+ qualityNameDiv.appendChild(parent.createElement('span', {
1569
+ id: id + '_qualitySize', className: 'e-ie-img-quality-size'
1570
+ }));
1571
+ }
1572
+ parent.element.querySelector('#' + id + '_saveDialog').style.display = 'block';
1573
+ parent.element.appendChild(dialogContent);
1574
+ var dialog = new Dialog({
1575
+ target: parent.element,
1576
+ header: this.l10n.getConstant('SaveAs'),
1577
+ closeOnEscape: true, content: document.getElementById(id + '_dialogContent'),
1578
+ width: Browser.isDevice ? '345px' : '570px', isModal: true, animationSettings: { effect: 'Zoom' }, beforeOpen: this.onBeforeopen(),
1579
+ close: this.saveDialogClosed.bind(this, id),
1580
+ cssClass: 'e-ie-save-dialog',
1581
+ buttons: [
1582
+ {
1583
+ 'click': function () {
1584
+ dialog.hide();
1585
+ },
1586
+ buttonModel: {
1587
+ content: this.l10n.getConstant('Close'), cssClass: 'e-save-cancel-btn'
1588
+ }
1589
+ },
1590
+ {
1591
+ 'click': function () {
1592
+ _this.download();
1593
+ dialog.hide();
1594
+ _this.isSlider = false;
1595
+ },
1596
+ buttonModel: {
1597
+ isPrimary: true, content: this.l10n.getConstant('Download'), cssClass: 'e-flat e-save-download-btn'
1598
+ }
1599
+ }
1600
+ ]
1601
+ });
1602
+ dialog.appendTo('#' + id + '_saveDialog');
1603
+ };
1604
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1605
+ ToolbarModule.prototype.saveDialogClosed = function (id) {
1606
+ if (getComponent(document.getElementById(id + '_saveDropdownbtn'), 'dropdownbutton')) {
1607
+ getComponent(document.getElementById(id + '_saveDropdownbtn'), 'dropdownbutton').destroy();
1608
+ }
1609
+ this.isSlider = false;
1610
+ if (document.querySelector('#' + id + '_qualityButtonGroup') &&
1611
+ document.querySelector('#' + id + '_qualitySlider')) {
1612
+ document.querySelector('#' + id + '_qualityButtonGroup').remove();
1613
+ document.querySelector('#' + id + '_qualitySlider').remove();
1614
+ document.querySelector('#' + id + '_imgsizeValueSpan').remove();
1615
+ document.querySelector('#' + id + '_imageNameLabel').remove();
1616
+ document.querySelector('#' + id + '_imgsizeSpan').remove();
1617
+ }
1618
+ document.getElementById(id + '_dialogContent').remove();
1619
+ getComponent(document.getElementById(id + '_saveDialog'), 'dialog').destroy();
1620
+ document.getElementById(id + '_saveDialog').remove();
1621
+ };
1622
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1623
+ ToolbarModule.prototype.onBeforeopen = function () {
1624
+ var _this = this;
1625
+ var parent = this.parent;
1626
+ var id = parent.element.id;
1627
+ var obj = { canvas: null };
1628
+ var items = [
1629
+ { id: 'jpeg', text: 'JPEG' },
1630
+ { id: 'png', text: 'PNG' },
1631
+ { id: 'svg', text: 'SVG' }
1439
1632
  ];
1440
- var ddbElem = document.getElementById(id + '_saveBtn');
1633
+ var inputObj = new TextBox({
1634
+ placeholder: this.l10n.getConstant('ImageName'),
1635
+ });
1636
+ inputObj.appendTo('#' + id + '_imgNametext');
1637
+ var qualityContainer = document.getElementById(id + '_imgQualitydiv');
1638
+ var slider = document.getElementById(id + '_qualitySlider');
1639
+ var qualityBtnGrp = document.querySelector('#' + id + '_qualityButtonGroup');
1640
+ var qualityBtnIcon = document.querySelector('#' + id + '_qualitybuttonIcon');
1641
+ var qualitySliderValue = document.querySelector('#' + id + '_imgsizeSpan');
1642
+ var imageNameLabel;
1643
+ if (Browser.isDevice) {
1644
+ imageNameLabel = document.getElementById(id + '_qualitySize');
1645
+ }
1646
+ else {
1647
+ imageNameLabel = document.getElementById(id + '_imageNameLabel');
1648
+ }
1649
+ var fileObj = { fileName: '', fileType: '' };
1650
+ parent.notify('draw', { prop: 'getFileName', onPropertyChange: false, value: { obj: fileObj } });
1651
+ this.fileType = fileObj['fileType'];
1652
+ parent.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
1653
+ var tempCanvas = obj['canvas'];
1654
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1655
+ var canvas = document.getElementById(id + '_imgPic');
1656
+ canvas.width = tempCanvas.width;
1657
+ canvas.height = tempCanvas.height;
1658
+ var buttonIcon = new Button({ iconCss: 'e-icons e-settings' });
1659
+ buttonIcon.appendTo('#' + id + '_qualitybuttonIcon');
1660
+ var ddbElem = document.getElementById(id + '_saveDropdownbtn');
1441
1661
  if (ddbElem) {
1442
- // Initialize the DropDownButton component.
1443
- var saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
1662
+ var spanElem_1 = document.createElement('span');
1663
+ spanElem_1.innerHTML = fileObj['fileType'].toUpperCase();
1664
+ if (ddbElem) {
1665
+ ddbElem.appendChild(spanElem_1);
1666
+ }
1667
+ var drpDownBtn_1 = new DropDownButton({
1668
+ items: items,
1669
+ open: function (args) {
1670
+ if (Browser.isDevice) {
1671
+ args.element.parentElement.style.top = drpDownBtn_1.element.getBoundingClientRect().top -
1672
+ args.element.parentElement.offsetHeight + 'px';
1673
+ }
1674
+ var activeBtn = spanElem_1.innerHTML;
1675
+ if (activeBtn !== '') {
1676
+ args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
1677
+ }
1678
+ },
1444
1679
  select: function (args) {
1445
- _this.triggerTbarClickEvent(args);
1446
- parent.export(args.item.text);
1447
- parent.isChangesSaved = true;
1448
- parent.notify('draw', { prop: 'redrawDownScale' });
1680
+ qualitySliderValue.style.display = 'none';
1681
+ _this.fileType = spanElem_1.innerHTML = args.item.text;
1682
+ if (args.item.id !== 'jpeg') {
1683
+ qualityContainer.style.display = 'none';
1684
+ imageNameLabel.style.display = 'block';
1685
+ if (_this.initialSize > 1000) {
1686
+ var megabytes = _this.initialSize / 1048576;
1687
+ imageNameLabel.innerHTML = _this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
1688
+ }
1689
+ else {
1690
+ imageNameLabel.innerHTML = _this.l10n.getConstant('ImageSize') + ': ' + _this.initialSize.toFixed(2) + ' KB';
1691
+ }
1692
+ if (slider) {
1693
+ if (_this.isSlider) {
1694
+ getComponent(slider, 'slider').destroy();
1695
+ }
1696
+ slider.style.display = 'none';
1697
+ }
1698
+ _this.isSlider = false;
1699
+ }
1700
+ else {
1701
+ qualityContainer.style.display = 'block';
1702
+ removeClass([qualityBtnGrp], 'e-hide');
1703
+ slider.style.display = 'none';
1704
+ imageNameLabel.style.display = 'block';
1705
+ _this.updateImageSize(isNullOrUndefined(_this.currentQuality) ? 1 : _this.currentQuality, obj['canvas']);
1706
+ document.getElementById(id + '_' + _this.imageQuality).checked = true;
1707
+ }
1449
1708
  }
1450
1709
  });
1451
- saveDrpDownBtn.appendTo('#' + id + '_saveBtn');
1710
+ drpDownBtn_1.appendTo('#' + id + '_saveDropdownbtn');
1711
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1712
+ var imgName = document.getElementById(id + '_imgNametext');
1713
+ imgName.value = this.fileName ? this.fileName : fileObj['fileName'];
1714
+ if (fileObj['fileType'].toUpperCase() !== 'JPEG') {
1715
+ qualityContainer.style.display = 'none';
1716
+ qualitySliderValue.style.display = 'none';
1717
+ }
1718
+ if (Browser.isDevice) {
1719
+ document.getElementById(id + '_dialogImgContent').style.display = 'none';
1720
+ document.getElementById(id + '_dialogRightContent').style.width = '100%';
1721
+ this.updateImageSize(1, obj['canvas']);
1722
+ }
1723
+ else {
1724
+ this.updateImageSize(1, obj['canvas']);
1725
+ }
1452
1726
  }
1727
+ document.getElementById(id + '_' + this.imageQuality).checked = true;
1728
+ qualityBtnGrp.addEventListener('click', this.qualityBtnClickHandler.bind(this));
1729
+ qualityBtnIcon.addEventListener('click', this.qualityBtnClickHandler.bind(this));
1730
+ };
1731
+ ToolbarModule.prototype.qualityBtnClickHandler = function (event) {
1732
+ var _this = this;
1733
+ var parent = this.parent;
1734
+ var id = parent.element.id;
1735
+ var target = event.target;
1736
+ var fileObj = { fileName: '' };
1737
+ var obj = { canvas: null };
1738
+ var compressionValues = {
1739
+ 'Good': 0.8,
1740
+ 'Great': 0.9,
1741
+ 'Highest': 1
1742
+ };
1743
+ var qualityBtnGrp = document.querySelector('#' + id + '_qualityButtonGroup');
1744
+ var qualitySlider = document.querySelector('#' + id + '_qualitySlider');
1745
+ var qualityOption = document.querySelector('#' + id + '_qualityOptionContainer');
1746
+ var qualitySliderValueDiv = document.querySelector('#' + id + '_imgsizeSpan');
1747
+ var qualitySliderValueSpan = document.querySelector('#' + id + '_imgsizeValueSpan');
1748
+ parent.notify('draw', { prop: 'getFileName', onPropertyChange: false, value: { obj: fileObj } });
1749
+ parent.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
1750
+ if (event.currentTarget.id === id + '_qualitybuttonIcon' && !this.isSlider) {
1751
+ addClass([qualityBtnGrp], 'e-hide');
1752
+ qualitySlider.style.display = 'block';
1753
+ qualitySliderValueDiv.style.display = 'inline-block';
1754
+ qualityOption.style.display = 'flex';
1755
+ var sliderObj = new Slider({
1756
+ tooltip: { placement: 'Before', isVisible: true, format: 'P0', showOn: 'Focus' },
1757
+ min: 0.01, max: 1, step: 0.01, value: this.currentQuality,
1758
+ type: 'MinRange',
1759
+ width: Browser.isDevice ? '80%' : '190px',
1760
+ created: function () {
1761
+ _this.updateImageSize(_this.currentQuality, obj['canvas']);
1762
+ qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
1763
+ },
1764
+ changed: function (args) {
1765
+ _this.currentQuality = args.value;
1766
+ qualitySliderValueSpan.innerHTML = (Math.round(_this.currentQuality * 100)).toString();
1767
+ parent.notify('export', { prop: 'setImageQuality', value: { value: args.value } });
1768
+ _this.updateImageSize(args.value, obj['canvas']);
1769
+ }
1770
+ });
1771
+ sliderObj.appendTo('#' + id + '_qualitySlider');
1772
+ sliderObj.element.parentElement.classList.add('e-ie-quality-slider');
1773
+ this.isSlider = true;
1774
+ }
1775
+ else if (event.currentTarget.id === id + '_qualitybuttonIcon' && this.isSlider) {
1776
+ getComponent(qualitySlider, 'slider').destroy();
1777
+ qualitySlider.style.display = 'none';
1778
+ qualitySliderValueDiv.style.display = 'none';
1779
+ removeClass([qualityBtnGrp], 'e-hide');
1780
+ qualityOption.style.display = 'block';
1781
+ this.isSlider = false;
1782
+ // eslint-disable-next-line no-prototype-builtins
1783
+ }
1784
+ else if (compressionValues.hasOwnProperty(target.textContent) && !this.isSlider) {
1785
+ event.target.previousElementSibling.checked = true;
1786
+ this.currentQuality = compressionValues[target.textContent];
1787
+ this.imageQuality = target.textContent.toLowerCase();
1788
+ this.updateImageSize(compressionValues[target.textContent], obj['canvas']);
1789
+ }
1790
+ };
1791
+ ToolbarModule.prototype.updateImageSize = function (quality, tempCanvas) {
1792
+ var fileSize;
1793
+ var parent = this.parent;
1794
+ var id = parent.element.id;
1795
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1796
+ var canvas = document.getElementById(id + '_imgPic');
1797
+ var ctx = canvas.getContext('2d');
1798
+ var imageNameLabel;
1799
+ if (Browser.isDevice) {
1800
+ imageNameLabel = document.getElementById(id + '_qualitySize');
1801
+ }
1802
+ else {
1803
+ imageNameLabel = document.getElementById(id + '_imageNameLabel');
1804
+ }
1805
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config */
1806
+ tempCanvas.toBlob((function (blob) {
1807
+ fileSize = Math.floor(blob.size / 1024);
1808
+ if (fileSize > 1000) {
1809
+ var megabytes = fileSize / 1024;
1810
+ imageNameLabel.innerHTML = 'Image size: ' + megabytes.toFixed(2) + ' MB';
1811
+ fileSize = +megabytes.toFixed(2);
1812
+ }
1813
+ else {
1814
+ imageNameLabel.innerHTML = 'Image size: ' + fileSize.toFixed(2) + ' KB';
1815
+ fileSize = +fileSize.toFixed(2);
1816
+ }
1817
+ if (Browser.isDevice) {
1818
+ canvas.style.display = 'none';
1819
+ }
1820
+ else {
1821
+ var compressedImage_1 = new Image();
1822
+ compressedImage_1.src = URL.createObjectURL(blob);
1823
+ // eslint-disable-next-line @typescript-eslint/tslint/config
1824
+ compressedImage_1.onload = function () {
1825
+ ctx.drawImage(compressedImage_1, 0, 0);
1826
+ URL.revokeObjectURL(compressedImage_1.src);
1827
+ };
1828
+ }
1829
+ this.fileSize = fileSize;
1830
+ }).bind(this), 'image/jpeg', quality);
1831
+ };
1832
+ ToolbarModule.prototype.download = function () {
1833
+ var parent = this.parent;
1834
+ var id = parent.element.id;
1835
+ if (this.fileType === 'JPEG' && this.isSlider) {
1836
+ var value = getComponent(document.getElementById(id + '_qualitySlider'), 'slider').value;
1837
+ parent.notify('export', { prop: 'setImageQuality', value: { value: value } });
1838
+ }
1839
+ else {
1840
+ parent.notify('export', { prop: 'setImageQuality', value: { value: this.currentQuality } });
1841
+ }
1842
+ var fileName = document.getElementById(id + '_imgNametext').value;
1843
+ parent.export(this.fileType, fileName);
1453
1844
  };
1454
1845
  ToolbarModule.prototype.getCropTransformToolbarItem = function () {
1455
1846
  var parent = this.parent;
@@ -1543,6 +1934,10 @@ var ToolbarModule = /** @class */ (function () {
1543
1934
  tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
1544
1935
  }
1545
1936
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1937
+ if (items.indexOf('z-order') > -1) {
1938
+ toolbarItems.push({ id: id + '_zOrder', cssClass: 'top-icon e-list-unordered-3', tooltipText: this.l10n.getConstant('ZOrder'), align: 'Center',
1939
+ type: 'Input', template: '<button id="' + id + '_zOrderBtn"></button>' });
1940
+ }
1546
1941
  if (items.indexOf('duplicate') > -1) {
1547
1942
  toolbarItems.push({ id: id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
1548
1943
  tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center' });
@@ -1596,9 +1991,6 @@ var ToolbarModule = /** @class */ (function () {
1596
1991
  _this.renderCropBtn(shape);
1597
1992
  _this.renderStraightenSlider();
1598
1993
  _this.wireZoomBtnEvents();
1599
- if (!Browser.isDevice) {
1600
- _this.renderSaveBtn();
1601
- }
1602
1994
  parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1603
1995
  if (Browser.isDevice) {
1604
1996
  if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
@@ -1643,7 +2035,7 @@ var ToolbarModule = /** @class */ (function () {
1643
2035
  var classToContentMap = { 'e-custom': 'Custom', 'e-circle': 'Circle',
1644
2036
  'e-square': 'Square', 'e-custom-a': '3:2', 'e-custom-b': '4:3', 'e-custom-c': '5:4', 'e-custom-d': '7:5',
1645
2037
  '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',
1646
- 'e-custom-j': '9:16',
2038
+ 'e-custom-j': '9:16'
1647
2039
  };
1648
2040
  var classList = elem.children[0].classList;
1649
2041
  for (var className in classToContentMap) {
@@ -1655,6 +2047,7 @@ var ToolbarModule = /** @class */ (function () {
1655
2047
  return '';
1656
2048
  };
1657
2049
  ToolbarModule.prototype.getCurrentShapeIcon = function (shape) {
2050
+ // eslint-disable-next-line @typescript-eslint/tslint/config
1658
2051
  var shapeIcons = {
1659
2052
  rectangle: 'e-rectangle',
1660
2053
  ellipse: 'e-circle',
@@ -1676,9 +2069,9 @@ var ToolbarModule = /** @class */ (function () {
1676
2069
  'crop-3:4': 'e-custom-g',
1677
2070
  'crop-4:5': 'e-custom-h',
1678
2071
  'crop-5:7': 'e-custom-i',
1679
- 'crop-9:16': 'e-custom-j',
2072
+ 'crop-9:16': 'e-custom-j'
1680
2073
  };
1681
- return shapeIcons[shape] || 'e-free-pen';
2074
+ return shapeIcons[shape] ? shapeIcons[shape] : (shape && shape.indexOf('crop-') !== -1) ? 'e-custom' : 'e-free-pen';
1682
2075
  };
1683
2076
  ToolbarModule.prototype.initShapesToolbarItem = function (items) {
1684
2077
  var _this = this;
@@ -1712,18 +2105,18 @@ var ToolbarModule = /** @class */ (function () {
1712
2105
  _this.renderAnnotationBtn(true);
1713
2106
  _this.createShapeColor(items);
1714
2107
  _this.createShapeBtn(items);
2108
+ _this.createZOrderBtn(items);
1715
2109
  if (parent.activeObj.shape === 'arrow') {
2110
+ // eslint-disable-next-line @typescript-eslint/tslint/config
1716
2111
  if (items.some(function (item) { return item.toLowerCase().indexOf('start') > -1; })) {
1717
2112
  _this.createStartBtn();
1718
2113
  }
2114
+ // eslint-disable-next-line @typescript-eslint/tslint/config
1719
2115
  if (items.some(function (item) { return item.toLowerCase().indexOf('end') > -1; })) {
1720
2116
  _this.createEndBtn();
1721
2117
  }
1722
2118
  }
1723
2119
  _this.wireZoomBtnEvents();
1724
- if (!Browser.isDevice) {
1725
- _this.renderSaveBtn();
1726
- }
1727
2120
  parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1728
2121
  if (Browser.isDevice) {
1729
2122
  if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
@@ -1805,6 +2198,7 @@ var ToolbarModule = /** @class */ (function () {
1805
2198
  fillDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
1806
2199
  }
1807
2200
  fillDDB_1.toggle();
2201
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
1808
2202
  },
1809
2203
  onModeSwitch: function (args) {
1810
2204
  if (Browser.isDevice) {
@@ -1814,7 +2208,7 @@ var ToolbarModule = /** @class */ (function () {
1814
2208
  },
1815
2209
  beforeClose: function () {
1816
2210
  fillDDB_1.toggle();
1817
- },
2211
+ }
1818
2212
  }, '#' + id + '_shape_fill');
1819
2213
  var fillDDB_1 = new DropDownButton({
1820
2214
  open: function (args) {
@@ -1850,6 +2244,7 @@ var ToolbarModule = /** @class */ (function () {
1850
2244
  parent.updateStrokeColor(args.value);
1851
2245
  strokeDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
1852
2246
  strokeDDB_1.toggle();
2247
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
1853
2248
  },
1854
2249
  onModeSwitch: function (args) {
1855
2250
  if (Browser.isDevice) {
@@ -1902,25 +2297,25 @@ var ToolbarModule = /** @class */ (function () {
1902
2297
  ];
1903
2298
  }
1904
2299
  var strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
1905
- var spanElem_1 = document.createElement('span');
1906
- spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
1907
- spanElem_1.className = 'e-shape-stroke-width';
1908
- strokeWidthBtn.appendChild(spanElem_1);
2300
+ var spanElem_2 = document.createElement('span');
2301
+ spanElem_2.innerHTML = this.l10n.getConstant('XSmall');
2302
+ spanElem_2.className = 'e-shape-stroke-width';
2303
+ strokeWidthBtn.appendChild(spanElem_2);
1909
2304
  // Initialize the DropDownButton component.
1910
- var drpDownBtn_1 = new DropDownButton({ items: strokeWidthItems,
2305
+ var drpDownBtn_2 = new DropDownButton({ items: strokeWidthItems,
1911
2306
  open: function (args) {
1912
2307
  if (Browser.isDevice) {
1913
- args.element.parentElement.style.top = drpDownBtn_1.element.getBoundingClientRect().top -
2308
+ args.element.parentElement.style.top = drpDownBtn_2.element.getBoundingClientRect().top -
1914
2309
  args.element.parentElement.offsetHeight + 'px';
1915
2310
  }
1916
- var activeBtn = spanElem_1.innerHTML;
2311
+ var activeBtn = spanElem_2.innerHTML;
1917
2312
  if (activeBtn !== '') {
1918
2313
  args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
1919
2314
  }
1920
2315
  },
1921
2316
  select: function (args) {
1922
2317
  _this.triggerTbarClickEvent(args);
1923
- spanElem_1.textContent = args.item.text;
2318
+ spanElem_2.textContent = args.item.text;
1924
2319
  parent.updateStrokeWidth(args.item.id);
1925
2320
  if (Browser.isDevice) {
1926
2321
  if (document.getElementById(id + '_bottomToolbar')) {
@@ -1936,10 +2331,94 @@ var ToolbarModule = /** @class */ (function () {
1936
2331
  toolbar_8.refreshOverflow();
1937
2332
  }
1938
2333
  }
2334
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
1939
2335
  }
1940
2336
  });
1941
2337
  // Render initialized DropDownButton.
1942
- drpDownBtn_1.appendTo('#' + id + '_borderWidthBtn');
2338
+ drpDownBtn_2.appendTo('#' + id + '_borderWidthBtn');
2339
+ }
2340
+ };
2341
+ ToolbarModule.prototype.createZOrderBtn = function (items) {
2342
+ var _this = this;
2343
+ var parent = this.parent;
2344
+ var id = parent.element.id;
2345
+ if (items.indexOf('z-order') > -1) {
2346
+ var zOrderItems = [
2347
+ { text: this.l10n.getConstant('BringForward'), id: 'bringForward', iconCss: 'e-icons e-bring-forward' },
2348
+ { text: this.l10n.getConstant('SendBackward'), id: 'sendBackward', iconCss: 'e-icons e-send-backward' },
2349
+ { text: this.l10n.getConstant('BringToFront'), id: 'bringToFront', iconCss: 'e-icons e-bring-to-front' },
2350
+ { text: this.l10n.getConstant('SendToBack'), id: 'sendToBack', iconCss: 'e-icons e-send-to-back' }
2351
+ ];
2352
+ // Initialize the DropDownButton component.
2353
+ var drpDownBtn_3 = new DropDownButton({ items: zOrderItems, iconCss: 'e-icons e-layers',
2354
+ beforeOpen: function (args) {
2355
+ if (document.getElementById(parent.element.id + '_zOrderBtn').classList.contains('e-disabled')) {
2356
+ args.cancel = true;
2357
+ }
2358
+ var indexObj = { freehandSelectedIndex: -1 };
2359
+ parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2360
+ var orderObj = { order: null };
2361
+ parent.notify('shape', { prop: 'getHighestOrder', onPropertyChange: false, value: { obj: orderObj } });
2362
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2363
+ var order = parent.activeObj.order ? parent.activeObj.order : parent.getObjFromId(parent.pointColl[indexObj['freehandSelectedIndex']].id).order;
2364
+ if (order && order >= orderObj['order']) {
2365
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2366
+ args.items[0].disabled = true;
2367
+ args.items[2].disabled = true;
2368
+ }
2369
+ else {
2370
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2371
+ args.items[0].disabled = false;
2372
+ args.items[2].disabled = false;
2373
+ }
2374
+ parent.notify('shape', { prop: 'getLowestOrder', onPropertyChange: false, value: { obj: orderObj } });
2375
+ if (order && order <= orderObj['order']) {
2376
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2377
+ args.items[1].disabled = true;
2378
+ args.items[3].disabled = true;
2379
+ }
2380
+ else {
2381
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2382
+ args.items[1].disabled = false;
2383
+ args.items[3].disabled = false;
2384
+ }
2385
+ },
2386
+ open: function (args) {
2387
+ if (Browser.isDevice) {
2388
+ args.element.parentElement.style.top = drpDownBtn_3.element.getBoundingClientRect().top -
2389
+ args.element.parentElement.offsetHeight + 'px';
2390
+ }
2391
+ },
2392
+ select: function (args) {
2393
+ _this.triggerTbarClickEvent(args);
2394
+ var obj = { freehandDrawSelectedId: null };
2395
+ parent.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: obj } });
2396
+ var shapeId = obj['freehandDrawSelectedId'] ? obj['freehandDrawSelectedId'] : parent.activeObj.currIndex;
2397
+ parent.updateShapeOrder(shapeId, args.item.id);
2398
+ if (Browser.isDevice) {
2399
+ if (document.getElementById(id + '_bottomToolbar')) {
2400
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2401
+ var toolbar_9 = getComponent(id + '_bottomToolbar', 'toolbar');
2402
+ toolbar_9.refreshOverflow();
2403
+ }
2404
+ }
2405
+ else {
2406
+ if (document.getElementById(id + '_toolbar')) {
2407
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2408
+ var toolbar_10 = getComponent(id + '_toolbar', 'toolbar');
2409
+ toolbar_10.refreshOverflow();
2410
+ }
2411
+ }
2412
+ if (shapeId.indexOf('shape') > -1) {
2413
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
2414
+ }
2415
+ else if (shapeId.indexOf('pen') > -1) {
2416
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', value: { isPenDraw: true } });
2417
+ }
2418
+ }
2419
+ });
2420
+ // Render initialized DropDownButton.
2421
+ drpDownBtn_3.appendTo('#' + id + '_zOrderBtn');
1943
2422
  }
1944
2423
  };
1945
2424
  ToolbarModule.prototype.createStartBtn = function () {
@@ -1977,9 +2456,13 @@ var ToolbarModule = /** @class */ (function () {
1977
2456
  }
1978
2457
  },
1979
2458
  select: function (args) {
2459
+ var idToValue = { '1': 'none', '2': 'bar', '3': 'arrow', '4': 'arrowSolid',
2460
+ '5': 'circle', '6': 'circleSolid', '7': 'square', '8': 'squareSolid' };
2461
+ parent.notify('selection', { prop: 'setArrowShape', value: { type: 'initial', shape: idToValue["" + args.item.id] } });
1980
2462
  _this.triggerTbarClickEvent(args);
1981
2463
  spanElem.textContent = args.item.text;
1982
2464
  parent.updateArrow('startArrow', args.item.id);
2465
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
1983
2466
  }
1984
2467
  });
1985
2468
  // Render initialized DropDownButton.
@@ -2020,9 +2503,13 @@ var ToolbarModule = /** @class */ (function () {
2020
2503
  }
2021
2504
  },
2022
2505
  select: function (args) {
2506
+ var idToValue = { '1': 'none', '2': 'bar', '3': 'arrow', '4': 'arrowSolid',
2507
+ '5': 'circle', '6': 'circleSolid', '7': 'square', '8': 'squareSolid' };
2508
+ parent.notify('selection', { prop: 'setArrowShape', value: { type: 'final', shape: idToValue["" + args.item.id] } });
2023
2509
  _this.triggerTbarClickEvent(args);
2024
2510
  spanElem.textContent = args.item.text;
2025
2511
  parent.updateArrow('endArrow', args.item.id);
2512
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
2026
2513
  }
2027
2514
  });
2028
2515
  // Render initialized DropDownButton.
@@ -2064,6 +2551,10 @@ var ToolbarModule = /** @class */ (function () {
2064
2551
  tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
2065
2552
  }
2066
2553
  toolbarItems.push({ align: 'Center', type: 'Separator' });
2554
+ if (items.indexOf('z-order') > -1) {
2555
+ toolbarItems.push({ id: id + '_zOrder', cssClass: 'top-icon e-list-unordered-3', tooltipText: this.l10n.getConstant('ZOrder'), align: 'Center',
2556
+ type: 'Input', template: '<button id="' + id + '_zOrderBtn"></button>' });
2557
+ }
2067
2558
  if (items.indexOf('duplicate') > -1) {
2068
2559
  toolbarItems.push({ id: id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
2069
2560
  tooltipText: this.l10n.getConstant('Duplicate'), align: 'Center', disabled: (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') ? true : false });
@@ -2137,10 +2628,8 @@ var ToolbarModule = /** @class */ (function () {
2137
2628
  _this.renderAnnotationBtn(true);
2138
2629
  _this.createTextColor(items);
2139
2630
  _this.createTextBtn(items);
2631
+ _this.createZOrderBtn(items);
2140
2632
  _this.wireZoomBtnEvents();
2141
- if (!Browser.isDevice) {
2142
- _this.renderSaveBtn();
2143
- }
2144
2633
  parent.trigger('toolbarCreated', { toolbarType: 'text' });
2145
2634
  if (Browser.isDevice) {
2146
2635
  if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_bottomToolbar')) {
@@ -2188,6 +2677,9 @@ var ToolbarModule = /** @class */ (function () {
2188
2677
  parent.updateFontColor(args.value);
2189
2678
  strokeDDB_2.element.children[0].style.backgroundColor = args.currentValue.rgba;
2190
2679
  strokeDDB_2.toggle();
2680
+ if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
2681
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
2682
+ }
2191
2683
  },
2192
2684
  onModeSwitch: function (args) {
2193
2685
  if (Browser.isDevice) {
@@ -2224,17 +2716,17 @@ var ToolbarModule = /** @class */ (function () {
2224
2716
  var id = parent.element.id;
2225
2717
  if (items.indexOf('fontFamily') > -1) {
2226
2718
  var fontNameBtn = document.getElementById(id + '_fontFamilyBtn');
2227
- var spanElem_2 = document.createElement('span');
2719
+ var spanElem_3 = document.createElement('span');
2228
2720
  if (Browser.isDevice) {
2229
- spanElem_2.innerHTML = 'ABC';
2230
- spanElem_2.setAttribute('style', 'font-family: ' + parent.fontFamily.default.toLowerCase() + "'");
2721
+ spanElem_3.innerHTML = 'ABC';
2722
+ spanElem_3.setAttribute('style', 'font-family: ' + parent.fontFamily.default.toLowerCase() + '\'');
2231
2723
  }
2232
2724
  else {
2233
- spanElem_2.innerHTML = parent.fontFamily.default;
2725
+ spanElem_3.innerHTML = parent.fontFamily.default;
2234
2726
  }
2235
- spanElem_2.className = 'e-text-font-family';
2727
+ spanElem_3.className = 'e-text-font-family';
2236
2728
  if (fontNameBtn) {
2237
- fontNameBtn.appendChild(spanElem_2);
2729
+ fontNameBtn.appendChild(spanElem_3);
2238
2730
  }
2239
2731
  var fontFamilyBtn_1 = new DropDownButton({ items: this.getFontFamilyItems(),
2240
2732
  cssClass: 'e-font-family',
@@ -2261,11 +2753,12 @@ var ToolbarModule = /** @class */ (function () {
2261
2753
  },
2262
2754
  select: function (args) {
2263
2755
  _this.triggerTbarClickEvent(args);
2264
- spanElem_2.textContent = args.item.text;
2756
+ spanElem_3.textContent = args.item.text;
2265
2757
  if (Browser.isDevice) {
2266
- spanElem_2.setAttribute('style', 'font-family:' + args.item.id);
2758
+ spanElem_3.setAttribute('style', 'font-family:' + args.item.id);
2267
2759
  }
2268
2760
  parent.updateFontFamily(args.item.id);
2761
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
2269
2762
  }
2270
2763
  });
2271
2764
  fontFamilyBtn_1.appendTo('#' + id + '_fontFamilyBtn');
@@ -2292,6 +2785,7 @@ var ToolbarModule = /** @class */ (function () {
2292
2785
  _this.triggerTbarClickEvent(args);
2293
2786
  fontSizeSpanElem_1.textContent = args.item.text;
2294
2787
  parent.updateFontSize(args.item.text);
2788
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
2295
2789
  }
2296
2790
  });
2297
2791
  fontSizeBtn_1.appendTo('#' + id + '_fontSizeBtn');
@@ -2318,11 +2812,10 @@ var ToolbarModule = /** @class */ (function () {
2318
2812
  getComponent(toolbarElement, 'toolbar').destroy();
2319
2813
  toolbarElement.innerHTML = '';
2320
2814
  }
2321
- if (toolbarElement && (this.defToolbarItems.length > 0 ||
2322
- parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1)) {
2323
- var toolbar_9 = getComponent(toolbarElement, 'toolbar');
2324
- if (!isNullOrUndefined(toolbar_9)) {
2325
- toolbar_9.destroy();
2815
+ if (toolbarElement && (this.defToolbarItems.length > 0 || parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1)) {
2816
+ var toolbar_11 = getComponent(toolbarElement, 'toolbar');
2817
+ if (!isNullOrUndefined(toolbar_11)) {
2818
+ toolbar_11.destroy();
2326
2819
  document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
2327
2820
  }
2328
2821
  }
@@ -2337,8 +2830,7 @@ var ToolbarModule = /** @class */ (function () {
2337
2830
  if (document.querySelector('.e-slider-tooltip')) {
2338
2831
  document.querySelector('.e-slider-tooltip').remove();
2339
2832
  }
2340
- this.isFrameToolbar = false;
2341
- parent.isCropTab = false;
2833
+ this.isFrameToolbar = parent.isCropTab = false;
2342
2834
  switch (type) {
2343
2835
  case 'main':
2344
2836
  if (Browser.isDevice) {
@@ -2362,20 +2854,21 @@ var ToolbarModule = /** @class */ (function () {
2362
2854
  }
2363
2855
  break;
2364
2856
  case 'shapes':
2857
+ parent.noPushUndo = true;
2365
2858
  if (Browser.isDevice) {
2366
2859
  this.initMainToolbar(false, true, true);
2367
2860
  }
2368
2861
  if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
2369
- args.toolbarItems = ['strokeColor', 'strokeWidth', 'duplicate', 'remove'];
2862
+ args.toolbarItems = ['strokeColor', 'strokeWidth', 'z-order', 'duplicate', 'remove'];
2370
2863
  }
2371
2864
  else if (parent.activeObj.shape === 'arrow') {
2372
- args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
2865
+ args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'z-order', 'duplicate', 'remove'];
2373
2866
  }
2374
2867
  else if (parent.activeObj.shape === 'image') {
2375
- args.toolbarItems = ['flip', 'duplicate', 'remove', 'transparency'];
2868
+ args.toolbarItems = ['flip', 'z-order', 'duplicate', 'remove', 'transparency'];
2376
2869
  }
2377
2870
  else {
2378
- args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
2871
+ args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'z-order', 'duplicate', 'remove'];
2379
2872
  }
2380
2873
  this.initShapesToolbarItem(args.toolbarItems);
2381
2874
  break;
@@ -2383,14 +2876,14 @@ var ToolbarModule = /** @class */ (function () {
2383
2876
  if (Browser.isDevice) {
2384
2877
  this.initMainToolbar(false, true, true);
2385
2878
  }
2386
- args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
2879
+ args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'z-order', 'duplicate', 'remove', 'text'];
2387
2880
  this.initTextToolbarItem(args.toolbarItems);
2388
2881
  break;
2389
2882
  case 'pen':
2390
2883
  if (Browser.isDevice) {
2391
2884
  this.initMainToolbar(false, true, true);
2392
2885
  }
2393
- args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove', 'transparency'];
2886
+ args.toolbarItems = ['strokeColor', 'strokeWidth', 'z-order', 'remove', 'transparency'];
2394
2887
  this.initPenToolbarItem(args.toolbarItems);
2395
2888
  break;
2396
2889
  case 'adjustment':
@@ -2450,6 +2943,7 @@ var ToolbarModule = /** @class */ (function () {
2450
2943
  else {
2451
2944
  this.initMainToolbar(true, null, null, false, true);
2452
2945
  }
2946
+ // eslint-disable-next-line no-case-declarations
2453
2947
  var frameElem = parent.element.querySelector('#' + id + '_' + parent.frameObj.type);
2454
2948
  if (frameElem) {
2455
2949
  frameElem.classList.add('e-selected-btn');
@@ -2639,6 +3133,10 @@ var ToolbarModule = /** @class */ (function () {
2639
3133
  align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
2640
3134
  }
2641
3135
  toolbarItems.push({ align: 'Center', type: 'Separator' });
3136
+ if (items.indexOf('z-order') > -1) {
3137
+ toolbarItems.push({ id: id + '_zOrder', cssClass: 'top-icon e-list-unordered-3', tooltipText: this.l10n.getConstant('ZOrder'), align: 'Center',
3138
+ type: 'Input', template: '<button id="' + id + '_zOrderBtn"></button>' });
3139
+ }
2642
3140
  if (items.indexOf('remove') > -1) {
2643
3141
  toolbarItems.push({ id: id + '_remove', prefixIcon: 'e-icons e-trash', cssClass: 'top-icon e-trash',
2644
3142
  tooltipText: this.l10n.getConstant('Remove'), align: 'Center' });
@@ -2686,10 +3184,8 @@ var ToolbarModule = /** @class */ (function () {
2686
3184
  _this.renderAnnotationBtn(true);
2687
3185
  _this.createPenColor(items);
2688
3186
  _this.createPenBtn(items);
3187
+ _this.createZOrderBtn(items);
2689
3188
  _this.wireZoomBtnEvents();
2690
- if (!Browser.isDevice) {
2691
- _this.renderSaveBtn();
2692
- }
2693
3189
  parent.trigger('toolbarCreated', { toolbarType: 'pen' });
2694
3190
  if (Browser.isDevice) {
2695
3191
  if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
@@ -2732,6 +3228,7 @@ var ToolbarModule = /** @class */ (function () {
2732
3228
  _this.selFhdColor = args.currentValue.hex;
2733
3229
  strokeDDB_3.element.children[0].style.backgroundColor = args.currentValue.rgba;
2734
3230
  strokeDDB_3.toggle();
3231
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', value: { isPenDraw: true } });
2735
3232
  }
2736
3233
  }, '#' + id + '_pen_stroke');
2737
3234
  var strokeDDB_3 = new DropDownButton({
@@ -2780,48 +3277,56 @@ var ToolbarModule = /** @class */ (function () {
2780
3277
  ];
2781
3278
  if (items.indexOf('strokeWidth') > -1) {
2782
3279
  var strokeWidthBtn = document.getElementById(id + '_penStrokeWidth');
2783
- var spanElem_3 = document.createElement('span');
3280
+ var spanElem_4 = document.createElement('span');
2784
3281
  var indexObj = { freehandSelectedIndex: null };
2785
3282
  parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2786
3283
  if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
2787
- spanElem_3.innerHTML = this.getPenStroke(parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth);
3284
+ spanElem_4.innerHTML = this.getPenStroke(parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth);
2788
3285
  }
2789
3286
  else {
2790
- spanElem_3.innerHTML = this.l10n.getConstant('Small');
3287
+ var obj = { penStrokeWidth: 2 };
3288
+ parent.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: obj } });
3289
+ if (obj['penStrokeWidth']) {
3290
+ spanElem_4.innerHTML = this.getPenStroke(obj['penStrokeWidth']);
3291
+ }
3292
+ else {
3293
+ spanElem_4.innerHTML = this.l10n.getConstant('Small');
3294
+ }
2791
3295
  }
2792
- spanElem_3.className = 'e-pen-stroke-width';
2793
- strokeWidthBtn.appendChild(spanElem_3);
2794
- var drpDownBtn_2 = new DropDownButton({ items: strokeWidthItems,
3296
+ spanElem_4.className = 'e-pen-stroke-width';
3297
+ strokeWidthBtn.appendChild(spanElem_4);
3298
+ var drpDownBtn_4 = new DropDownButton({ items: strokeWidthItems,
2795
3299
  open: function (args) {
2796
3300
  if (Browser.isDevice) {
2797
- args.element.parentElement.style.top = drpDownBtn_2.element.getBoundingClientRect().top -
3301
+ args.element.parentElement.style.top = drpDownBtn_4.element.getBoundingClientRect().top -
2798
3302
  args.element.parentElement.offsetHeight + 'px';
2799
3303
  }
2800
- var activeBtn = spanElem_3.innerHTML;
3304
+ var activeBtn = spanElem_4.innerHTML;
2801
3305
  args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
2802
3306
  },
2803
3307
  select: function (args) {
2804
3308
  _this.triggerTbarClickEvent(args);
2805
- spanElem_3.textContent = args.item.text;
3309
+ spanElem_4.textContent = args.item.text;
2806
3310
  parent.updatePenStrokeWidth(args.item.id);
2807
3311
  if (Browser.isDevice) {
2808
3312
  if (document.getElementById(id + '_bottomToolbar')) {
2809
3313
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2810
- var toolbar_10 = getComponent(id + '_bottomToolbar', 'toolbar');
2811
- toolbar_10.refreshOverflow();
3314
+ var toolbar_12 = getComponent(id + '_bottomToolbar', 'toolbar');
3315
+ toolbar_12.refreshOverflow();
2812
3316
  }
2813
3317
  }
2814
3318
  else {
2815
3319
  if (document.getElementById(id + '_toolbar')) {
2816
3320
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2817
- var toolbar_11 = getComponent(id + '_toolbar', 'toolbar');
2818
- toolbar_11.refreshOverflow();
3321
+ var toolbar_13 = getComponent(id + '_toolbar', 'toolbar');
3322
+ toolbar_13.refreshOverflow();
2819
3323
  }
2820
3324
  }
3325
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', value: { isPenDraw: true } });
2821
3326
  }
2822
3327
  });
2823
3328
  // Render initialized DropDownButton.
2824
- drpDownBtn_2.appendTo('#' + id + '_penStrokeWidth');
3329
+ drpDownBtn_4.appendTo('#' + id + '_penStrokeWidth');
2825
3330
  }
2826
3331
  };
2827
3332
  ToolbarModule.prototype.getPenStroke = function (value) {
@@ -2861,9 +3366,6 @@ var ToolbarModule = /** @class */ (function () {
2861
3366
  clicked: this.defToolbarClicked.bind(this),
2862
3367
  created: function () {
2863
3368
  _this.wireZoomBtnEvents();
2864
- if (!Browser.isDevice) {
2865
- _this.renderSaveBtn();
2866
- }
2867
3369
  if (Browser.isDevice) {
2868
3370
  if (_this.defToolbarItems.length > 0 && document.getElementById(id + '_toolbar')) {
2869
3371
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -2965,8 +3467,8 @@ var ToolbarModule = /** @class */ (function () {
2965
3467
  change: function (args) {
2966
3468
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
2967
3469
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
2968
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
2969
- lineCount: parent.frameObj.amount };
3470
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3471
+ frameLineStyle: parent.toPascalCase(parent.frameObj.border), lineCount: parent.frameObj.amount };
2970
3472
  var temp = parent.frameObj.gradientColor;
2971
3473
  var object = { currObj: {} };
2972
3474
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -2988,7 +3490,8 @@ var ToolbarModule = /** @class */ (function () {
2988
3490
  fillDDB.element.children[0].classList.remove('e-nocolor-item');
2989
3491
  fillDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
2990
3492
  }
2991
- parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3493
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting,
3494
+ currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
2992
3495
  parent.isFrameBtnClick = true;
2993
3496
  }
2994
3497
  else {
@@ -3015,7 +3518,8 @@ var ToolbarModule = /** @class */ (function () {
3015
3518
  parent.element.querySelector('.e-frame-stroke.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
3016
3519
  }
3017
3520
  else {
3018
- parent.element.querySelector('.e-frame-stroke.e-template .e-dropdownbtn-preview').style.background = parent.frameObj.gradientColor;
3521
+ parent.element.querySelector('.e-frame-stroke.e-template .e-dropdownbtn-preview').style.background
3522
+ = parent.frameObj.gradientColor;
3019
3523
  }
3020
3524
  };
3021
3525
  ToolbarModule.prototype.createFrameColor = function () {
@@ -3032,8 +3536,8 @@ var ToolbarModule = /** @class */ (function () {
3032
3536
  change: function (args) {
3033
3537
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
3034
3538
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3035
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3036
- lineCount: parent.frameObj.amount };
3539
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3540
+ frameLineStyle: parent.toPascalCase(parent.frameObj.border), lineCount: parent.frameObj.amount };
3037
3541
  var temp = parent.frameObj.color;
3038
3542
  var object = { currObj: {} };
3039
3543
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -3055,7 +3559,8 @@ var ToolbarModule = /** @class */ (function () {
3055
3559
  fillDDB.element.children[0].classList.remove('e-nocolor-item');
3056
3560
  fillDDB.element.children[0].style.backgroundColor = args.currentValue.rgba;
3057
3561
  }
3058
- parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3562
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting,
3563
+ currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3059
3564
  parent.isFrameBtnClick = true;
3060
3565
  }
3061
3566
  else {
@@ -3115,8 +3620,8 @@ var ToolbarModule = /** @class */ (function () {
3115
3620
  _this.triggerTbarClickEvent(args);
3116
3621
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
3117
3622
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3118
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3119
- lineCount: parent.frameObj.amount };
3623
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3624
+ frameLineStyle: parent.toPascalCase(parent.frameObj.border), lineCount: parent.frameObj.amount };
3120
3625
  var temp = parent.frameObj.size;
3121
3626
  var object = { currObj: {} };
3122
3627
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -3132,7 +3637,8 @@ var ToolbarModule = /** @class */ (function () {
3132
3637
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3133
3638
  parent.notify('draw', { prop: 'redrawDownScale' });
3134
3639
  drpDownBtn.content = args.item.text;
3135
- parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3640
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting,
3641
+ currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3136
3642
  parent.isFrameBtnClick = true;
3137
3643
  }
3138
3644
  else {
@@ -3141,15 +3647,15 @@ var ToolbarModule = /** @class */ (function () {
3141
3647
  if (Browser.isDevice) {
3142
3648
  if (document.getElementById(id + '_bottomToolbar')) {
3143
3649
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3144
- var toolbar_12 = getComponent(id + '_bottomToolbar', 'toolbar');
3145
- toolbar_12.refreshOverflow();
3650
+ var toolbar_14 = getComponent(id + '_bottomToolbar', 'toolbar');
3651
+ toolbar_14.refreshOverflow();
3146
3652
  }
3147
3653
  }
3148
3654
  else {
3149
3655
  if (document.getElementById(id + '_toolbar')) {
3150
3656
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3151
- var toolbar_13 = getComponent(id + '_toolbar', 'toolbar');
3152
- toolbar_13.refreshOverflow();
3657
+ var toolbar_15 = getComponent(id + '_toolbar', 'toolbar');
3658
+ toolbar_15.refreshOverflow();
3153
3659
  }
3154
3660
  }
3155
3661
  }
@@ -3192,8 +3698,8 @@ var ToolbarModule = /** @class */ (function () {
3192
3698
  _this.triggerTbarClickEvent(args);
3193
3699
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
3194
3700
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3195
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3196
- lineCount: parent.frameObj.amount };
3701
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3702
+ frameLineStyle: parent.toPascalCase(parent.frameObj.border), lineCount: parent.frameObj.amount };
3197
3703
  var temp = parent.frameObj.inset;
3198
3704
  var object = { currObj: {} };
3199
3705
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -3209,7 +3715,8 @@ var ToolbarModule = /** @class */ (function () {
3209
3715
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3210
3716
  parent.notify('draw', { prop: 'redrawDownScale' });
3211
3717
  drpDownBtn.content = args.item.text;
3212
- parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3718
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting,
3719
+ currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3213
3720
  parent.isFrameBtnClick = true;
3214
3721
  }
3215
3722
  else {
@@ -3218,15 +3725,15 @@ var ToolbarModule = /** @class */ (function () {
3218
3725
  if (Browser.isDevice) {
3219
3726
  if (document.getElementById(id + '_bottomToolbar')) {
3220
3727
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3221
- var toolbar_14 = getComponent(id + '_bottomToolbar', 'toolbar');
3222
- toolbar_14.refreshOverflow();
3728
+ var toolbar_16 = getComponent(id + '_bottomToolbar', 'toolbar');
3729
+ toolbar_16.refreshOverflow();
3223
3730
  }
3224
3731
  }
3225
3732
  else {
3226
3733
  if (document.getElementById(id + '_toolbar')) {
3227
3734
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3228
- var toolbar_15 = getComponent(id + '_toolbar', 'toolbar');
3229
- toolbar_15.refreshOverflow();
3735
+ var toolbar_17 = getComponent(id + '_toolbar', 'toolbar');
3736
+ toolbar_17.refreshOverflow();
3230
3737
  }
3231
3738
  }
3232
3739
  }
@@ -3269,8 +3776,8 @@ var ToolbarModule = /** @class */ (function () {
3269
3776
  _this.triggerTbarClickEvent(args);
3270
3777
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
3271
3778
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3272
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3273
- lineCount: parent.frameObj.amount };
3779
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3780
+ lineCount: parent.frameObj.amount, frameLineStyle: parent.toPascalCase(parent.frameObj.border) };
3274
3781
  var temp = parent.frameObj.offset;
3275
3782
  var object = { currObj: {} };
3276
3783
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -3286,7 +3793,8 @@ var ToolbarModule = /** @class */ (function () {
3286
3793
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3287
3794
  parent.notify('draw', { prop: 'redrawDownScale' });
3288
3795
  drpDownBtn.content = args.item.text;
3289
- parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3796
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting,
3797
+ currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3290
3798
  parent.isFrameBtnClick = true;
3291
3799
  }
3292
3800
  else {
@@ -3295,15 +3803,15 @@ var ToolbarModule = /** @class */ (function () {
3295
3803
  if (Browser.isDevice) {
3296
3804
  if (document.getElementById(id + '_bottomToolbar')) {
3297
3805
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3298
- var toolbar_16 = getComponent(id + '_bottomToolbar', 'toolbar');
3299
- toolbar_16.refreshOverflow();
3806
+ var toolbar_18 = getComponent(id + '_bottomToolbar', 'toolbar');
3807
+ toolbar_18.refreshOverflow();
3300
3808
  }
3301
3809
  }
3302
3810
  else {
3303
3811
  if (document.getElementById(id + '_toolbar')) {
3304
3812
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3305
- var toolbar_17 = getComponent(id + '_toolbar', 'toolbar');
3306
- toolbar_17.refreshOverflow();
3813
+ var toolbar_19 = getComponent(id + '_toolbar', 'toolbar');
3814
+ toolbar_19.refreshOverflow();
3307
3815
  }
3308
3816
  }
3309
3817
  }
@@ -3347,7 +3855,8 @@ var ToolbarModule = /** @class */ (function () {
3347
3855
  _this.triggerTbarClickEvent(args);
3348
3856
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
3349
3857
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3350
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3858
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3859
+ frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3351
3860
  lineCount: parent.frameObj.amount };
3352
3861
  var temp = parent.frameObj.radius;
3353
3862
  var object = { currObj: {} };
@@ -3364,7 +3873,8 @@ var ToolbarModule = /** @class */ (function () {
3364
3873
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
3365
3874
  parent.notify('draw', { prop: 'redrawDownScale' });
3366
3875
  drpDownBtn.content = args.item.text;
3367
- parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting, currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3876
+ parent.curFrameObjEvent = { previousFrameSetting: obj['frameChangeEventArgs'].previousFrameSetting,
3877
+ currentFrameSetting: obj['frameChangeEventArgs'].currentFrameSetting };
3368
3878
  parent.isFrameBtnClick = true;
3369
3879
  }
3370
3880
  else {
@@ -3373,15 +3883,15 @@ var ToolbarModule = /** @class */ (function () {
3373
3883
  if (Browser.isDevice) {
3374
3884
  if (document.getElementById(id + '_bottomToolbar')) {
3375
3885
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3376
- var toolbar_18 = getComponent(id + '_bottomToolbar', 'toolbar');
3377
- toolbar_18.refreshOverflow();
3886
+ var toolbar_20 = getComponent(id + '_bottomToolbar', 'toolbar');
3887
+ toolbar_20.refreshOverflow();
3378
3888
  }
3379
3889
  }
3380
3890
  else {
3381
3891
  if (document.getElementById(id + '_toolbar')) {
3382
3892
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3383
- var toolbar_19 = getComponent(id + '_toolbar', 'toolbar');
3384
- toolbar_19.refreshOverflow();
3893
+ var toolbar_21 = getComponent(id + '_toolbar', 'toolbar');
3894
+ toolbar_21.refreshOverflow();
3385
3895
  }
3386
3896
  }
3387
3897
  }
@@ -3424,8 +3934,8 @@ var ToolbarModule = /** @class */ (function () {
3424
3934
  _this.triggerTbarClickEvent(args);
3425
3935
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
3426
3936
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3427
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3428
- lineCount: parent.frameObj.amount };
3937
+ offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius,
3938
+ lineCount: parent.frameObj.amount, frameLineStyle: parent.toPascalCase(parent.frameObj.border) };
3429
3939
  var temp = parent.frameObj.amount;
3430
3940
  var object = { currObj: {} };
3431
3941
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -3450,15 +3960,15 @@ var ToolbarModule = /** @class */ (function () {
3450
3960
  if (Browser.isDevice) {
3451
3961
  if (document.getElementById(id + '_bottomToolbar')) {
3452
3962
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3453
- var toolbar_20 = getComponent(id + '_bottomToolbar', 'toolbar');
3454
- toolbar_20.refreshOverflow();
3963
+ var toolbar_22 = getComponent(id + '_bottomToolbar', 'toolbar');
3964
+ toolbar_22.refreshOverflow();
3455
3965
  }
3456
3966
  }
3457
3967
  else {
3458
3968
  if (document.getElementById(id + '_toolbar')) {
3459
3969
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3460
- var toolbar_21 = getComponent(id + '_toolbar', 'toolbar');
3461
- toolbar_21.refreshOverflow();
3970
+ var toolbar_23 = getComponent(id + '_toolbar', 'toolbar');
3971
+ toolbar_23.refreshOverflow();
3462
3972
  }
3463
3973
  }
3464
3974
  }
@@ -3475,7 +3985,7 @@ var ToolbarModule = /** @class */ (function () {
3475
3985
  var strokeWidthItems = [
3476
3986
  { id: '1', text: this.l10n.getConstant('Solid') },
3477
3987
  { id: '2', text: this.l10n.getConstant('Dashed') },
3478
- { id: '3', text: this.l10n.getConstant('Dotted') },
3988
+ { id: '3', text: this.l10n.getConstant('Dotted') }
3479
3989
  ];
3480
3990
  var strokeWidthBtn = document.getElementById(id + '_frameBorderBtn');
3481
3991
  var spanElem = document.createElement('span');
@@ -3497,10 +4007,10 @@ var ToolbarModule = /** @class */ (function () {
3497
4007
  },
3498
4008
  select: function (args) {
3499
4009
  _this.triggerTbarClickEvent(args);
3500
- prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
4010
+ prevFrameSettings = { lineCount: parent.frameObj.amount, color: parent.frameObj.color, borderRadius: parent.frameObj.radius,
3501
4011
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
3502
- offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
3503
- lineCount: parent.frameObj.amount };
4012
+ offset: parent.frameObj.offset, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
4013
+ type: parent.toPascalCase(parent.frameObj.type) };
3504
4014
  var temp = parent.frameObj.border;
3505
4015
  var object = { currObj: {} };
3506
4016
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -3525,15 +4035,15 @@ var ToolbarModule = /** @class */ (function () {
3525
4035
  if (Browser.isDevice) {
3526
4036
  if (document.getElementById(id + '_bottomToolbar')) {
3527
4037
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3528
- var toolbar_22 = getComponent(id + '_bottomToolbar', 'toolbar');
3529
- toolbar_22.refreshOverflow();
4038
+ var toolbar_24 = getComponent(id + '_bottomToolbar', 'toolbar');
4039
+ toolbar_24.refreshOverflow();
3530
4040
  }
3531
4041
  }
3532
4042
  else {
3533
4043
  if (document.getElementById(id + '_toolbar')) {
3534
4044
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3535
- var toolbar_23 = getComponent(id + '_toolbar', 'toolbar');
3536
- toolbar_23.refreshOverflow();
4045
+ var toolbar_25 = getComponent(id + '_toolbar', 'toolbar');
4046
+ toolbar_25.refreshOverflow();
3537
4047
  }
3538
4048
  }
3539
4049
  }
@@ -3623,6 +4133,7 @@ var ToolbarModule = /** @class */ (function () {
3623
4133
  if (parent.activeObj.shape === 'image') {
3624
4134
  toolbarItems.push('Flip');
3625
4135
  }
4136
+ toolbarItems.push('BringToFront');
3626
4137
  toolbarItems.push('Clone');
3627
4138
  toolbarItems.push('Delete');
3628
4139
  if (parent.activeObj.shape === 'text') {
@@ -3631,6 +4142,7 @@ var ToolbarModule = /** @class */ (function () {
3631
4142
  args.shape = parent.toPascalCase(parent.activeObj.shape);
3632
4143
  }
3633
4144
  else if (isPenEdit) {
4145
+ toolbarItems.push('BringToFront');
3634
4146
  toolbarItems.push('Delete');
3635
4147
  args.shape = 'Freehand draw';
3636
4148
  }
@@ -3643,6 +4155,10 @@ var ToolbarModule = /** @class */ (function () {
3643
4155
  else {
3644
4156
  for (var i = 0; i < args.toolbarItems.length; i++) {
3645
4157
  switch (args.toolbarItems[i]) {
4158
+ case 'BringToFront':
4159
+ orgToolbarItems.push({ id: id + '_bringToFront', prefixIcon: 'e-icons e-bring-to-front',
4160
+ tooltipText: this.l10n.getConstant('BringToFront'), align: 'Left' });
4161
+ break;
3646
4162
  case 'Clone':
3647
4163
  orgToolbarItems.push({ id: id + '_duplicate', prefixIcon: 'e-icons e-order', cssClass: 'top-icon e-order',
3648
4164
  tooltipText: this.l10n.getConstant('Duplicate'), align: 'Left' });
@@ -3690,7 +4206,17 @@ var ToolbarModule = /** @class */ (function () {
3690
4206
  toolbarObj.appendTo('#' + id + '_quickAccessToolbar');
3691
4207
  }
3692
4208
  var height = this.toolbarHeight && this.toolbarHeight !== 0 ? this.toolbarHeight : qtArea.clientHeight;
3693
- if (isNullOrUndefined(isPenEdit)) {
4209
+ if (isNullOrUndefined(isPenEdit) && (parent.activeObj.activePoint.width !== 0 ||
4210
+ parent.activeObj.activePoint.height !== 0 ||
4211
+ (parent.activeObj.shape && parent.activeObj.shape === 'path' && parent.activeObj.pointColl.length > 0))) {
4212
+ var orderObj = { order: null };
4213
+ parent.notify('shape', { prop: 'getHighestOrder', onPropertyChange: false, value: { obj: orderObj } });
4214
+ if (parent.activeObj.order > orderObj['order']) {
4215
+ document.getElementById(parent.element.id + '_bringToFront').classList.add('e-disabled');
4216
+ }
4217
+ else {
4218
+ document.getElementById(parent.element.id + '_bringToFront').classList.remove('e-disabled');
4219
+ }
3694
4220
  qtArea.style.width = 'auto';
3695
4221
  parent.activeObj.activePoint.width = Math.abs(parent.activeObj.activePoint.width);
3696
4222
  parent.activeObj.activePoint.height = Math.abs(parent.activeObj.activePoint.height);
@@ -3727,14 +4253,23 @@ var ToolbarModule = /** @class */ (function () {
3727
4253
  }
3728
4254
  }
3729
4255
  else if (isPenEdit) {
3730
- var obj = { activePoint: null };
3731
- var indexObj = { freehandSelectedIndex: null };
4256
+ var indexObj = { freehandSelectedIndex: -1 };
3732
4257
  parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
4258
+ var orderObj = { order: null };
4259
+ parent.notify('shape', { prop: 'getHighestOrder', onPropertyChange: false, value: { obj: orderObj } });
4260
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4261
+ if (parent.getObjFromId(parent.pointColl[indexObj['freehandSelectedIndex']].id).order >= orderObj['order']) {
4262
+ document.getElementById(parent.element.id + '_bringToFront').classList.add('e-disabled');
4263
+ }
4264
+ else {
4265
+ document.getElementById(parent.element.id + '_bringToFront').classList.remove('e-disabled');
4266
+ }
4267
+ var obj = { activePoint: null };
3733
4268
  parent.notify('freehand-draw', { prop: 'getSqPtFD',
3734
4269
  value: { idx: indexObj['freehandSelectedIndex'], obj: obj } });
3735
4270
  var point = obj['activePoint'];
3736
4271
  qtArea.style.width = 'auto';
3737
- qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
4272
+ qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 24) + 'px';
3738
4273
  if (point.startY - (height + (height / 1.5)) < parent.img.destTop) {
3739
4274
  qtArea.style.top = parent.img.destTop + 'px';
3740
4275
  }
@@ -3742,6 +4277,9 @@ var ToolbarModule = /** @class */ (function () {
3742
4277
  qtArea.style.top = point.startY - (height + (height / 1.5)) + 'px';
3743
4278
  }
3744
4279
  }
4280
+ else {
4281
+ qtArea.style.display = 'none';
4282
+ }
3745
4283
  if (parseFloat(qtArea.style.top) < 0) {
3746
4284
  qtArea.style.top = '0px';
3747
4285
  }
@@ -3825,7 +4363,6 @@ var ToolbarModule = /** @class */ (function () {
3825
4363
  ToolbarModule.prototype.quickAccessToolbarClicked = function (args, isContextualToolbar) {
3826
4364
  var parent = this.parent;
3827
4365
  var id = parent.element.id;
3828
- var points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
3829
4366
  if (args.item) {
3830
4367
  var isPreventUndoRedo = null;
3831
4368
  var obj = { prevActObj: null };
@@ -3839,6 +4376,10 @@ var ToolbarModule = /** @class */ (function () {
3839
4376
  var type = args.item.id.replace(id + '_', '').toLowerCase();
3840
4377
  var left = void 0;
3841
4378
  var right = void 0;
4379
+ var indexObj = { freehandSelectedIndex: null };
4380
+ var shapeId = void 0;
4381
+ var isDisabled = void 0;
4382
+ var orderObj = { order: null };
3842
4383
  switch (type) {
3843
4384
  case 'duplicate':
3844
4385
  if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
@@ -3851,6 +4392,7 @@ var ToolbarModule = /** @class */ (function () {
3851
4392
  break;
3852
4393
  case 'remove':
3853
4394
  if (!parent.element.querySelector('#' + id + '_remove').classList.contains('e-disabled')) {
4395
+ parent.noPushUndo = false;
3854
4396
  this.refreshSlider();
3855
4397
  parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
3856
4398
  }
@@ -3868,18 +4410,49 @@ var ToolbarModule = /** @class */ (function () {
3868
4410
  (right && !right.classList.contains('e-disabled'))) {
3869
4411
  parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
3870
4412
  }
4413
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
3871
4414
  break;
3872
4415
  case 'hflip':
3873
4416
  if (!parent.element.querySelector('#' + id + '_hFlip').classList.contains('e-disabled')) {
3874
4417
  ctx = parent.activeObj.imageCanvas.getContext('2d');
3875
4418
  parent.horizontalFlip(ctx);
3876
4419
  }
4420
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
3877
4421
  break;
3878
4422
  case 'vflip':
3879
4423
  if (!parent.element.querySelector('#' + id + '_vFlip').classList.contains('e-disabled')) {
3880
4424
  ctx = parent.activeObj.imageCanvas.getContext('2d');
3881
4425
  parent.verticalFlip(ctx);
3882
4426
  }
4427
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
4428
+ break;
4429
+ case 'bringtofront':
4430
+ if (!parent.element.querySelector('#' + id + '_bringToFront').classList.contains('e-disabled')) {
4431
+ parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
4432
+ shapeId = indexObj['freehandSelectedIndex'] !== null ? parent.pointColl[indexObj['freehandSelectedIndex']].id :
4433
+ parent.activeObj.currIndex;
4434
+ parent.updateShapeOrder(shapeId, type);
4435
+ isDisabled = false;
4436
+ parent.notify('shape', { prop: 'getHighestOrder', onPropertyChange: false, value: { obj: orderObj } });
4437
+ if (shapeId.indexOf('pen') > -1) {
4438
+ parent.notify('shape', { prop: 'updateShapeColl', onPropertyChange: false });
4439
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4440
+ var order = parent.getObjFromId(shapeId).order;
4441
+ isDisabled = order >= orderObj['order'] ? true : false;
4442
+ }
4443
+ else {
4444
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4445
+ var order = parent.getObjFromId(shapeId).order;
4446
+ isDisabled = order > orderObj['order'] ? true : false;
4447
+ }
4448
+ if (isDisabled) {
4449
+ document.getElementById(parent.element.id + '_bringToFront').classList.add('e-disabled');
4450
+ }
4451
+ else {
4452
+ document.getElementById(parent.element.id + '_bringToFront').classList.remove('e-disabled');
4453
+ }
4454
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
4455
+ }
3883
4456
  break;
3884
4457
  }
3885
4458
  if (type === 'duplicate' || type === 'remove') {
@@ -3912,6 +4485,15 @@ var ToolbarModule = /** @class */ (function () {
3912
4485
  points.x = object1['x'];
3913
4486
  points.y = object1['y'];
3914
4487
  }
4488
+ var tempActiveObj = extend({}, parent.activeObj, {}, true);
4489
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
4490
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
4491
+ this.lowerContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
4492
+ parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
4493
+ parent.notify('draw', { prop: 'redrawDownScale' });
4494
+ parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
4495
+ parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
4496
+ parent.activeObj = tempActiveObj;
3915
4497
  parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
3916
4498
  value: { x: points.x, y: points.y, actObj: parent.activeObj } });
3917
4499
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
@@ -3933,6 +4515,19 @@ var ToolbarModule = /** @class */ (function () {
3933
4515
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
3934
4516
  var objColl;
3935
4517
  var duplicateObj = extend({}, parent.activeObj, {}, true);
4518
+ var orderObj = { order: null };
4519
+ parent.notify('shape', { prop: 'getHighestOrder', onPropertyChange: false, value: { obj: orderObj } });
4520
+ if (duplicateObj.order) {
4521
+ parent.notify('shape', { prop: 'updateShapeColl', onPropertyChange: false });
4522
+ duplicateObj.order = orderObj['order'] > duplicateObj.order ? orderObj['order'] + 1 : duplicateObj.order + 1;
4523
+ }
4524
+ else {
4525
+ parent.noPushUndo = true;
4526
+ parent.okBtn();
4527
+ parent.noPushUndo = false;
4528
+ parent.selectShape(duplicateObj.currIndex);
4529
+ duplicateObj.order = orderObj['order'] > duplicateObj.order ? orderObj['order'] + 1 : duplicateObj.order + 1;
4530
+ }
3936
4531
  if (duplicateObj.shape === 'image') {
3937
4532
  objColl = extend([], parent.objColl, [], true);
3938
4533
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
@@ -3948,9 +4543,10 @@ var ToolbarModule = /** @class */ (function () {
3948
4543
  else {
3949
4544
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
3950
4545
  }
3951
- if (pathObject['isNewPath']) {
3952
- parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
3953
- }
4546
+ var noPushUndo = parent.noPushUndo;
4547
+ parent.noPushUndo = false;
4548
+ parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
4549
+ parent.noPushUndo = noPushUndo;
3954
4550
  objColl = extend([], parent.objColl, [], true);
3955
4551
  duplicateObj.activePoint.startX += 10;
3956
4552
  duplicateObj.activePoint.startY -= 10;
@@ -3965,12 +4561,16 @@ var ToolbarModule = /** @class */ (function () {
3965
4561
  else if (duplicateObj.shape === 'image') {
3966
4562
  duplicateObj.imageCanvas = parent.createElement('canvas');
3967
4563
  }
4564
+ var shapeIDObj = { id: 'shape_' + (parent.objColl.length + 1) };
4565
+ parent.notify('shape', { prop: 'getNewShapeId', onPropertyChange: false, value: { obj: shapeIDObj } });
4566
+ duplicateObj.currIndex = shapeIDObj['id'];
3968
4567
  parent.activeObj = extend({}, duplicateObj, {}, true);
3969
4568
  if (parent.activeObj.shape === 'image') {
3970
4569
  var activePoint = extend({}, duplicateObj.activePoint, {}, true);
3971
4570
  var dimObj = { width: 0, height: 0 };
3972
4571
  parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
3973
- value: { width: parent.activeObj.imageElement.width, height: parent.activeObj.imageElement.height, obj: dimObj, isImgShape: null } });
4572
+ value: { width: parent.activeObj.imageElement.width, height: parent.activeObj.imageElement.height,
4573
+ obj: dimObj, isImgShape: null } });
3974
4574
  parent.activeObj.activePoint.width = dimObj['width'];
3975
4575
  parent.activeObj.activePoint.height = dimObj['height'];
3976
4576
  if (parent.activeObj.isHorImageFlip && parent.activeObj.isVerImageFlip) {
@@ -4057,8 +4657,8 @@ var ToolbarModule = /** @class */ (function () {
4057
4657
  var parent = this.parent;
4058
4658
  var id = parent.element.id;
4059
4659
  var zoomIn = parent.element.querySelector('#' + id + '_zoomIn');
4060
- var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
4061
- var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
4660
+ var aspectRatioHeight = parent.element.querySelector('#' + id + '_resizeHeight');
4661
+ var aspectRatioWidth = parent.element.querySelector('#' + id + '_resizeWidth');
4062
4662
  var isCropSelection = false;
4063
4663
  var panBtn;
4064
4664
  var splitWords;
@@ -4088,7 +4688,7 @@ var ToolbarModule = /** @class */ (function () {
4088
4688
  this.cancelPan();
4089
4689
  parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: true } });
4090
4690
  if (this.currentToolbar === 'pen') {
4091
- parent.freehandDraw(true);
4691
+ parent.freeHandDraw(true);
4092
4692
  }
4093
4693
  }
4094
4694
  else {
@@ -4110,13 +4710,16 @@ var ToolbarModule = /** @class */ (function () {
4110
4710
  this.refreshToolbar('main');
4111
4711
  break;
4112
4712
  case 'cancel':
4113
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar } });
4713
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar, isFinalCancel: true } });
4114
4714
  break;
4115
4715
  case 'ok':
4116
- parent.okBtn();
4716
+ parent.okBtn(null, true);
4717
+ parent.drawingShape = null;
4117
4718
  this.refreshDropDownBtn(false);
4118
4719
  this.currentToolbar = 'main';
4119
4720
  parent.isStraightening = false;
4721
+ parent.notify('draw', { prop: 'resetTempObjColl' });
4722
+ parent.notify('draw', { prop: 'resetTempPointColl' });
4120
4723
  break;
4121
4724
  case 'crop':
4122
4725
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
@@ -4134,14 +4737,18 @@ var ToolbarModule = /** @class */ (function () {
4134
4737
  this.currentToolbar = 'main';
4135
4738
  break;
4136
4739
  case 'undo':
4137
- if (parent.togglePen) {
4138
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar } });
4740
+ parent.noPushUndo = false;
4741
+ if (parent.togglePen || parent.drawingShape) {
4742
+ parent.okBtn();
4743
+ parent.drawingShape = null;
4139
4744
  }
4140
4745
  parent.notify('undo-redo', { prop: 'call-undo' });
4141
4746
  break;
4142
4747
  case 'redo':
4143
- if (parent.togglePen) {
4144
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: isContextualToolbar } });
4748
+ parent.noPushUndo = false;
4749
+ if (parent.togglePen || parent.drawingShape) {
4750
+ parent.okBtn();
4751
+ parent.drawingShape = null;
4145
4752
  }
4146
4753
  parent.notify('undo-redo', { prop: 'call-redo' });
4147
4754
  break;
@@ -4254,6 +4861,9 @@ var ToolbarModule = /** @class */ (function () {
4254
4861
  else {
4255
4862
  parent.element.querySelector('#' + id + '_bold').classList.add('e-selected-btn');
4256
4863
  }
4864
+ if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
4865
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
4866
+ }
4257
4867
  break;
4258
4868
  case 'italic':
4259
4869
  parent.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
@@ -4279,6 +4889,9 @@ var ToolbarModule = /** @class */ (function () {
4279
4889
  else {
4280
4890
  parent.element.querySelector('#' + id + '_italic').classList.add('e-selected-btn');
4281
4891
  }
4892
+ if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
4893
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
4894
+ }
4282
4895
  break;
4283
4896
  case 'croptransform':
4284
4897
  this.performCropTransformClick();
@@ -4298,16 +4911,10 @@ var ToolbarModule = /** @class */ (function () {
4298
4911
  }
4299
4912
  break;
4300
4913
  case 'save':
4301
- if (parent.element.querySelector('#' + id + '_saveBtn').classList.contains('e-hide')) {
4302
- parent.element.querySelector('#' + id + '_saveBtn').classList.remove('e-hide');
4303
- parent.element.querySelector('#' + id + '_saveBtn').focus();
4304
- break;
4305
- }
4306
- else {
4307
- parent.okBtn();
4308
- }
4309
- parent.element.querySelector('#' + id + '_saveBtn').classList.add('e-hide');
4310
- parent.element.querySelector('#' + id + '_saveBtn').click();
4914
+ parent.noPushUndo = false;
4915
+ parent.okBtn();
4916
+ parent.drawingShape = null;
4917
+ this.saveDialogPopup();
4311
4918
  break;
4312
4919
  case 'transparency':
4313
4920
  this.updateContextualToolbar('transparency', 'transparency');
@@ -4383,8 +4990,10 @@ var ToolbarModule = /** @class */ (function () {
4383
4990
  var parent = this.parent;
4384
4991
  this.isFrameToolbar = false;
4385
4992
  parent.notify('transform', { prop: 'resetZoom', onPropertyChange: false });
4386
- while (true) {
4993
+ var isSmaller = true;
4994
+ while (isSmaller) {
4387
4995
  if (this.toolbarHeight + parent.img.destTop >= (this.toolbarHeight + parent.cxtTbarHeight)) {
4996
+ isSmaller = false;
4388
4997
  break;
4389
4998
  }
4390
4999
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
@@ -4458,9 +5067,21 @@ var ToolbarModule = /** @class */ (function () {
4458
5067
  if (e) {
4459
5068
  var parent_1 = this.parent;
4460
5069
  if ((parent_1.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
5070
+ parent_1.noPushUndo = false;
4461
5071
  if (parent_1.currObjType.isFiltered) {
4462
5072
  parent_1.okBtn();
4463
5073
  }
5074
+ var drawingShape = parent_1.drawingShape;
5075
+ if (parent_1.drawingShape) {
5076
+ var id = parent_1.activeObj.currIndex;
5077
+ parent_1.noPushUndo = true;
5078
+ parent_1.okBtn();
5079
+ parent_1.noPushUndo = false;
5080
+ parent_1.drawingShape = null;
5081
+ if (id) {
5082
+ parent_1.selectShape(id);
5083
+ }
5084
+ }
4464
5085
  this.refreshShapeDrawing();
4465
5086
  if (Browser.isDevice && e.type === 'touchstart') {
4466
5087
  if (!e.returnValue) {
@@ -4485,6 +5106,7 @@ var ToolbarModule = /** @class */ (function () {
4485
5106
  parent_1.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
4486
5107
  }
4487
5108
  parent_1.notify('draw', { prop: 'resetCurrentSelectionPoint' });
5109
+ parent_1.drawingShape = drawingShape;
4488
5110
  parent_1.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4489
5111
  value: { zoomFactor: .1, zoomPoint: null, isResize: null } });
4490
5112
  parent_1.notify('draw', { prop: 'redrawDownScale' });
@@ -4503,9 +5125,21 @@ var ToolbarModule = /** @class */ (function () {
4503
5125
  if (e) {
4504
5126
  var parent_2 = this.parent;
4505
5127
  if ((parent_2.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
5128
+ parent_2.noPushUndo = false;
4506
5129
  if (parent_2.currObjType.isFiltered) {
4507
5130
  parent_2.okBtn();
4508
5131
  }
5132
+ var drawingShape = parent_2.drawingShape;
5133
+ if (parent_2.drawingShape) {
5134
+ var id = parent_2.activeObj.currIndex;
5135
+ parent_2.noPushUndo = true;
5136
+ parent_2.okBtn();
5137
+ parent_2.noPushUndo = false;
5138
+ parent_2.drawingShape = null;
5139
+ if (id) {
5140
+ parent_2.selectShape(id);
5141
+ }
5142
+ }
4509
5143
  this.refreshShapeDrawing();
4510
5144
  if (Browser.isDevice && e.type === 'touchstart') {
4511
5145
  if (!e.returnValue) {
@@ -4530,6 +5164,7 @@ var ToolbarModule = /** @class */ (function () {
4530
5164
  parent_2.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
4531
5165
  }
4532
5166
  parent_2.notify('draw', { prop: 'resetCurrentSelectionPoint' });
5167
+ parent_2.drawingShape = drawingShape;
4533
5168
  parent_2.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
4534
5169
  value: { zoomFactor: -.1, zoomPoint: null, isResize: null } });
4535
5170
  parent_2.notify('draw', { prop: 'redrawDownScale' });
@@ -4730,16 +5365,14 @@ var ToolbarModule = /** @class */ (function () {
4730
5365
  parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: true } });
4731
5366
  if (type === 'transparency') {
4732
5367
  if (parent.activeObj.shape) {
4733
- var prevCropObj = void 0;
4734
- var prevObj = void 0;
4735
5368
  if (isNullOrUndefined(parent.activeObj.imageRatio)) {
4736
5369
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
4737
5370
  }
4738
5371
  parent.notify('shape', { prop: 'pushActItemIntoObj' });
4739
- prevCropObj = extend({}, parent.cropObj, {}, true);
5372
+ var prevCropObj = extend({}, parent.cropObj, {}, true);
4740
5373
  var object = { currObj: {} };
4741
5374
  parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
4742
- prevObj = object['currObj'];
5375
+ var prevObj = object['currObj'];
4743
5376
  prevObj.objColl = extend([], parent.objColl, [], true);
4744
5377
  prevObj.pointColl = extend([], parent.pointColl, [], true);
4745
5378
  prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
@@ -4781,6 +5414,10 @@ var ToolbarModule = /** @class */ (function () {
4781
5414
  parent.notify('draw', { prop: 'redrawDownScale' });
4782
5415
  }
4783
5416
  parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
5417
+ if (type === 'transparency') {
5418
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
5419
+ parent.element.querySelector('#' + parent.element.id + '_transparency').click();
5420
+ }
4784
5421
  }
4785
5422
  });
4786
5423
  };
@@ -4832,7 +5469,7 @@ var ToolbarModule = /** @class */ (function () {
4832
5469
  ToolbarModule.prototype.refreshSlider = function () {
4833
5470
  var id = this.parent.element.id;
4834
5471
  var sliderWrapper = document.querySelector('#' + id + '_sliderWrapper');
4835
- // eslint-disable-next-line
5472
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4836
5473
  var slider = document.querySelector('.e-slider');
4837
5474
  var hdrWrapper = document.querySelector('#' + id + '_headWrapper');
4838
5475
  if (hdrWrapper) {
@@ -5028,6 +5665,9 @@ var ToolbarModule = /** @class */ (function () {
5028
5665
  parent.activeObj.shapeFlip = parent.transform.currFlipState;
5029
5666
  parent.activeObj.textFlip = parent.transform.currFlipState;
5030
5667
  parent.activeObj.flipObjColl = [];
5668
+ var orderObj = { order: null };
5669
+ parent.notify('shape', { prop: 'getNewOrder', onPropertyChange: false, value: { obj: orderObj } });
5670
+ parent.activeObj.order = orderObj['order'];
5031
5671
  };
5032
5672
  ToolbarModule.prototype.isToolbarString = function (items) {
5033
5673
  var isString = false;