@syncfusion/ej2-image-editor 24.2.5 → 25.1.35

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 (78) hide show
  1. package/CHANGELOG.md +3 -43
  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 +944 -1873
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +976 -1922
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.js +9 -45
  13. package/src/image-editor/action/draw.js +52 -207
  14. package/src/image-editor/action/export.js +6 -35
  15. package/src/image-editor/action/freehand-draw.js +26 -80
  16. package/src/image-editor/action/selection.js +122 -326
  17. package/src/image-editor/action/shape.js +130 -242
  18. package/src/image-editor/action/transform.d.ts +0 -1
  19. package/src/image-editor/action/transform.js +77 -289
  20. package/src/image-editor/action/undo-redo.js +32 -101
  21. package/src/image-editor/base/image-editor-model.d.ts +1 -1
  22. package/src/image-editor/base/image-editor.d.ts +51 -42
  23. package/src/image-editor/base/image-editor.js +304 -422
  24. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  25. package/src/image-editor/renderer/toolbar.js +228 -185
  26. package/styles/bootstrap-dark.css +0 -12
  27. package/styles/bootstrap.css +0 -12
  28. package/styles/bootstrap4.css +0 -12
  29. package/styles/bootstrap5-dark.css +0 -12
  30. package/styles/bootstrap5.css +0 -12
  31. package/styles/fabric-dark.css +0 -12
  32. package/styles/fabric.css +0 -12
  33. package/styles/fluent-dark.css +0 -12
  34. package/styles/fluent.css +0 -12
  35. package/styles/highcontrast-light.css +0 -12
  36. package/styles/highcontrast.css +0 -12
  37. package/styles/image-editor/_bds-definition.scss +21 -0
  38. package/styles/image-editor/_bootstrap-dark-definition.scss +0 -1
  39. package/styles/image-editor/_bootstrap-definition.scss +0 -1
  40. package/styles/image-editor/_bootstrap4-definition.scss +0 -1
  41. package/styles/image-editor/_bootstrap5-definition.scss +0 -1
  42. package/styles/image-editor/_fabric-dark-definition.scss +0 -1
  43. package/styles/image-editor/_fabric-definition.scss +0 -1
  44. package/styles/image-editor/_fluent-definition.scss +0 -1
  45. package/styles/image-editor/_fusionnew-definition.scss +0 -1
  46. package/styles/image-editor/_highcontrast-definition.scss +0 -1
  47. package/styles/image-editor/_highcontrast-light-definition.scss +0 -1
  48. package/styles/image-editor/_layout.scss +2 -32
  49. package/styles/image-editor/_material-dark-definition.scss +0 -1
  50. package/styles/image-editor/_material-definition.scss +0 -1
  51. package/styles/image-editor/_material3-definition.scss +2 -3
  52. package/styles/image-editor/_tailwind-definition.scss +0 -1
  53. package/styles/image-editor/bootstrap-dark.css +0 -12
  54. package/styles/image-editor/bootstrap.css +0 -12
  55. package/styles/image-editor/bootstrap4.css +0 -12
  56. package/styles/image-editor/bootstrap5-dark.css +0 -12
  57. package/styles/image-editor/bootstrap5.css +0 -12
  58. package/styles/image-editor/fabric-dark.css +0 -12
  59. package/styles/image-editor/fabric.css +0 -12
  60. package/styles/image-editor/fluent-dark.css +0 -12
  61. package/styles/image-editor/fluent.css +0 -12
  62. package/styles/image-editor/highcontrast-light.css +0 -12
  63. package/styles/image-editor/highcontrast.css +0 -12
  64. package/styles/image-editor/icons/_bds.scss +411 -0
  65. package/styles/image-editor/material-dark.css +0 -12
  66. package/styles/image-editor/material.css +0 -12
  67. package/styles/image-editor/material3-dark.css +4 -25
  68. package/styles/image-editor/material3.css +4 -25
  69. package/styles/image-editor/tailwind-dark.css +2 -15
  70. package/styles/image-editor/tailwind.css +2 -15
  71. package/styles/material-dark.css +0 -12
  72. package/styles/material.css +0 -12
  73. package/styles/material3-dark.css +4 -25
  74. package/styles/material3.css +4 -25
  75. package/styles/tailwind-dark.css +2 -15
  76. package/styles/tailwind.css +2 -15
  77. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -63
  78. package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -39
@@ -17,7 +17,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
17
17
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
19
19
  };
20
- import { Component, NotifyPropertyChanges, Property, addClass, removeClass, extend, isBlazor } from '@syncfusion/ej2-base';
20
+ import { Component, NotifyPropertyChanges, Property, addClass, removeClass, extend } from '@syncfusion/ej2-base';
21
21
  import { Event, EventHandler, getComponent, isNullOrUndefined, getUniqueID } from '@syncfusion/ej2-base';
22
22
  import { Dialog, createSpinner } from '@syncfusion/ej2-popups';
23
23
  import { Complex, Browser, ChildProperty, compile as templateCompiler, compile } from '@syncfusion/ej2-base';
@@ -252,26 +252,13 @@ var ImageEditor = /** @class */ (function (_super) {
252
252
  _this.isFrameBtnClick = false;
253
253
  /** @hidden */
254
254
  _this.isChangesSaved = false;
255
- if (isBlazor()) {
256
- new Crop(_this);
257
- new Draw(_this);
258
- new Filter(_this);
259
- new FreehandDrawing(_this);
260
- new Selection(_this);
261
- new Shape(_this);
262
- new Transform(_this);
263
- new UndoRedo(_this);
264
- new Export(_this);
265
- }
266
- else {
267
- ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
268
- ImageEditor_1.Inject(UndoRedo);
269
- ImageEditor_1.Inject(Filter);
270
- ImageEditor_1.Inject(Shape);
271
- ImageEditor_1.Inject(FreehandDrawing);
272
- if (element) {
273
- _this.appendTo(element);
274
- }
255
+ ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
256
+ ImageEditor_1.Inject(UndoRedo);
257
+ ImageEditor_1.Inject(Filter);
258
+ ImageEditor_1.Inject(Shape);
259
+ ImageEditor_1.Inject(FreehandDrawing);
260
+ if (element) {
261
+ _this.appendTo(element);
275
262
  }
276
263
  return _this;
277
264
  }
@@ -383,13 +370,8 @@ var ImageEditor = /** @class */ (function (_super) {
383
370
  }
384
371
  this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
385
372
  this.upperContext.fillStyle = this.themeColl[this.theme]['secondaryColor'];
386
- if (isBlazor()) {
387
- this.updateToolbar(this.element, 'imageLoaded');
388
- }
389
- else {
390
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
391
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
392
- }
373
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
374
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
393
375
  }
394
376
  break;
395
377
  case 'finetuneSettings':
@@ -401,13 +383,8 @@ var ImageEditor = /** @class */ (function (_super) {
401
383
  case 'locale':
402
384
  if (newProperties.locale) {
403
385
  this.notify('toolbar', { prop: 'setLocale', onPropertyChange: false, value: { locale: newProperties.locale } });
404
- if (isBlazor()) {
405
- this.updateToolbar(this.element, 'imageLoaded');
406
- }
407
- else {
408
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
409
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
410
- }
386
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
387
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
411
388
  }
412
389
  break;
413
390
  case 'allowUndoRedo':
@@ -417,47 +394,25 @@ var ImageEditor = /** @class */ (function (_super) {
417
394
  else {
418
395
  this.allowUndoRedo = false;
419
396
  }
420
- if (isBlazor()) {
421
- this.updateToolbar(this.element, 'imageLoaded');
422
- }
423
- else {
424
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
425
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
426
- }
397
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
398
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
427
399
  break;
428
400
  case 'showQuickAccessToolbar':
429
401
  if (newProperties.showQuickAccessToolbar) {
430
402
  this.showQuickAccessToolbar = true;
431
- if (!isBlazor()) {
432
- this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
433
- }
403
+ this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
434
404
  indexObj = { freehandSelectedIndex: null };
435
405
  this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
436
406
  if (this.activeObj.shape) {
437
- if (isBlazor()) {
438
- this.updateToolbar(this.element, 'quickAccessToolbar', this.activeObj.shape);
439
- }
440
- else {
441
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
442
- }
407
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
443
408
  }
444
409
  else if (indexObj['freehandSelectedIndex']) {
445
- if (isBlazor()) {
446
- this.updateToolbar(this.element, 'quickAccessToolbar', 'pen');
447
- }
448
- else {
449
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
450
- }
410
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
451
411
  }
452
412
  }
453
413
  else {
454
414
  this.showQuickAccessToolbar = false;
455
- if (isBlazor()) {
456
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
457
- }
458
- else {
459
- this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
460
- }
415
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
461
416
  }
462
417
  break;
463
418
  case 'zoomSettings':
@@ -467,22 +422,12 @@ var ImageEditor = /** @class */ (function (_super) {
467
422
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
468
423
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
469
424
  ZoomTrigger.Commands);
470
- if (isBlazor()) {
471
- this.updateToolbar(this.element, 'imageLoaded');
472
- }
473
- else {
474
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
475
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
476
- }
425
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
426
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
477
427
  }
478
428
  else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
479
- if (isBlazor()) {
480
- this.updateToolbar(this.element, 'imageLoaded');
481
- }
482
- else {
483
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
484
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
485
- }
429
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
430
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
486
431
  }
487
432
  break;
488
433
  case 'selectionSettings':
@@ -497,33 +442,24 @@ var ImageEditor = /** @class */ (function (_super) {
497
442
  case 'toolbar':
498
443
  if (newProperties.toolbar) {
499
444
  this.toolbar = newProperties.toolbar;
500
- if (isBlazor()) {
501
- this.updateToolbar(this.element, 'imageLoaded');
502
- }
503
- else {
504
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
505
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
506
- }
445
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
446
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
507
447
  }
508
448
  break;
509
449
  case 'toolbarTemplate':
510
450
  if (newProperties.toolbarTemplate) {
511
- if (!isBlazor()) {
512
- this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
513
- this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
514
- this.element.appendChild(this.createElement('div', {
515
- id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
516
- }));
517
- this.toolbarTemplateFn();
518
- }
451
+ this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
452
+ this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
453
+ this.element.appendChild(this.createElement('div', {
454
+ id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
455
+ }));
456
+ this.toolbarTemplateFn();
519
457
  }
520
458
  break;
521
459
  case 'quickAccessToolbarTemplate':
522
460
  if (newProperties.quickAccessToolbarTemplate) {
523
- if (!isBlazor()) {
524
- this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
525
- this.quickAccessToolbarTemplateFn();
526
- }
461
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
462
+ this.quickAccessToolbarTemplateFn();
527
463
  }
528
464
  break;
529
465
  }
@@ -539,14 +475,9 @@ var ImageEditor = /** @class */ (function (_super) {
539
475
  if (!this.element.getAttribute('class')) {
540
476
  this.element.removeAttribute('class');
541
477
  }
542
- if (isBlazor()) {
543
- this.element.classList.remove('e-image-editor');
544
- }
545
- else {
546
- this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
547
- this.notify('destroyed', null);
548
- _super.prototype.destroy.call(this);
549
- }
478
+ this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
479
+ this.notify('destroyed', null);
480
+ _super.prototype.destroy.call(this);
550
481
  this.unwireEvent();
551
482
  this.element.innerHTML = '';
552
483
  };
@@ -737,6 +668,9 @@ var ImageEditor = /** @class */ (function (_super) {
737
668
  var obj = { toolbarHeight: 0 };
738
669
  this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
739
670
  var height = obj['toolbarHeight'];
671
+ if (this.toolbar && this.toolbar.length > 0 && this.toolbar.indexOf('Open') === -1) {
672
+ height = 0;
673
+ }
740
674
  this.element.style.width = this.width;
741
675
  this.element.style.height = this.height;
742
676
  var canvasWrapper = this.element.appendChild(this.createElement('div', { id: this.element.id + '_canvasWrapper',
@@ -904,10 +838,12 @@ var ImageEditor = /** @class */ (function (_super) {
904
838
  /**
905
839
  * Clears the current selection performed in the image editor.
906
840
  *
841
+ * @param { boolean } resetCrop - Specifies to reset last cropped image.
842
+ *
907
843
  * @returns {void}.
908
844
  */
909
- ImageEditor.prototype.clearSelection = function () {
910
- this.notify('selection', { prop: 'clearSelection', onPropertyChange: false });
845
+ ImageEditor.prototype.clearSelection = function (resetCrop) {
846
+ this.notify('selection', { prop: 'clearSelection', onPropertyChange: false, value: { resetCrop: resetCrop } });
911
847
  };
912
848
  /**
913
849
  * Crops an image based on the selection done in the image editor.
@@ -955,6 +891,11 @@ var ImageEditor = /** @class */ (function (_super) {
955
891
  */
956
892
  ImageEditor.prototype.getImageData = function () {
957
893
  var obj = { canvas: null };
894
+ var dummyObj = { bool: false };
895
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: dummyObj } });
896
+ if (dummyObj['bool'] || this.togglePen || this.activeObj.shape) {
897
+ this.okBtn();
898
+ }
958
899
  this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
959
900
  return obj['canvas'].getContext('2d').getImageData(0, 0, obj['canvas'].width, obj['canvas'].height);
960
901
  };
@@ -991,13 +932,11 @@ var ImageEditor = /** @class */ (function (_super) {
991
932
  this.clearContext(this.lowerContext);
992
933
  this.clearContext(this.upperContext);
993
934
  this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
994
- if (!isBlazor()) {
995
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
996
- isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
997
- if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
998
- getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
999
- this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
1000
- }
935
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
936
+ isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
937
+ if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
938
+ getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
939
+ this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
1001
940
  }
1002
941
  var isImageLoaded = this.isImageLoaded;
1003
942
  this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
@@ -1062,36 +1001,28 @@ var ImageEditor = /** @class */ (function (_super) {
1062
1001
  }
1063
1002
  this.notifyResetForAllModules();
1064
1003
  this.notify('filter', { prop: 'update-finetunes' });
1065
- if (!isBlazor()) {
1066
- if (this.toolbarTemplate) {
1067
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
1068
- }
1069
- else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
1070
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
1071
- }
1072
- this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
1004
+ if (this.toolbarTemplate) {
1005
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
1073
1006
  }
1007
+ else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
1008
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
1009
+ }
1010
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
1074
1011
  this.isImageLoaded = isImageLoaded;
1075
1012
  this.straightenBaseImageCanvas();
1076
1013
  this.isImageLoaded = false;
1077
1014
  this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
1078
1015
  this.isImageLoaded = isImageLoaded;
1079
1016
  this.prevStraightenedDegree = 0;
1080
- if (!isBlazor()) {
1081
- var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
1082
- if (ctWrapper) {
1083
- ctWrapper.classList.add('e-hide');
1084
- }
1085
- this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
1086
- this.notify('toolbar', { prop: 'enable-disable-btns' });
1087
- var straightenObj = { bool: this.isStraightening };
1088
- if (Browser.isDevice && straightenObj['bool']) {
1089
- this.notify('crop', { prop: 'resizeWrapper' });
1090
- }
1017
+ var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
1018
+ if (ctWrapper) {
1019
+ ctWrapper.classList.add('e-hide');
1091
1020
  }
1092
- else {
1093
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1094
- this.activeObj.textSettings.fontFamily = this.defaultFontFamily;
1021
+ this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
1022
+ this.notify('toolbar', { prop: 'enable-disable-btns' });
1023
+ var straightenObj = { bool: this.isStraightening };
1024
+ if (Browser.isDevice && straightenObj['bool']) {
1025
+ this.notify('crop', { prop: 'resizeWrapper' });
1095
1026
  }
1096
1027
  }
1097
1028
  };
@@ -1111,9 +1042,11 @@ var ImageEditor = /** @class */ (function (_super) {
1111
1042
  */
1112
1043
  ImageEditor.prototype.rotate = function (degree) {
1113
1044
  var obj = { isRotate: false };
1045
+ if (degree === 90 || degree === -90) {
1046
+ this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
1047
+ }
1114
1048
  this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
1115
1049
  this.notify('draw', { prop: 'redrawDownScale' });
1116
- this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1117
1050
  return obj['isRotate'];
1118
1051
  };
1119
1052
  /**
@@ -1151,8 +1084,20 @@ var ImageEditor = /** @class */ (function (_super) {
1151
1084
  this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
1152
1085
  this.notify('draw', { prop: 'select', onPropertyChange: false,
1153
1086
  value: { type: type, startX: startX, startY: startY, width: width, height: height } });
1154
- this.notify('draw', { prop: 'select', onPropertyChange: false,
1155
- value: { type: type, startX: startX, startY: startY, width: width, height: height } });
1087
+ if ((startX && startY) || (width && height)) {
1088
+ this.notify('draw', { prop: 'select', onPropertyChange: false,
1089
+ value: { type: type, startX: startX, startY: startY, width: width, height: height } });
1090
+ }
1091
+ else {
1092
+ this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
1093
+ totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
1094
+ rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
1095
+ destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
1096
+ srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
1097
+ aspectWidth: null, aspectHeight: null, straightenZoom: 0,
1098
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
1099
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
1100
+ }
1156
1101
  };
1157
1102
  /**
1158
1103
  * Enable or disable a freehand drawing option in an Image Editor.
@@ -1224,16 +1169,17 @@ var ImageEditor = /** @class */ (function (_super) {
1224
1169
  * @param {string} strokeColor - Specifies the stroke color of ellipse.
1225
1170
  * @param {string} fillColor - Specifies the fill color of the ellipse.
1226
1171
  * @param {number} degree - Specifies the degree to rotate the ellipse.
1172
+ * @param {boolean} isSelected - Specifies to show the ellipse in the selected state.
1227
1173
  * @returns {boolean}.
1228
1174
  *
1229
1175
  */
1230
- ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
1176
+ ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
1231
1177
  var isEllipse = false;
1232
1178
  var isPointsInRange = this.allowShape(x, y);
1233
1179
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1234
1180
  isEllipse = true;
1235
1181
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
1236
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
1182
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
1237
1183
  this.notify('draw', { prop: 'redrawDownScale' });
1238
1184
  }
1239
1185
  return isEllipse;
@@ -1247,15 +1193,16 @@ var ImageEditor = /** @class */ (function (_super) {
1247
1193
  * @param {number} endY - Specifies end point y-coordinates of the line.
1248
1194
  * @param {number} strokeWidth - Specifies the stroke width of line.
1249
1195
  * @param {string} strokeColor - Specifies the stroke color of line.
1196
+ * @param {boolean} isSelected - Specifies to show the line in the selected state.
1250
1197
  * @returns {boolean}.
1251
1198
  */
1252
- ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
1199
+ ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
1253
1200
  var isLine = false;
1254
1201
  var isPointsInRange = this.allowShape(startX, startY);
1255
1202
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
1256
1203
  isLine = true;
1257
1204
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1258
- endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
1205
+ endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
1259
1206
  this.notify('draw', { prop: 'redrawDownScale' });
1260
1207
  }
1261
1208
  return isLine;
@@ -1271,15 +1218,17 @@ var ImageEditor = /** @class */ (function (_super) {
1271
1218
  * @param {string} strokeColor - Specifies the stroke color of arrow.
1272
1219
  * @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
1273
1220
  * @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
1221
+ * @param {boolean} isSelected - Specifies to show the arrow in the selected state.
1274
1222
  * @returns {boolean}.
1275
1223
  */
1276
- ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
1224
+ ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
1277
1225
  var isArrow = false;
1278
1226
  var isPointsInRange = this.allowShape(startX, startY);
1279
1227
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
1280
1228
  isArrow = true;
1281
1229
  this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
1282
- endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
1230
+ endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
1231
+ isSelected: isSelected } });
1283
1232
  this.notify('draw', { prop: 'redrawDownScale' });
1284
1233
  }
1285
1234
  return isArrow;
@@ -1290,9 +1239,10 @@ var ImageEditor = /** @class */ (function (_super) {
1290
1239
  * @param {Point[]} pointColl – Specifies collection of start and end x, y-coordinates of path.
1291
1240
  * @param {number} strokeWidth - Specifies the stroke width of path.
1292
1241
  * @param {string} strokeColor - Specifies the stroke color of path.
1242
+ * @param {boolean} isSelected - Specifies to show the path in the selected state.
1293
1243
  * @returns {boolean}.
1294
1244
  */
1295
- ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, opacity) {
1245
+ ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, isSelected) {
1296
1246
  this.isPublicMethod = true;
1297
1247
  var obj = { inRange: false };
1298
1248
  var isPath = false;
@@ -1308,7 +1258,7 @@ var ImageEditor = /** @class */ (function (_super) {
1308
1258
  if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
1309
1259
  isPath = true;
1310
1260
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
1311
- strokeWidth: strokeWidth, strokeColor: strokeColor } });
1261
+ strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
1312
1262
  this.notify('draw', { prop: 'redrawDownScale' });
1313
1263
  }
1314
1264
  return isPath;
@@ -1324,15 +1274,16 @@ var ImageEditor = /** @class */ (function (_super) {
1324
1274
  * @param {string} strokeColor - Specifies the stroke color of rectangle.
1325
1275
  * @param {string} fillColor - Specifies the fill color of the rectangle.
1326
1276
  * @param {number} degree - Specifies the degree to rotate the rectangle.
1277
+ * @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
1327
1278
  * @returns {boolean}.
1328
1279
  */
1329
- ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
1280
+ ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
1330
1281
  var isRectangle = false;
1331
1282
  var isPointsInRange = this.allowShape(x, y);
1332
1283
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1333
1284
  isRectangle = true;
1334
1285
  this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1335
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
1286
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
1336
1287
  this.notify('draw', { prop: 'redrawDownScale' });
1337
1288
  }
1338
1289
  return isRectangle;
@@ -1350,16 +1301,17 @@ var ImageEditor = /** @class */ (function (_super) {
1350
1301
  * @param {boolean} bold - Specifies whether the text is bold or not.
1351
1302
  * @param {boolean} italic - Specifies whether the text is italic or not.
1352
1303
  * @param {string} color - Specifies font color of the text.
1304
+ * @param {boolean} isSelected - Specifies to show the text in the selected state.
1353
1305
  * @returns {boolean}.
1354
1306
  *
1355
1307
  */
1356
- ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
1308
+ ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
1357
1309
  var isText = false;
1358
1310
  var isPointsInRange = this.allowShape(x, y);
1359
1311
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1360
1312
  isText = true;
1361
1313
  this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
1362
- fontSize: fontSize, bold: bold, italic: italic, color: color } });
1314
+ fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected } });
1363
1315
  this.notify('draw', { prop: 'redrawDownScale' });
1364
1316
  }
1365
1317
  return isText;
@@ -1376,16 +1328,17 @@ var ImageEditor = /** @class */ (function (_super) {
1376
1328
  * @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
1377
1329
  * @param {number} degree - Specifies the degree to rotate the image.
1378
1330
  * @param {number} opacity - Specifies the value for the image.
1331
+ * @param {boolean} isSelected - Specifies to show the image in the selected state.
1379
1332
  * @returns {boolean}.
1380
1333
  *
1381
1334
  */
1382
- ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity) {
1335
+ ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity, isSelected) {
1383
1336
  var isImage = false;
1384
1337
  var isPointsInRange = this.allowShape(x, y);
1385
1338
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1386
1339
  var length_1 = this.objColl.length;
1387
1340
  this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1388
- src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity } });
1341
+ src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
1389
1342
  this.notify('draw', { prop: 'redrawDownScale' });
1390
1343
  if (this.objColl.length > length_1) {
1391
1344
  isImage = true;
@@ -1433,10 +1386,11 @@ var ImageEditor = /** @class */ (function (_super) {
1433
1386
  *
1434
1387
  */
1435
1388
  ImageEditor.prototype.getShapeSetting = function (id) {
1436
- var shapeDetails = {};
1389
+ var obj = { shapeDetails: null };
1437
1390
  this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
1438
- value: { id: id, obj: shapeDetails } });
1391
+ value: { id: id, obj: obj } });
1439
1392
  this.notify('draw', { prop: 'redrawDownScale' });
1393
+ var shapeDetails = obj['shapeDetails'] ? obj['shapeDetails'] : {};
1440
1394
  return shapeDetails;
1441
1395
  };
1442
1396
  /**
@@ -1540,28 +1494,23 @@ var ImageEditor = /** @class */ (function (_super) {
1540
1494
  if ((width.toString()).length <= 4 && (height.toString()).length <= 4) {
1541
1495
  var destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
1542
1496
  height: this.img.destHeight };
1543
- if (isBlazor()) {
1544
- this.updateToolbar(this.element, 'resize');
1497
+ if (isAspectRatio) {
1498
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1499
+ isApplyBtn: false, isCropping: false } });
1500
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1501
+ isApplyBtn: false, isCropping: false } });
1545
1502
  }
1546
1503
  else {
1547
- if (isAspectRatio) {
1548
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1549
- isApplyBtn: false, isCropping: false } });
1550
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1551
- isApplyBtn: false, isCropping: false } });
1552
- }
1553
- else {
1554
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1555
- isApplyBtn: false, isCropping: false } });
1556
- }
1557
- var aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
1558
- var aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
1559
- if (aspectRatioWidth && aspectRatioHeight) {
1560
- getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
1561
- aspectRatioWidth.value = Math.floor(width).toString() + ' px';
1562
- getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
1563
- aspectRatioHeight.value = Math.floor(height).toString() + ' px';
1564
- }
1504
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1505
+ isApplyBtn: false, isCropping: false } });
1506
+ }
1507
+ var aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
1508
+ var aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
1509
+ if (aspectRatioWidth && aspectRatioHeight) {
1510
+ getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
1511
+ aspectRatioWidth.value = Math.floor(width).toString() + ' px';
1512
+ getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
1513
+ aspectRatioHeight.value = Math.floor(height).toString() + ' px';
1565
1514
  }
1566
1515
  this.notify('transform', { prop: 'resize', value: { width: width, height: height, isAspectRatio: isAspectRatio } });
1567
1516
  if (destPoints.startX !== this.img.destLeft || destPoints.startY !== this.img.destTop ||
@@ -1609,13 +1558,7 @@ var ImageEditor = /** @class */ (function (_super) {
1609
1558
  extend(this.tempFrameObj, this.frameObj);
1610
1559
  this.tempFrameZoomLevel = this.transform.zoomFactor;
1611
1560
  this.frameDestPoints = extend({}, this.img, {}, true);
1612
- if (!isBlazor()) {
1613
- this.notify('toolbar', { prop: 'frameToolbarClick' });
1614
- }
1615
- else {
1616
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1617
- this.performFrameClick();
1618
- }
1561
+ this.notify('toolbar', { prop: 'frameToolbarClick' });
1619
1562
  this.frameObj.type = frameType.toLowerCase();
1620
1563
  this.frameObj.color = color;
1621
1564
  this.frameObj.gradientColor = gradientColor;
@@ -1670,22 +1613,65 @@ var ImageEditor = /** @class */ (function (_super) {
1670
1613
  * {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
1671
1614
  *
1672
1615
  * @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
1616
+ * @param {boolean} isSelected - Specifies to show the shape in the selected state.
1673
1617
  * @returns {boolean}.
1674
1618
  *
1675
1619
  */
1676
- ImageEditor.prototype.updateShape = function (setting) {
1620
+ ImageEditor.prototype.updateShape = function (setting, isSelected) {
1677
1621
  var obj = { isSelected: false };
1678
- this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1679
- if (obj['isSelected']) {
1680
- this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1681
- value: { shapeSettings: setting } });
1682
- var activeObj = extend({}, this.activeObj, {}, true);
1683
- this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1684
- this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1685
- this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1686
- this.okBtn();
1687
- this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1688
- this.notify('draw', { prop: 'redrawDownScale' });
1622
+ var isTextArea = false;
1623
+ var freehandObj = { bool: false };
1624
+ if (isNullOrUndefined(setting.id)) {
1625
+ if (setting.strokeColor) {
1626
+ this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
1627
+ }
1628
+ if (setting.fillColor) {
1629
+ this.activeObj.strokeSettings.fillColor = setting.fillColor;
1630
+ }
1631
+ if (setting.strokeWidth) {
1632
+ this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
1633
+ }
1634
+ if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
1635
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
1636
+ }
1637
+ }
1638
+ else {
1639
+ if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
1640
+ this.textArea.style.display === 'inline-block')) {
1641
+ this.okBtn();
1642
+ isTextArea = true;
1643
+ }
1644
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
1645
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
1646
+ if (obj['isSelected']) {
1647
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
1648
+ value: { shapeSettings: setting } });
1649
+ var activeObj = extend({}, this.activeObj, {}, true);
1650
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1651
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
1652
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1653
+ if (activeObj.shape) {
1654
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
1655
+ }
1656
+ if (this.activeObj.shape === 'text') {
1657
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
1658
+ }
1659
+ if (freehandObj['bool']) {
1660
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
1661
+ }
1662
+ this.okBtn(isSelected);
1663
+ if (freehandObj['bool']) {
1664
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
1665
+ }
1666
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1667
+ this.notify('draw', { prop: 'redrawDownScale' });
1668
+ if (isTextArea) {
1669
+ this.enableTextEditing();
1670
+ }
1671
+ if (isSelected) {
1672
+ this.selectShape(setting.id);
1673
+ }
1674
+ }
1689
1675
  }
1690
1676
  return obj['isSelected'];
1691
1677
  };
@@ -1702,19 +1688,80 @@ var ImageEditor = /** @class */ (function (_super) {
1702
1688
  if (shapeId.split('_')[0] === 'shape') {
1703
1689
  this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
1704
1690
  if (obj['isSelected']) {
1705
- if (isBlazor()) {
1706
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1707
- this.duplicateShape(false, true);
1708
- }
1709
- else {
1710
- this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
1711
- }
1691
+ this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
1712
1692
  this.okBtn();
1713
1693
  this.notify('draw', { prop: 'redrawDownScale' });
1714
1694
  }
1715
1695
  }
1716
1696
  return obj['isSelected'];
1717
1697
  };
1698
+ /**
1699
+ * Update filter to the canvas in the ImageEditor.
1700
+ *
1701
+ * @param {ImageFilterOption } filterOption - Specifies the filter options to the image.
1702
+ *
1703
+ * @returns {string}.
1704
+ *
1705
+ */
1706
+ ImageEditor.prototype.getImageFilter = function (filterOption) {
1707
+ var canvas = this.createElement('canvas');
1708
+ var ctx = canvas.getContext('2d');
1709
+ this.notify('filter', { prop: 'updateAdj', value: { type: filterOption.toLowerCase(), value: null, isPreview: true, ctx: ctx } });
1710
+ return ctx.filter;
1711
+ };
1712
+ /**
1713
+ * Enable text area editing in the ImageEditor.
1714
+ *
1715
+ * @returns {void}.
1716
+ *
1717
+ */
1718
+ ImageEditor.prototype.enableTextEditing = function () {
1719
+ var activeObj = extend({}, this.activeObj, {}, true);
1720
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1721
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: false } });
1722
+ this.activeObj = activeObj;
1723
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
1724
+ };
1725
+ /**
1726
+ * Specifies if it's possible to undo the last recent action made in an Image Editor.
1727
+ *
1728
+ * @returns {boolean}.
1729
+ *
1730
+ */
1731
+ ImageEditor.prototype.canUndo = function () {
1732
+ var canUndo = false;
1733
+ var object = this.getUndoRedoColl();
1734
+ var undoRedoIndex = object['index'];
1735
+ if (undoRedoIndex > 0) {
1736
+ canUndo = true;
1737
+ }
1738
+ return canUndo;
1739
+ };
1740
+ /**
1741
+ * Specifies if it's possible to redo the last recent action made in an Image Editor.
1742
+ *
1743
+ * @returns {boolean}.
1744
+ *
1745
+ */
1746
+ ImageEditor.prototype.canRedo = function () {
1747
+ var canRedo = false;
1748
+ var object = this.getUndoRedoColl();
1749
+ var undoRedoColl = object['undoRedoColl'];
1750
+ var undoRedoIndex = object['index'];
1751
+ if (undoRedoColl && undoRedoColl.length > 0 && undoRedoIndex < undoRedoColl.length - 1) {
1752
+ canRedo = true;
1753
+ }
1754
+ if (undoRedoIndex === undoRedoColl.length) {
1755
+ canRedo = false;
1756
+ }
1757
+ else if (undoRedoIndex === 0 && undoRedoColl.length > 0) {
1758
+ canRedo = true;
1759
+ }
1760
+ else if (undoRedoIndex > 0) {
1761
+ canRedo = true;
1762
+ }
1763
+ return canRedo;
1764
+ };
1718
1765
  // Toolbar related codes
1719
1766
  ImageEditor.prototype.toolbarTemplateFn = function () {
1720
1767
  var template;
@@ -1798,6 +1845,16 @@ var ImageEditor = /** @class */ (function (_super) {
1798
1845
  this.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
1799
1846
  this.notify('freehand-draw', { prop: 'color-change', value: { color: obj['tempFreeHandDrawEditingStyles'].strokeColor } });
1800
1847
  };
1848
+ ImageEditor.prototype.getUndoRedoColl = function () {
1849
+ var obj = { undoRedoColl: null, index: null };
1850
+ var undoRedoObj = { undoRedoStep: null };
1851
+ var object = { appliedUndoRedoColl: [] };
1852
+ this.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
1853
+ this.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
1854
+ obj['undoRedoColl'] = object['appliedUndoRedoColl'];
1855
+ obj['index'] = undoRedoObj['undoRedoStep'];
1856
+ return obj;
1857
+ };
1801
1858
  ImageEditor.prototype.updateImageTransformColl = function (type) {
1802
1859
  var value;
1803
1860
  if (type === 'rotateleft') {
@@ -1941,10 +1998,9 @@ var ImageEditor = /** @class */ (function (_super) {
1941
1998
  shapeSettings.type = ShapeType.FreehandDraw;
1942
1999
  }
1943
2000
  var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
1944
- this.triggerShapeChanged(shapeChangedArgs);
2001
+ this.trigger('shapeChange', shapeChangedArgs);
1945
2002
  }
1946
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1947
- if (aspectIcon || nonAspectIcon || (isBlazor() && this.currentToolbar === 'resize-toolbar')) {
2003
+ if (aspectIcon || nonAspectIcon) {
1948
2004
  var obj_2 = { width: null, height: null };
1949
2005
  this.notify('selection', { prop: 'getNumTextValue', onPropertyChange: false, value: { obj: obj_2 } });
1950
2006
  var point = { x: obj_2['width'], y: obj_2['height'] };
@@ -1978,7 +2034,7 @@ var ImageEditor = /** @class */ (function (_super) {
1978
2034
  isCircleCrop: null } });
1979
2035
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1980
2036
  var obj_3 = this.cancelCropSelection;
1981
- if ((!isBlazor() && obj_3 && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon)) || (isBlazor() && obj_3 && blrNAspRatElem && blrNAspRatElem.classList.contains('e-hidden'))) {
2037
+ if ((obj_3 && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon))) {
1982
2038
  obj_3.previousObj.aspectWidth = obj_3.currentObj.aspectWidth = this.aspectWidth;
1983
2039
  obj_3.previousObj.aspectHeight = obj_3.currentObj.aspectHeight = this.aspectHeight;
1984
2040
  obj_3.previousCropObj = extend({}, this.cropObj, {}, true);
@@ -2032,9 +2088,7 @@ var ImageEditor = /** @class */ (function (_super) {
2032
2088
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
2033
2089
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
2034
2090
  }
2035
- else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) ||
2036
- (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
2037
- this.currObjType.isFiltered) {
2091
+ else if (document.querySelector('#' + this.element.id + '_sliderWrapper') || this.currObjType.isFiltered) {
2038
2092
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
2039
2093
  this.currObjType.isFiltered = false;
2040
2094
  var obj_4 = { value: null };
@@ -2050,12 +2104,7 @@ var ImageEditor = /** @class */ (function (_super) {
2050
2104
  else if (obj['bool']) {
2051
2105
  this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
2052
2106
  this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
2053
- if (isBlazor()) {
2054
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
2055
- }
2056
- else {
2057
- this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2058
- }
2107
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2059
2108
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2060
2109
  }
2061
2110
  else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
@@ -2081,20 +2130,16 @@ var ImageEditor = /** @class */ (function (_super) {
2081
2130
  }
2082
2131
  this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
2083
2132
  }
2084
- if (!isBlazor() && !obj['isCropToolbar']) {
2133
+ if (!obj['isCropToolbar']) {
2085
2134
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
2086
2135
  isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
2087
2136
  }
2088
- else if (isBlazor() && !obj['isCropToolbar'] && (this.currentToolbar == 'resize-toolbar' || this.currentToolbar == 'frame-toolbar')) {
2089
- this.updateToolbar(this.element, 'imageLoaded');
2090
- }
2091
2137
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
2092
2138
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
2093
2139
  this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
2094
2140
  this.isResizeOkBtn = false;
2095
2141
  this.notify('draw', { prop: 'redrawDownScale' });
2096
2142
  this.isChangesSaved = false;
2097
- this.triggerActionComplete();
2098
2143
  };
2099
2144
  /**
2100
2145
  * Set the temporary filter properties.
@@ -2153,18 +2198,12 @@ var ImageEditor = /** @class */ (function (_super) {
2153
2198
  var data = this.getImageData();
2154
2199
  if (ctWrapper) {
2155
2200
  ctWrapper.classList.remove('e-hide');
2156
- if (isBlazor()) {
2157
- this.element.querySelector('.e-ie-toolbar-check-btn').classList.remove('e-hidden');
2158
- this.element.querySelector('.e-ie-toolbar-close-btn').classList.remove('e-hidden');
2159
- }
2160
2201
  }
2161
- if (!isBlazor()) {
2162
- if (!Browser.isDevice) {
2163
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
2164
- isApplyBtn: true, isCropping: false } });
2165
- }
2166
- this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
2202
+ if (!Browser.isDevice) {
2203
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
2204
+ isApplyBtn: true, isCropping: false } });
2167
2205
  }
2206
+ this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
2168
2207
  this.objColl = objColl;
2169
2208
  this.pointColl = pointColl;
2170
2209
  this.freehandCounter = pointColl.length;
@@ -2182,26 +2221,12 @@ var ImageEditor = /** @class */ (function (_super) {
2182
2221
  * @returns {void}.
2183
2222
  */
2184
2223
  ImageEditor.prototype.setCurrAdjustmentValue = function (type, value) {
2185
- var _this = this;
2186
- var finetuneValueChanging = { finetune: this.getFinetuneOption(type),
2187
- value: value, cancel: false };
2188
- if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
2189
- finetuneValueChanging.value = parseInt(finetuneValueChanging.value.toString());
2190
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2191
- this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanging', finetuneValueChanging, null).then(function (finetuneValueChanging) {
2192
- if (finetuneValueChanging.cancel) {
2193
- return;
2194
- }
2195
- _this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
2196
- });
2197
- }
2198
- else {
2199
- this.trigger('finetuneValueChanging', finetuneValueChanging);
2200
- if (finetuneValueChanging.cancel) {
2201
- return;
2202
- }
2203
- this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
2224
+ var finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
2225
+ this.trigger('finetuneValueChanging', finetuneValueChanging);
2226
+ if (finetuneValueChanging.cancel) {
2227
+ return;
2204
2228
  }
2229
+ this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
2205
2230
  };
2206
2231
  /**
2207
2232
  * Get the square point for path.
@@ -2295,24 +2320,22 @@ var ImageEditor = /** @class */ (function (_super) {
2295
2320
  currentText: null, previousFilter: null, isCircleCrop: null } });
2296
2321
  }
2297
2322
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2298
- if (!isBlazor()) {
2299
- if (Browser.isDevice) {
2300
- if (document.getElementById(this.element.id + '_bottomToolbar')) {
2301
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2302
- var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
2303
- toolbar_1.refreshOverflow();
2304
- }
2323
+ if (Browser.isDevice) {
2324
+ if (document.getElementById(this.element.id + '_bottomToolbar')) {
2325
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2326
+ var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
2327
+ toolbar_1.refreshOverflow();
2305
2328
  }
2306
- else {
2307
- if (document.getElementById(this.element.id + '_toolbar')) {
2308
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2309
- var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
2310
- toolbar_2.refreshOverflow();
2311
- }
2329
+ }
2330
+ else {
2331
+ if (document.getElementById(this.element.id + '_toolbar')) {
2332
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2333
+ var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
2334
+ toolbar_2.refreshOverflow();
2312
2335
  }
2313
2336
  }
2314
2337
  var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
2315
- this.triggerShapeChanged(shapeChangedArgs);
2338
+ this.trigger('shapeChange', shapeChangedArgs);
2316
2339
  };
2317
2340
  /**
2318
2341
  * Apply Font style for text.
@@ -2383,7 +2406,7 @@ var ImageEditor = /** @class */ (function (_super) {
2383
2406
  }
2384
2407
  var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2385
2408
  shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
2386
- this.triggerShapeChanged(shapeChangedArgs);
2409
+ this.trigger('shapeChange', shapeChangedArgs);
2387
2410
  };
2388
2411
  /**
2389
2412
  * Apply Font size for text.
@@ -2485,7 +2508,7 @@ var ImageEditor = /** @class */ (function (_super) {
2485
2508
  }
2486
2509
  var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2487
2510
  shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
2488
- this.triggerShapeChanged(shapeChangedArgs);
2511
+ this.trigger('shapeChange', shapeChangedArgs);
2489
2512
  };
2490
2513
  /**
2491
2514
  * Apply Font color for text.
@@ -2556,7 +2579,7 @@ var ImageEditor = /** @class */ (function (_super) {
2556
2579
  }
2557
2580
  var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2558
2581
  shapeChangedArgs.currentShapeSettings.fillColor = value;
2559
- this.triggerShapeChanged(shapeChangedArgs);
2582
+ this.trigger('shapeChange', shapeChangedArgs);
2560
2583
  };
2561
2584
  /**
2562
2585
  * Apply Pen stroke width.
@@ -2611,7 +2634,7 @@ var ImageEditor = /** @class */ (function (_super) {
2611
2634
  shapeSettings.type = ShapeType.FreehandDraw;
2612
2635
  var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2613
2636
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2614
- this.triggerShapeChanged(shapeChangedArgs);
2637
+ this.trigger('shapeChange', shapeChangedArgs);
2615
2638
  };
2616
2639
  /**
2617
2640
  * Apply Pen stroke color.
@@ -2681,7 +2704,7 @@ var ImageEditor = /** @class */ (function (_super) {
2681
2704
  shapeSettings.type = ShapeType.FreehandDraw;
2682
2705
  var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2683
2706
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
2684
- this.triggerShapeChanged(shapeChangedArgs);
2707
+ this.trigger('shapeChange', shapeChangedArgs);
2685
2708
  };
2686
2709
  /**
2687
2710
  * Apply Shape stroke width.
@@ -2727,7 +2750,7 @@ var ImageEditor = /** @class */ (function (_super) {
2727
2750
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2728
2751
  var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2729
2752
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2730
- this.triggerShapeChanged(shapeChangedArgs);
2753
+ this.trigger('shapeChange', shapeChangedArgs);
2731
2754
  }
2732
2755
  else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
2733
2756
  this.activeObj.pointColl.length === 0)) {
@@ -2784,7 +2807,7 @@ var ImageEditor = /** @class */ (function (_super) {
2784
2807
  }
2785
2808
  var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2786
2809
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
2787
- this.triggerShapeChanged(shapeChangedArgs);
2810
+ this.trigger('shapeChange', shapeChangedArgs);
2788
2811
  };
2789
2812
  /**
2790
2813
  * Apply Shape fill color.
@@ -2824,7 +2847,7 @@ var ImageEditor = /** @class */ (function (_super) {
2824
2847
  }
2825
2848
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2826
2849
  var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2827
- this.triggerShapeChanged(shapeChangedArgs);
2850
+ this.trigger('shapeChange', shapeChangedArgs);
2828
2851
  };
2829
2852
  /**
2830
2853
  * Apply horizontal flip.
@@ -2855,9 +2878,7 @@ var ImageEditor = /** @class */ (function (_super) {
2855
2878
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2856
2879
  this.objColl.pop();
2857
2880
  }
2858
- if (!isBlazor()) {
2859
- this.notify('toolbar', { prop: 'refreshSlider' });
2860
- }
2881
+ this.notify('toolbar', { prop: 'refreshSlider' });
2861
2882
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
2862
2883
  var activePoint = this.duplicateImage();
2863
2884
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
@@ -2903,9 +2924,7 @@ var ImageEditor = /** @class */ (function (_super) {
2903
2924
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2904
2925
  this.objColl.pop();
2905
2926
  }
2906
- if (!isBlazor()) {
2907
- this.notify('toolbar', { prop: 'refreshSlider' });
2908
- }
2927
+ this.notify('toolbar', { prop: 'refreshSlider' });
2909
2928
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
2910
2929
  var activePoint = this.duplicateImage();
2911
2930
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
@@ -2949,9 +2968,7 @@ var ImageEditor = /** @class */ (function (_super) {
2949
2968
  value: { obj: selPointCollObj } });
2950
2969
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2951
2970
  this.objColl.pop();
2952
- if (!isBlazor()) {
2953
- this.notify('toolbar', { prop: 'refreshSlider' });
2954
- }
2971
+ this.notify('toolbar', { prop: 'refreshSlider' });
2955
2972
  if (rotate === 'rotleft') {
2956
2973
  this.activeObj.rotatedAngle -= (90 * (Math.PI / 180));
2957
2974
  }
@@ -2968,14 +2985,8 @@ var ImageEditor = /** @class */ (function (_super) {
2968
2985
  previousCropObj: prevCropObj, previousText: null,
2969
2986
  currentText: null, previousFilter: null, isCircleCrop: null } });
2970
2987
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2971
- if (isBlazor()) {
2972
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
2973
- this.updateToolbar(this.element, 'quickAccessToolbar', 'image');
2974
- }
2975
- else {
2976
- this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2977
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
2978
- }
2988
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2989
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
2979
2990
  };
2980
2991
  /**
2981
2992
  * Get pascalToSplitWords from string.
@@ -3034,6 +3045,12 @@ var ImageEditor = /** @class */ (function (_super) {
3034
3045
  * @returns {void}.
3035
3046
  */
3036
3047
  ImageEditor.prototype.transformSelect = function (type) {
3048
+ if (this.transform.straighten === 0 && (type === 'rotateleft' || type === 'rotateright') &&
3049
+ this.activeObj.shape && ['crop-2:3', 'crop-3:2', 'crop-3:4', 'crop-4:3', 'crop-4:5', 'crop-5:4', 'crop-5:7', 'crop-7:5',
3050
+ 'crop-9:16', 'crop-16:9'].indexOf(this.activeObj.shape) !== -1) {
3051
+ this.activeObj.shape = 'crop-' + this.activeObj.shape.split('-')[1].split(':')[1] + ':' + this.activeObj.shape.split('-')[1].split(':')[0];
3052
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: this.activeObj.shape, isTransform: true } });
3053
+ }
3037
3054
  this.isCropToolbar = true;
3038
3055
  this.allowDownScale = false;
3039
3056
  var straighten = this.transform.straighten;
@@ -3130,12 +3147,7 @@ var ImageEditor = /** @class */ (function (_super) {
3130
3147
  */
3131
3148
  ImageEditor.prototype.setStraighten = function (value, isMethod) {
3132
3149
  var straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
3133
- if (isBlazor()) {
3134
- this.prevStraightenEvent = this.transform.straighten;
3135
- }
3136
- else {
3137
- this.trigger('rotating', straightenEventArgs);
3138
- }
3150
+ this.trigger('rotating', straightenEventArgs);
3139
3151
  if (!straightenEventArgs.cancel) {
3140
3152
  this.performStraighten(straightenEventArgs);
3141
3153
  }
@@ -3260,85 +3272,6 @@ var ImageEditor = /** @class */ (function (_super) {
3260
3272
  }
3261
3273
  return flipState;
3262
3274
  };
3263
- // Blazor codes
3264
- /**
3265
- * To Initialize the component rendering
3266
- *
3267
- * @private
3268
- * @param {HTMLCanvasElement} element - Specifies the canvas element.
3269
- * @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
3270
- * @returns {void}
3271
- */
3272
- ImageEditor.prototype.initializeImageEditor = function (element, dotnetRef) {
3273
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3274
- this.element = element;
3275
- if (isBlazor() && this.element.querySelector('.place-holder')) {
3276
- this.element.querySelector('.place-holder').remove();
3277
- }
3278
- if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
3279
- this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
3280
- this.element.querySelector('.e-ie-drop-content').style.display = 'block';
3281
- }
3282
- if (isBlazor() && this.element.querySelector('.e-ie-drop-area')) {
3283
- this.element.querySelector('.e-ie-drop-area').style.display = 'block';
3284
- }
3285
- if (isBlazor() && this.element.querySelector('.e-toolbar-area')) {
3286
- this.element.querySelector('.e-toolbar-area').style.display = 'block';
3287
- }
3288
- var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
3289
- if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
3290
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').scrollHeight;
3291
- }
3292
- else {
3293
- this.toolbarHeight = 0;
3294
- }
3295
- canvasWrapper.style.height = (this.element.offsetHeight - this.toolbarHeight - 2) + 'px';
3296
- canvasWrapper.style.width = (this.element.offsetWidth - 2) + 'px';
3297
- this.lowerCanvas = this.element.querySelector('.e-lower-canvas');
3298
- this.upperCanvas = this.element.querySelector('.e-upper-canvas');
3299
- this.lowerCanvas.id = this.element.id + '_lowerCanvas';
3300
- this.upperCanvas.id = this.element.id + '_upperCanvas';
3301
- this.textArea = this.element.querySelector('.e-textarea');
3302
- this.inMemoryCanvas = this.createElement('canvas', {
3303
- id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
3304
- });
3305
- this.baseImgCanvas = this.createElement('canvas', {
3306
- id: this.element.id + '_baseImgCanvas', attrs: { name: 'canvasImage' }
3307
- });
3308
- this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
3309
- this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
3310
- this.lowerContext = this.lowerCanvas.getContext('2d');
3311
- this.baseImg = this.createElement('img', {
3312
- id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
3313
- });
3314
- this.upperContext = this.upperCanvas.getContext('2d');
3315
- this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
3316
- if (dotnetRef) {
3317
- this.dotNetRef = dotnetRef;
3318
- }
3319
- this.prerender();
3320
- this.wireEvent();
3321
- this.lowerContext.filter = this.getDefaultFilter();
3322
- this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
3323
- this.canvasFilter = this.initialAdjustmentValue = this.lowerContext.filter;
3324
- if (this.cssClass) {
3325
- addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
3326
- }
3327
- if (this.element) {
3328
- createSpinner({
3329
- target: this.element
3330
- });
3331
- }
3332
- this.initializeZoomSettings();
3333
- };
3334
- ImageEditor.prototype.prerender = function () {
3335
- // pre render code snippets
3336
- this.element.id = this.element.id || getUniqueID('ej2-image-editor');
3337
- if (Browser.isDevice) {
3338
- this.element.classList.add('e-device');
3339
- }
3340
- this.initializeThemeColl();
3341
- };
3342
3275
  ImageEditor.prototype.initializeZoomSettings = function () {
3343
3276
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3344
3277
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
@@ -3371,57 +3304,6 @@ var ImageEditor = /** @class */ (function (_super) {
3371
3304
  Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' }
3372
3305
  };
3373
3306
  };
3374
- /**
3375
- * Get the square point for path.
3376
- *
3377
- * @param { HTMLDivElement } element - Specifies element.
3378
- * @param { string } type - Specifies the type.
3379
- * @param { string } value - Specifies the value.
3380
- * @hidden
3381
- * @private
3382
- * @returns {void}.
3383
- */
3384
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
3385
- ImageEditor.prototype.updateToolbar = function (element, type, value) {
3386
- };
3387
- /**
3388
- * Trigger the shapeChanging event for after the shape applied.
3389
- *
3390
- * @param { ShapeChangeEventArgs } shapeChangedArgs - Specifies the shapeChaning event args.
3391
- * @hidden
3392
- * @returns {void}.
3393
- */
3394
- ImageEditor.prototype.triggerShapeChanged = function (shapeChangedArgs) {
3395
- if (isBlazor() && this.events && this.events.shapeChanged.hasDelegate === true) {
3396
- var args = { action: shapeChangedArgs.action, shapeSettings: shapeChangedArgs.currentShapeSettings };
3397
- this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', null, args);
3398
- }
3399
- else {
3400
- this.trigger('shapeChange', shapeChangedArgs);
3401
- }
3402
- };
3403
- ImageEditor.prototype.triggerActionComplete = function () {
3404
- var frameChangedArgs = this.curFrameObjEvent;
3405
- var finetuneValueChanged = this.curFinetuneObjEvent;
3406
- var imageFiltered = this.curFilterObjEvent;
3407
- if (isBlazor()) {
3408
- if (this.isFrameBtnClick && this.events && this.events.frameChanged.hasDelegate === true) {
3409
- var frameChangeArgs = { frameSettings: frameChangedArgs.currentFrameSetting };
3410
- this.dotNetRef.invokeMethodAsync('OnFrameChangingAsync', 'FrameChanged', null, frameChangeArgs);
3411
- }
3412
- if (this.isFinetuneBtnClick && this.events && this.events.finetuneValueChanged.hasDelegate === true) {
3413
- var finetuneValueChange = { finetune: this.toPascalCase(finetuneValueChanged.finetune),
3414
- value: parseInt(finetuneValueChanged.value.toString()) };
3415
- this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanged', null, finetuneValueChange);
3416
- }
3417
- if (this.isFilterCanvasClick && this.events && this.events.imageFiltered.hasDelegate === true) {
3418
- var imageFilter = { filter: this.toPascalCase(imageFiltered.filter) };
3419
- this.dotNetRef.invokeMethodAsync('OnImageFilterEventAsync', 'ImageFiltered', null, imageFilter);
3420
- }
3421
- }
3422
- else { }
3423
- this.isFilterCanvasClick = this.isFinetuneBtnClick = this.isFrameBtnClick = false;
3424
- };
3425
3307
  var ImageEditor_1;
3426
3308
  __decorate([
3427
3309
  Property('')