@syncfusion/ej2-image-editor 22.2.11 → 23.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/ej2-image-editor.umd.min.js +3 -3
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +4446 -678
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +4409 -632
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +3 -3
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +2 -2
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.js +47 -30
  13. package/src/image-editor/action/draw.d.ts +16 -0
  14. package/src/image-editor/action/draw.js +827 -81
  15. package/src/image-editor/action/export.d.ts +3 -0
  16. package/src/image-editor/action/export.js +84 -20
  17. package/src/image-editor/action/filter.d.ts +0 -1
  18. package/src/image-editor/action/filter.js +28 -41
  19. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  20. package/src/image-editor/action/freehand-draw.js +92 -56
  21. package/src/image-editor/action/selection.d.ts +6 -0
  22. package/src/image-editor/action/selection.js +417 -68
  23. package/src/image-editor/action/shape.d.ts +8 -0
  24. package/src/image-editor/action/shape.js +303 -91
  25. package/src/image-editor/action/transform.d.ts +9 -0
  26. package/src/image-editor/action/transform.js +402 -52
  27. package/src/image-editor/action/undo-redo.d.ts +1 -0
  28. package/src/image-editor/action/undo-redo.js +138 -10
  29. package/src/image-editor/base/enum.d.ts +38 -1
  30. package/src/image-editor/base/enum.js +39 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +16 -2
  32. package/src/image-editor/base/image-editor.d.ts +142 -7
  33. package/src/image-editor/base/image-editor.js +719 -70
  34. package/src/image-editor/base/interface.d.ts +233 -2
  35. package/src/image-editor/renderer/toolbar.d.ts +25 -0
  36. package/src/image-editor/renderer/toolbar.js +1274 -72
  37. package/styles/bootstrap-dark.css +73 -1
  38. package/styles/bootstrap.css +73 -1
  39. package/styles/bootstrap4.css +73 -1
  40. package/styles/bootstrap5-dark.css +73 -1
  41. package/styles/bootstrap5.css +73 -1
  42. package/styles/fabric-dark.css +73 -1
  43. package/styles/fabric.css +73 -1
  44. package/styles/fluent-dark.css +73 -1
  45. package/styles/fluent.css +73 -1
  46. package/styles/highcontrast-light.css +75 -3
  47. package/styles/highcontrast.css +74 -7
  48. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  49. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  50. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  51. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  52. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  53. package/styles/image-editor/_fabric-definition.scss +1 -0
  54. package/styles/image-editor/_fluent-definition.scss +1 -0
  55. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  56. package/styles/image-editor/_highcontrast-definition.scss +2 -1
  57. package/styles/image-editor/_highcontrast-light-definition.scss +2 -1
  58. package/styles/image-editor/_layout.scss +98 -0
  59. package/styles/image-editor/_material-dark-definition.scss +1 -0
  60. package/styles/image-editor/_material-definition.scss +1 -0
  61. package/styles/image-editor/_material3-definition.scss +2 -1
  62. package/styles/image-editor/_tailwind-definition.scss +1 -0
  63. package/styles/image-editor/_theme.scss +4 -2
  64. package/styles/image-editor/bootstrap-dark.css +73 -1
  65. package/styles/image-editor/bootstrap-dark.scss +1 -1
  66. package/styles/image-editor/bootstrap.css +73 -1
  67. package/styles/image-editor/bootstrap.scss +1 -1
  68. package/styles/image-editor/bootstrap4.css +73 -1
  69. package/styles/image-editor/bootstrap4.scss +1 -1
  70. package/styles/image-editor/bootstrap5-dark.css +73 -1
  71. package/styles/image-editor/bootstrap5-dark.scss +1 -1
  72. package/styles/image-editor/bootstrap5.css +73 -1
  73. package/styles/image-editor/bootstrap5.scss +1 -1
  74. package/styles/image-editor/fabric-dark.css +73 -1
  75. package/styles/image-editor/fabric-dark.scss +1 -1
  76. package/styles/image-editor/fabric.css +73 -1
  77. package/styles/image-editor/fabric.scss +1 -1
  78. package/styles/image-editor/fluent-dark.css +73 -1
  79. package/styles/image-editor/fluent-dark.scss +1 -1
  80. package/styles/image-editor/fluent.css +73 -1
  81. package/styles/image-editor/fluent.scss +1 -1
  82. package/styles/image-editor/highcontrast-light.css +75 -3
  83. package/styles/image-editor/highcontrast-light.scss +1 -1
  84. package/styles/image-editor/highcontrast.css +74 -7
  85. package/styles/image-editor/highcontrast.scss +1 -1
  86. package/styles/image-editor/icons/_bootstrap-dark.scss +1 -0
  87. package/styles/image-editor/icons/_bootstrap.scss +1 -0
  88. package/styles/image-editor/icons/_bootstrap4.scss +1 -0
  89. package/styles/image-editor/icons/_bootstrap5.scss +1 -0
  90. package/styles/image-editor/icons/_fabric-dark.scss +1 -0
  91. package/styles/image-editor/icons/_fabric.scss +1 -0
  92. package/styles/image-editor/icons/_fluent.scss +1 -0
  93. package/styles/image-editor/icons/_fusionnew.scss +1 -0
  94. package/styles/image-editor/icons/_highcontrast-light.scss +1 -0
  95. package/styles/image-editor/icons/_highcontrast.scss +1 -0
  96. package/styles/image-editor/icons/_material-dark.scss +1 -0
  97. package/styles/image-editor/icons/_material.scss +1 -0
  98. package/styles/image-editor/icons/_material3.scss +1 -0
  99. package/styles/image-editor/icons/_tailwind.scss +1 -0
  100. package/styles/image-editor/material-dark.css +73 -2
  101. package/styles/image-editor/material-dark.scss +1 -1
  102. package/styles/image-editor/material.css +73 -2
  103. package/styles/image-editor/material.scss +1 -1
  104. package/styles/image-editor/material3-dark.css +78 -4
  105. package/styles/image-editor/material3-dark.scss +1 -1
  106. package/styles/image-editor/material3.css +78 -4
  107. package/styles/image-editor/material3.scss +1 -1
  108. package/styles/image-editor/tailwind-dark.css +73 -2
  109. package/styles/image-editor/tailwind-dark.scss +1 -1
  110. package/styles/image-editor/tailwind.css +73 -2
  111. package/styles/image-editor/tailwind.scss +1 -1
  112. package/styles/material-dark.css +73 -2
  113. package/styles/material.css +73 -2
  114. package/styles/material3-dark.css +78 -4
  115. package/styles/material3-dark.scss +1 -1
  116. package/styles/material3.css +78 -4
  117. package/styles/material3.scss +1 -1
  118. package/styles/tailwind-dark.css +73 -2
  119. package/styles/tailwind.css +73 -2
@@ -19,10 +19,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
19
19
  };
20
20
  import { Component, NotifyPropertyChanges, Property, addClass, removeClass, extend, isBlazor } from '@syncfusion/ej2-base';
21
21
  import { Event, EventHandler, getComponent, isNullOrUndefined, getUniqueID } from '@syncfusion/ej2-base';
22
- import { createSpinner } from '@syncfusion/ej2-popups';
22
+ import { Dialog, createSpinner } from '@syncfusion/ej2-popups';
23
23
  import { Complex, Browser, ChildProperty, compile as templateCompiler, compile } from '@syncfusion/ej2-base';
24
- import { ToolbarModule, Crop, Draw, Filter, FreehandDrawing, Selection, Shape, Transform, UndoRedo, Export } from './../index';
24
+ import { ToolbarModule, Crop, Draw, Filter, FreehandDrawing, Selection, Shape, Transform, UndoRedo, Export, ShapeType } from './../index';
25
25
  import { ZoomTrigger, ImageFinetuneOption } from './../index';
26
+ import { Uploader } from '@syncfusion/ej2-inputs';
26
27
  /**
27
28
  * This interface is used to specify settings for finetuning operations on images, including brightness, contrast, hue, saturation, exposure, opacity, and blur. It includes properties for setting minimum and maximum values for each of these options, as well as a default value.
28
29
  */
@@ -158,7 +159,7 @@ var ImageEditor = /** @class */ (function (_super) {
158
159
  totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
159
160
  degree: 0, currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
160
161
  srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
161
- zoomFactor: 0, previousZoomValue: 0 };
162
+ zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none' };
162
163
  // Stored transformations performed after cropping
163
164
  /** @hidden */
164
165
  _this.afterCropActions = [];
@@ -190,6 +191,30 @@ var ImageEditor = /** @class */ (function (_super) {
190
191
  _this.isCropToolbar = false;
191
192
  /** @hidden */
192
193
  _this.cursor = 'default';
194
+ /** @hidden */
195
+ _this.resizeSrc = { startX: _this.img.srcLeft, startY: _this.img.srcTop, width: _this.img.srcWidth, height: _this.img.srcHeight };
196
+ /** @hidden */
197
+ _this.isResize = false;
198
+ /** @hidden */
199
+ _this.isAspectRatio = false;
200
+ /** @hidden */
201
+ _this.frameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
202
+ /** @hidden */
203
+ _this.tempFrameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
204
+ /** @hidden */
205
+ _this.allowDownScale = true;
206
+ /** @hidden */
207
+ _this.gradientColor = '';
208
+ /** @hidden */
209
+ _this.size = 20;
210
+ /** @hidden */
211
+ _this.inset = 0;
212
+ /** @hidden */
213
+ _this.offset = 0;
214
+ /** @hidden */
215
+ _this.borderRadius = 0;
216
+ /** @hidden */
217
+ _this.lineCount = 0;
193
218
  if (!isBlazor()) {
194
219
  ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
195
220
  ImageEditor_1.Inject(UndoRedo);
@@ -414,6 +439,11 @@ var ImageEditor = /** @class */ (function (_super) {
414
439
  this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
415
440
  }
416
441
  this.createCanvas();
442
+ if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
443
+ this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
444
+ this.element.querySelector('.e-ie-drop-content').style.display = 'block';
445
+ }
446
+ this.createDropUploader();
417
447
  if (this.showQuickAccessToolbar) {
418
448
  var canvasWrapper = document.querySelector('#' + this.element.id + '_canvasWrapper');
419
449
  canvasWrapper.appendChild(this.createElement('div', {
@@ -452,6 +482,56 @@ var ImageEditor = /** @class */ (function (_super) {
452
482
  }
453
483
  this.initializeZoomSettings();
454
484
  };
485
+ ImageEditor.prototype.createDropUploader = function () {
486
+ var _this = this;
487
+ var uploadObj = new Uploader({
488
+ dropArea: document.getElementsByClassName('e-canvas-wrapper')[0],
489
+ allowedExtensions: '.jpg, .jpeg, .png,.svg',
490
+ selected: function (args) {
491
+ if (args.event.type === 'change' || args.event.type === 'drop') {
492
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
493
+ var type = args.filesData[0].type;
494
+ if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg') {
495
+ _this.notify('draw', { prop: 'fileSelect', value: { inputElement: _this.element.querySelector('#' + _this.element.id + '_dropfileUpload'), args: args } });
496
+ }
497
+ else {
498
+ _this.showDialogPopup();
499
+ }
500
+ }
501
+ }
502
+ });
503
+ uploadObj.appendTo('#' + this.element.id + '_dropfileUpload');
504
+ };
505
+ ImageEditor.prototype.dlgCloseBtnClick = function () {
506
+ getComponent(document.getElementById(this.element.id + '_dialog'), 'dialog').destroy();
507
+ };
508
+ ImageEditor.prototype.showDialogPopup = function () {
509
+ this.element.querySelector('#' + this.element.id + '_dialog').style.display = 'block';
510
+ var headerObj = { key: 'AlertDialogHeader' };
511
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
512
+ var contentObj = { key: 'AlertDialogContent' };
513
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
514
+ var supportObj = { key: 'SupportText' };
515
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
516
+ var okObj = { key: 'OK' };
517
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: okObj } });
518
+ var dialog = new Dialog({
519
+ header: headerObj['value'],
520
+ closeOnEscape: true,
521
+ content: '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, and SVG</b></span>',
522
+ target: document.getElementById('target'),
523
+ width: '285px',
524
+ isModal: true,
525
+ animationSettings: { effect: 'Zoom' },
526
+ close: this.dlgCloseBtnClick.bind(this),
527
+ buttons: [
528
+ { click: this.dlgCloseBtnClick.bind(this),
529
+ buttonModel: { content: okObj['value'], iconCss: 'e-icons e-close' }
530
+ }
531
+ ]
532
+ });
533
+ dialog.appendTo('#' + this.element.id + '_dialog');
534
+ };
455
535
  /**
456
536
  *
457
537
  * This Method will add events to component (element, event, method, current reference)
@@ -508,6 +588,7 @@ var ImageEditor = /** @class */ (function (_super) {
508
588
  this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
509
589
  };
510
590
  ImageEditor.prototype.createCanvas = function () {
591
+ var _this = this;
511
592
  this.element.style.boxSizing = 'border-box';
512
593
  var obj = { toolbarHeight: 0 };
513
594
  this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
@@ -519,6 +600,40 @@ var ImageEditor = /** @class */ (function (_super) {
519
600
  (this.element.offsetWidth - 2)
520
601
  + 'px; position: relative; overflow: hidden; margin: 0 auto;' }
521
602
  }));
603
+ var dragObj = { key: 'DragText' };
604
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: dragObj } });
605
+ var dropObj = { key: 'DropText' };
606
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: dropObj } });
607
+ var browseObj = { key: 'BrowseText' };
608
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: browseObj } });
609
+ var supportObj = { key: 'SupportText' };
610
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
611
+ var dropAreaElement = this.createElement('div', { id: this.element.id + '_dropArea', className: 'e-ie-drop-area', attrs: { style: 'position: relative;' } });
612
+ var dropIconElement = this.createElement('span', { className: 'e-ie-drop-icon e-icons e-image', attrs: { style: 'position: absolute;' } });
613
+ var dropContentElement = this.createElement('span', { className: 'e-ie-drop-content', attrs: { style: 'position: absolute; display: none;' } });
614
+ dropContentElement.textContent = dragObj['value'] + ' ';
615
+ var minDropContentElem = this.createElement('span', { className: 'e-ie-min-drop-content', attrs: { style: 'position: absolute;' } });
616
+ minDropContentElem.textContent = dropObj['value'] + ' ';
617
+ var dropAnchorElement = this.createElement('a', { id: this.element.id + '_dropBrowse', className: 'e-ie-drop-browse' });
618
+ dropAnchorElement.textContent = browseObj['value'];
619
+ var minDropAnchorElem = this.createElement('a', { id: this.element.id + '_dropBrowse', className: 'e-ie-drop-browse' });
620
+ minDropAnchorElem.textContent = browseObj['value'];
621
+ dropContentElement.appendChild(dropAnchorElement);
622
+ minDropContentElem.appendChild(minDropAnchorElem);
623
+ dropAnchorElement.href = '';
624
+ minDropAnchorElem.href = '';
625
+ var dropInfoElement = this.createElement('span', { className: 'e-ie-drop-info', attrs: { position: 'absolute' } });
626
+ dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, and JPG';
627
+ var dropUploader = dropAreaElement.appendChild(this.createElement('input', {
628
+ id: this.element.id + '_dropfileUpload', className: 'e-fileUpload e-image-upload'
629
+ }));
630
+ dropUploader.setAttribute('type', 'file');
631
+ dropUploader.setAttribute('accept', 'image/*');
632
+ dropAreaElement.appendChild(dropIconElement);
633
+ dropAreaElement.appendChild(dropContentElement);
634
+ dropAreaElement.appendChild(minDropContentElem);
635
+ dropAreaElement.appendChild(dropInfoElement);
636
+ canvasWrapper.appendChild(dropAreaElement);
522
637
  this.lowerCanvas = canvasWrapper.appendChild(this.createElement('canvas', {
523
638
  id: this.element.id + '_lowerCanvas', attrs: { name: 'canvasImage' }
524
639
  }));
@@ -528,6 +643,9 @@ var ImageEditor = /** @class */ (function (_super) {
528
643
  this.inMemoryCanvas = this.createElement('canvas', {
529
644
  id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
530
645
  });
646
+ this.baseImgCanvas = this.createElement('canvas', {
647
+ id: this.element.id + '_baseImgCanvas', attrs: { name: 'canvasImage' }
648
+ });
531
649
  this.textArea = canvasWrapper.appendChild(this.createElement('textarea', {
532
650
  id: this.element.id + '_textArea', className: 'e-textarea', attrs: { name: 'textArea' }
533
651
  }));
@@ -535,6 +653,12 @@ var ImageEditor = /** @class */ (function (_super) {
535
653
  id: this.element.id + '_dialog', className: 'e-dialog'
536
654
  }));
537
655
  dialog.style.display = 'none';
656
+ var uploader = this.element.appendChild(this.createElement('input', {
657
+ id: this.element.id + '_fileUpload', className: 'e-fileUpload'
658
+ }));
659
+ uploader.setAttribute('type', 'file');
660
+ uploader.setAttribute('accept', 'image/*');
661
+ uploader.style.display = 'none';
538
662
  this.textArea.setAttribute('spellcheck', 'false');
539
663
  this.textArea.style.lineHeight = 'normal';
540
664
  this.lowerCanvas.style.width = this.upperCanvas.style.width = this.inMemoryCanvas.style.width = '100%';
@@ -550,17 +674,27 @@ var ImageEditor = /** @class */ (function (_super) {
550
674
  this.upperCanvas.style.cursor = this.cursor = 'default';
551
675
  this.upperCanvas.style.display = 'block';
552
676
  this.upperContext = this.upperCanvas.getContext('2d');
677
+ document.getElementById(this.element.id + '_dropBrowse').onclick = function () {
678
+ _this.element.querySelector('#' + _this.element.id + '_dropfileUpload').click();
679
+ return false;
680
+ };
553
681
  };
554
682
  ImageEditor.prototype.touchStartHandler = function (e) {
555
683
  this.notify('selection', { prop: 'touchStartHandler', onPropertyChange: false, value: { e: e } });
556
684
  };
557
685
  ImageEditor.prototype.mouseDownEventHandler = function (e) {
686
+ if (e.target.className === 'e-ie-drop-browse') {
687
+ return;
688
+ }
558
689
  this.notify('selection', { prop: 'mouseDownEventHandler', onPropertyChange: false, value: { e: e } });
559
690
  };
560
691
  ImageEditor.prototype.mouseMoveEventHandler = function (e) {
561
692
  this.notify('selection', { prop: 'mouseMoveEventHandler', onPropertyChange: false, value: { e: e } });
562
693
  };
563
694
  ImageEditor.prototype.mouseUpEventHandler = function (e) {
695
+ if (e.target.className === 'e-ie-drop-browse') {
696
+ return;
697
+ }
564
698
  this.notify('selection', { prop: 'mouseUpEventHandler', onPropertyChange: false, value: { e: e } });
565
699
  };
566
700
  ImageEditor.prototype.keyDownEventHandler = function (e) {
@@ -573,12 +707,18 @@ var ImageEditor = /** @class */ (function (_super) {
573
707
  }
574
708
  };
575
709
  ImageEditor.prototype.canvasMouseDownHandler = function (e) {
710
+ if (e.target.className === 'e-ie-drop-browse') {
711
+ return;
712
+ }
576
713
  this.notify('selection', { prop: 'canvasMouseDownHandler', onPropertyChange: false, value: { e: e } });
577
714
  };
578
715
  ImageEditor.prototype.canvasMouseMoveHandler = function (e) {
579
716
  this.notify('selection', { prop: 'canvasMouseMoveHandler', onPropertyChange: false, value: { e: e } });
580
717
  };
581
718
  ImageEditor.prototype.canvasMouseUpHandler = function (e) {
719
+ if (e.target.className === 'e-ie-drop-browse') {
720
+ return;
721
+ }
582
722
  this.notify('selection', { prop: 'canvasMouseUpHandler', onPropertyChange: false, value: { e: e } });
583
723
  };
584
724
  ImageEditor.prototype.handleScroll = function (e) {
@@ -643,7 +783,7 @@ var ImageEditor = /** @class */ (function (_super) {
643
783
  * A horizontal direction for horizontal flipping and vertical direction for vertical flipping.
644
784
  *
645
785
  * @remarks
646
- * It flips the shapes including rectangle, circle, line, text, and freehand drawings.
786
+ * It flips the shapes including rectangle, circle, line, text, image, and freehand drawings.
647
787
  *
648
788
  * @returns {void}.
649
789
  *
@@ -677,6 +817,7 @@ var ImageEditor = /** @class */ (function (_super) {
677
817
  * @returns {void}.
678
818
  */
679
819
  ImageEditor.prototype.open = function (data) {
820
+ document.getElementById(this.element.id + '_dropArea').style.display = 'none';
680
821
  this.notify('draw', { prop: 'open', value: { data: data } });
681
822
  };
682
823
  /**
@@ -703,14 +844,17 @@ var ImageEditor = /** @class */ (function (_super) {
703
844
  this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
704
845
  }
705
846
  }
847
+ var isImageLoaded = this.isImageLoaded;
706
848
  this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = false;
707
849
  this.isCircleCrop = this.isCropTab = false;
708
850
  this.objColl = [];
709
851
  this.transform.degree = 0;
710
852
  this.upperCanvas.style.display = 'block';
711
853
  this.transform.currFlipState = '';
854
+ this.allowDownScale = true;
712
855
  this.upperCanvas.style.cursor = this.cursor = this.lowerCanvas.style.cursor = 'default';
713
856
  this.lowerContext.lineWidth = this.upperContext.lineWidth = undefined;
857
+ this.frameDestPoints = null;
714
858
  this.textArea.value = this.textArea.textContent = '';
715
859
  this.textArea.style.display = 'none';
716
860
  this.lowerContext.filter = this.canvasFilter = this.getDefaultFilter();
@@ -730,16 +874,20 @@ var ImageEditor = /** @class */ (function (_super) {
730
874
  this.lowerCanvas.style.maxHeight = this.upperCanvas.style.maxHeight = '';
731
875
  this.transform.defaultZoomFactor = this.transform.zoomFactor = 0;
732
876
  this.transform.cropZoomFactor = null;
877
+ this.frameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
878
+ this.tempFrameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
733
879
  this.currObjType = { shape: '', isDragging: false, isActiveObj: false, isText: false, isInitialText: false, isLine: false,
734
880
  isInitialLine: false, isCustomCrop: false, isZoomed: false, isUndoZoom: false,
735
881
  isUndoAction: false, isFiltered: false, isSave: false, isResize: false };
736
882
  this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
737
883
  totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
738
884
  rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
739
- destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
740
- srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false };
885
+ destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
886
+ srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
887
+ aspectWidth: null, aspectHeight: null };
741
888
  this.afterCropActions = [];
742
889
  this.currentFilter = '';
890
+ this.tempFrameZoomLevel = null;
743
891
  var obj_1 = { initialZoomValue: false };
744
892
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
745
893
  if (obj_1['initialZoomValue']) {
@@ -752,7 +900,7 @@ var ImageEditor = /** @class */ (function (_super) {
752
900
  this.notify('filter', { prop: 'update-finetunes' });
753
901
  this.isImageLoaded = false;
754
902
  this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
755
- this.isImageLoaded = true;
903
+ this.isImageLoaded = isImageLoaded;
756
904
  if (!isBlazor()) {
757
905
  if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
758
906
  this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
@@ -771,7 +919,7 @@ var ImageEditor = /** @class */ (function (_super) {
771
919
  * A positive integer value for clockwise and negative integer value for anti-clockwise rotation.
772
920
  *
773
921
  * @remarks
774
- * It rotated the shapes including rectangle, circle, line, text, and freehand drawings.
922
+ * It rotated the shapes including rectangle, circle, line, text, image, and freehand drawings.
775
923
  *
776
924
  * @returns {boolean}.
777
925
  *
@@ -884,16 +1032,17 @@ var ImageEditor = /** @class */ (function (_super) {
884
1032
  * @param {number} strokeWidth - Specifies the stroke width of ellipse.
885
1033
  * @param {string} strokeColor - Specifies the stroke color of ellipse.
886
1034
  * @param {string} fillColor - Specifies the fill color of the ellipse.
1035
+ * @param {number} degree - Specifies the degree to rotate the ellipse.
887
1036
  * @returns {boolean}.
888
1037
  *
889
1038
  */
890
- ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
1039
+ ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
891
1040
  var isEllipse = false;
892
1041
  var isPointsInRange = this.allowShape(x, y);
893
1042
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
894
1043
  isEllipse = true;
895
1044
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
896
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
1045
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
897
1046
  }
898
1047
  return isEllipse;
899
1048
  };
@@ -979,15 +1128,16 @@ var ImageEditor = /** @class */ (function (_super) {
979
1128
  * @param {number} strokeWidth - Specifies the stroke width of rectangle.
980
1129
  * @param {string} strokeColor - Specifies the stroke color of rectangle.
981
1130
  * @param {string} fillColor - Specifies the fill color of the rectangle.
1131
+ * @param {number} degree - Specifies the degree to rotate the rectangle.
982
1132
  * @returns {boolean}.
983
1133
  */
984
- ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
1134
+ ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
985
1135
  var isRectangle = false;
986
1136
  var isPointsInRange = this.allowShape(x, y);
987
1137
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
988
1138
  isRectangle = true;
989
1139
  this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
990
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
1140
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
991
1141
  }
992
1142
  return isRectangle;
993
1143
  };
@@ -1017,6 +1167,33 @@ var ImageEditor = /** @class */ (function (_super) {
1017
1167
  }
1018
1168
  return isText;
1019
1169
  };
1170
+ /**
1171
+ * Draw an image as annotation on an image.
1172
+ *
1173
+ *
1174
+ * @param {string | ImageData} data - Specifies url of the image or image data.
1175
+ * @param {number} x - Specifies x-coordinate of a starting point for an image.
1176
+ * @param {number} y - Specifies y-coordinate of a starting point for an image.
1177
+ * @param {number} width - Specifies the width of the image.
1178
+ * @param {number} height - Specifies the height of the image.
1179
+ * @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
1180
+ * @param {number} degree - Specifies the degree to rotate the image.
1181
+ * @returns {boolean}.
1182
+ *
1183
+ */
1184
+ ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree) {
1185
+ var isImage = false;
1186
+ var isPointsInRange = this.allowShape(x, y);
1187
+ if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
1188
+ var length_1 = this.objColl.length;
1189
+ this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
1190
+ src: data, degree: degree, isAspectRatio: isAspectRatio } });
1191
+ if (this.objColl.length > length_1) {
1192
+ isImage = true;
1193
+ }
1194
+ }
1195
+ return isImage;
1196
+ };
1020
1197
  /**
1021
1198
  * Select a shape based on the given shape id.
1022
1199
  * Use 'getShapeSettings' method to get the shape id which is then passed to perform selection.
@@ -1142,6 +1319,113 @@ var ImageEditor = /** @class */ (function (_super) {
1142
1319
  ImageEditor.prototype.getImageDimension = function () {
1143
1320
  return { x: this.img.destLeft, y: this.img.destTop, width: this.img.destWidth, height: this.img.destHeight };
1144
1321
  };
1322
+ /**
1323
+ * Resize an image by changing its width and height.
1324
+ *
1325
+ * @param {number} width - Specifies the width of an image.
1326
+ * @param {number} height - Specifies the height of an image.
1327
+ * @param {boolean} isAspectRatio - Specifies whether the scaling option is enabled or not.
1328
+ *
1329
+ * @returns {boolean} - A boolean value indicating the success of the resizing operation.
1330
+ */
1331
+ ImageEditor.prototype.resize = function (width, height, isAspectRatio) {
1332
+ var isResized = false;
1333
+ if ((width.toString()).length <= 4 && (height.toString()).length <= 4) {
1334
+ var destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
1335
+ height: this.img.destHeight };
1336
+ if (isBlazor()) {
1337
+ this.updateToolbar(this.element, 'resize');
1338
+ }
1339
+ else {
1340
+ if (isAspectRatio) {
1341
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1342
+ isApplyBtn: false, isCropping: false } });
1343
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1344
+ isApplyBtn: false, isCropping: false } });
1345
+ }
1346
+ else {
1347
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
1348
+ isApplyBtn: false, isCropping: false } });
1349
+ }
1350
+ var aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
1351
+ var aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
1352
+ if (aspectRatioWidth && aspectRatioHeight) {
1353
+ getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
1354
+ aspectRatioWidth.value = Math.floor(width).toString() + ' px';
1355
+ getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
1356
+ aspectRatioHeight.value = Math.floor(height).toString() + ' px';
1357
+ }
1358
+ }
1359
+ this.notify('transform', { prop: 'resize', value: { width: width, height: height, isAspectRatio: isAspectRatio } });
1360
+ if (destPoints.startX !== this.img.destLeft || destPoints.startY !== this.img.destTop ||
1361
+ destPoints.width !== this.img.destWidth || destPoints.height !== this.img.destHeight) {
1362
+ isResized = true;
1363
+ this.okBtn();
1364
+ }
1365
+ else {
1366
+ this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
1367
+ }
1368
+ }
1369
+ return isResized;
1370
+ };
1371
+ /**
1372
+ * Draw a frame on an image.
1373
+ *
1374
+ * @param { FrameType} frameType - Specifies the frame option to be drawn on an image.
1375
+ * @param {string} color - Specifies the color of a frame on an image. The default value is ‘#fff’.
1376
+ * @param {string} gradientColor - Specifies the gradient color of a frame on an image. The default value is ‘’.
1377
+ * @param {number} size - Specifies the size of the frame as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 20 if not specified.
1378
+ * @param {number} inset - Specifies the inset value for line, hook, and inset type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.
1379
+ * @param {number} offset - Specifies the offset value for line and inset type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.
1380
+ * @param {number} borderRadius - Specifies the border radius for line-type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.
1381
+ * @param {FrameLineStyle} frameLineStyle - Specifies the type of line to be drawn for line-type frames. Default to Solid if not specified.
1382
+ * @param {number} lineCount - Specifies the number of lines for line-type frames. Defaults to 0 if not specified.
1383
+ *
1384
+ * @returns {boolean}.
1385
+ */
1386
+ ImageEditor.prototype.drawFrame = function (frameType, color, gradientColor, size, inset, offset, borderRadius, frameLineStyle, lineCount) {
1387
+ var isFrame = false;
1388
+ var obj = { frameChangeEventArgs: null };
1389
+ var prevFrameSettings = { type: this.toPascalCase(this.frameObj.type), color: this.frameObj.color,
1390
+ gradientColor: this.frameObj.gradientColor, size: this.frameObj.size, inset: this.frameObj.inset,
1391
+ offset: this.frameObj.offset, borderRadius: this.frameObj.radius, frameLineStyle: this.toPascalCase(this.frameObj.border),
1392
+ lineCount: this.frameObj.amount };
1393
+ extend(this.tempFrameObj, this.frameObj);
1394
+ this.tempFrameZoomLevel = this.transform.zoomFactor;
1395
+ this.frameDestPoints = extend({}, this.img, {}, true);
1396
+ if (!isBlazor()) {
1397
+ this.notify('toolbar', { prop: 'frameToolbarClick' });
1398
+ }
1399
+ else {
1400
+ this.performFrameClick();
1401
+ }
1402
+ this.frameObj.type = frameType.toLowerCase();
1403
+ this.frameObj.color = color;
1404
+ this.frameObj.gradientColor = gradientColor;
1405
+ this.frameObj.size = size;
1406
+ this.frameObj.inset = inset;
1407
+ this.frameObj.offset = offset;
1408
+ this.frameObj.radius = borderRadius;
1409
+ this.frameObj.border = frameLineStyle.toLowerCase();
1410
+ this.frameObj.amount = lineCount;
1411
+ this.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: prevFrameSettings, obj: obj } });
1412
+ if (obj['frameChangeEventArgs'] && !obj['frameChangeEventArgs'].cancel) {
1413
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
1414
+ if (JSON.stringify(this.frameObj) !== JSON.stringify(this.tempFrameObj)) {
1415
+ isFrame = true;
1416
+ this.okBtn();
1417
+ }
1418
+ else {
1419
+ this.tempFrameZoomLevel = null;
1420
+ }
1421
+ }
1422
+ else {
1423
+ this.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
1424
+ extend(this.frameObj, this.tempFrameObj);
1425
+ this.tempFrameZoomLevel = null;
1426
+ }
1427
+ return isFrame;
1428
+ };
1145
1429
  // Toolbar related codes
1146
1430
  ImageEditor.prototype.toolbarTemplateFn = function () {
1147
1431
  var template;
@@ -1225,6 +1509,33 @@ var ImageEditor = /** @class */ (function (_super) {
1225
1509
  this.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
1226
1510
  this.notify('freehand-draw', { prop: 'color-change', value: { color: obj['tempFreeHandDrawEditingStyles'].strokeColor } });
1227
1511
  };
1512
+ ImageEditor.prototype.updateImageTransformColl = function (type) {
1513
+ var value;
1514
+ if (type === 'rotateleft') {
1515
+ value = -90;
1516
+ }
1517
+ else if (type === 'rotateright') {
1518
+ value = 90;
1519
+ }
1520
+ else if (type === 'horizontalflip') {
1521
+ value = 'horizontal';
1522
+ }
1523
+ else if (type === 'verticalflip') {
1524
+ value = 'vertical';
1525
+ }
1526
+ for (var i = 0; i < this.objColl.length; i++) {
1527
+ if (this.objColl[i].shape === 'image') {
1528
+ if (isNullOrUndefined(this.objColl[i].rotateFlipColl)) {
1529
+ this.objColl[i].rotateFlipColl = [];
1530
+ }
1531
+ this.objColl[i].rotateFlipColl.push(value);
1532
+ var obj = { collection: this.objColl[i].rotateFlipColl };
1533
+ this.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
1534
+ value: { collection: this.objColl[i].rotateFlipColl, isRotateFlipCollection: false, obj: obj } });
1535
+ this.objColl[i].rotateFlipColl = obj['collection'];
1536
+ }
1537
+ }
1538
+ };
1228
1539
  ImageEditor.prototype.setInitialZoomState = function () {
1229
1540
  this.objColl.push(this.activeObj);
1230
1541
  this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -1233,11 +1544,11 @@ var ImageEditor = /** @class */ (function (_super) {
1233
1544
  this.isUndoRedo = true;
1234
1545
  if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
1235
1546
  this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1236
- value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null } });
1547
+ value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null, isResize: null } });
1237
1548
  }
1238
1549
  else {
1239
1550
  this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1240
- value: { zoomFactor: Math.abs(this.transform.cropZoomFactor), zoomPoint: null } });
1551
+ value: { zoomFactor: Math.abs(this.transform.cropZoomFactor), zoomPoint: null, isResize: null } });
1241
1552
  }
1242
1553
  this.isUndoRedo = isUndoRedo;
1243
1554
  this.panPoint.totalPannedPoint = { x: 0, y: 0 };
@@ -1327,8 +1638,15 @@ var ImageEditor = /** @class */ (function (_super) {
1327
1638
  * @returns {void}.
1328
1639
  */
1329
1640
  ImageEditor.prototype.okBtn = function (isMouseDown) {
1641
+ if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1642
+ this.element.querySelector('.e-contextual-toolbar-wrapper').classList.remove('e-frame-wrapper');
1643
+ }
1330
1644
  var isCropSelection = false;
1331
1645
  var splitWords;
1646
+ var aspectIcon = this.element.querySelector('#' + this.element.id + '_aspectratio');
1647
+ var nonAspectIcon = this.element.querySelector('#' + this.element.id + '_nonaspectratio');
1648
+ var blrAspRatElem = this.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
1649
+ var blrNAspRatElem = this.element.querySelector('.e-ie-toolbar-nonaspect-ratio-btn');
1332
1650
  if (this.activeObj.shape !== undefined) {
1333
1651
  splitWords = this.activeObj.shape.split('-');
1334
1652
  }
@@ -1338,9 +1656,64 @@ var ImageEditor = /** @class */ (function (_super) {
1338
1656
  else if (splitWords !== undefined && splitWords[0] === 'crop') {
1339
1657
  isCropSelection = true;
1340
1658
  }
1659
+ this.allowDownScale = true;
1660
+ if ((this.activeObj.shape && this.activeObj.shape !== 'image' || this.togglePen) && !isCropSelection) {
1661
+ var objt = { shapeSettingsObj: {} };
1662
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
1663
+ var shapeSettings = objt['shapeSettingsObj'];
1664
+ if (this.togglePen) {
1665
+ shapeSettings.type = ShapeType.FreehandDraw;
1666
+ }
1667
+ var shapeChangedArgs = { action: 'apply', previousShapeSettings: extend({}, shapeSettings, {}, true),
1668
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
1669
+ this.triggerShapeChanged(shapeChangedArgs);
1670
+ }
1671
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1672
+ if (aspectIcon || nonAspectIcon || (isBlazor() && this.currentToolbar === 'resize-toolbar')) {
1673
+ var obj_2 = { width: null, height: null };
1674
+ this.notify('selection', { prop: 'getNumTextValue', onPropertyChange: false, value: { obj: obj_2 } });
1675
+ var point = { x: obj_2['width'], y: obj_2['height'] };
1676
+ var obj1 = { prevCropObj: this.prevCropObj };
1677
+ var obj2 = { prevObj: this.prevObj };
1678
+ if (point && point.x && point.y && obj1['prevCropObj'] && obj2['prevObj']) {
1679
+ if (nonAspectIcon || (blrNAspRatElem && !blrNAspRatElem.classList.contains('e-hidden'))) {
1680
+ this.notify('transform', { prop: 'resize', value: { width: point.x, height: point.y, isAspectRatio: false } });
1681
+ }
1682
+ else if (aspectIcon || (blrAspRatElem && !blrAspRatElem.classList.contains('e-hidden'))) {
1683
+ this.notify('transform', { prop: 'resize', value: { width: point.x, height: null, isAspectRatio: true } });
1684
+ }
1685
+ this.isResize = false;
1686
+ this.aspectWidth = point.x;
1687
+ this.aspectHeight = point.y;
1688
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
1689
+ isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
1690
+ this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1691
+ value: { zoomFactor: -this.transform.zoomFactor, zoomPoint: null, isResize: true } });
1692
+ this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
1693
+ value: { zoomFactor: obj2['prevObj']['defaultZoom'], zoomPoint: null, isResize: true } });
1694
+ if (obj2['prevObj'].zoomFactor) {
1695
+ this.setProperties({ zoomSettings: { zoomFactor: obj2['prevObj'].zoomFactor } }, true);
1696
+ }
1697
+ this.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
1698
+ value: { previousZoomValue: this.zoomSettings.zoomFactor } });
1699
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: { operation: 'resize',
1700
+ previousObj: obj2['prevObj'], previousObjColl: obj2['prevObj']['objColl'],
1701
+ previousPointColl: obj2['prevObj']['pointColl'], previousSelPointColl: obj2['prevObj']['selPointColl'],
1702
+ previousCropObj: obj1['prevCropObj'], previousText: null, currentText: null, previousFilter: null,
1703
+ isCircleCrop: null } });
1704
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1705
+ }
1706
+ else {
1707
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
1708
+ isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
1709
+ }
1710
+ this.isAspectRatio = false;
1711
+ }
1341
1712
  var selElem = this.element.querySelector('.e-contextual-toolbar-wrapper .e-toolbar-item.e-selected');
1342
1713
  var obj = { bool: false };
1343
1714
  this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
1715
+ var frameObject = { bool: null };
1716
+ this.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObject } });
1344
1717
  if (selElem) {
1345
1718
  this.currentFilter = selElem.children[0].children[0].id.replace('Canvas', '');
1346
1719
  }
@@ -1358,15 +1731,20 @@ var ImageEditor = /** @class */ (function (_super) {
1358
1731
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1359
1732
  }
1360
1733
  }
1361
- else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
1734
+ else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) ||
1735
+ (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
1362
1736
  this.currObjType.isFiltered) {
1363
1737
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
1364
1738
  this.currObjType.isFiltered = false;
1365
- var obj_2 = { value: null };
1366
- this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_2 } });
1367
- if (obj_2['value'] !== this.lowerContext.filter) {
1739
+ var obj_3 = { value: null };
1740
+ this.notify('draw', { prop: 'getTempAdjustmentValue', value: { obj: obj_3 } });
1741
+ if (obj_3['value'] !== this.lowerContext.filter) {
1368
1742
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1369
1743
  }
1744
+ if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
1745
+ (this.activeObj.shape === 'path' && this.activeObj.pointColl.length > 0)) {
1746
+ this.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isMouseDown } });
1747
+ }
1370
1748
  }
1371
1749
  else if (obj['bool']) {
1372
1750
  this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
@@ -1381,12 +1759,35 @@ var ImageEditor = /** @class */ (function (_super) {
1381
1759
  }
1382
1760
  else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
1383
1761
  (this.activeObj.shape === 'path' && this.activeObj.pointColl.length > 0)) {
1762
+ if (this.activeObj.shape === 'image') {
1763
+ this.notify('draw', { prop: 'setImageApply', onPropertyChange: false, value: { bool: true } });
1764
+ }
1384
1765
  this.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isMouseDown } });
1385
1766
  }
1767
+ else {
1768
+ if (JSON.stringify(this.frameObj) !== JSON.stringify(this.tempFrameObj)) {
1769
+ var object = { currObj: {} };
1770
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1771
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
1772
+ operation: 'frame', previousObj: object['currObj'], previousObjColl: object['currObj']['objColl'],
1773
+ previousPointColl: object['currObj']['pointColl'], previousSelPointColl: object['currObj']['selPointColl'],
1774
+ previousCropObj: extend({}, this.cropObj, {}, true), previousText: null, currentText: null,
1775
+ previousFilter: null, isCircleCrop: null
1776
+ } });
1777
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
1778
+ this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
1779
+ this.tempFrameObj = extend({}, this.frameObj, {}, true);
1780
+ this.notify('draw', { prop: 'setTempFrame', onPropertyChange: false, value: { frame: this.frameObj.type } });
1781
+ }
1782
+ this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false });
1783
+ }
1386
1784
  if (!isBlazor() && !obj['isCropToolbar']) {
1387
1785
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
1388
1786
  isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
1389
1787
  }
1788
+ else if (isBlazor() && !obj['isCropToolbar'] && (this.currentToolbar == 'resize-toolbar' || this.currentToolbar == 'frame-toolbar')) {
1789
+ this.updateToolbar(this.element, 'imageLoaded');
1790
+ }
1390
1791
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
1391
1792
  this.isCropTab = false;
1392
1793
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
@@ -1432,6 +1833,8 @@ var ImageEditor = /** @class */ (function (_super) {
1432
1833
  * An ImageData returns the current canvas image data object.
1433
1834
  */
1434
1835
  ImageEditor.prototype.getCurrentCanvasData = function () {
1836
+ var tempFrame = extend({}, this.frameObj, {}, true);
1837
+ this.frameObj = { type: 'none', color: '#fff', size: 20, inset: 20, offset: 20, radius: 0, amount: 1, border: 'solid', gradientColor: '' };
1435
1838
  var tempFilter = this.lowerContext.filter;
1436
1839
  this.lowerContext.filter = this.canvasFilter = 'none';
1437
1840
  var objColl = extend([], this.objColl, null, true);
@@ -1440,7 +1843,17 @@ var ImageEditor = /** @class */ (function (_super) {
1440
1843
  this.pointColl = [];
1441
1844
  this.freehandCounter = 0;
1442
1845
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
1846
+ if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1847
+ this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
1848
+ }
1443
1849
  var data = this.getImageData();
1850
+ if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
1851
+ this.element.querySelector('.e-contextual-toolbar-wrapper').classList.remove('e-hide');
1852
+ if (isBlazor()) {
1853
+ this.element.querySelector('.e-ie-toolbar-check-btn').classList.remove('e-hidden');
1854
+ this.element.querySelector('.e-ie-toolbar-close-btn').classList.remove('e-hidden');
1855
+ }
1856
+ }
1444
1857
  if (!isBlazor()) {
1445
1858
  if (!Browser.isDevice) {
1446
1859
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
@@ -1453,6 +1866,7 @@ var ImageEditor = /** @class */ (function (_super) {
1453
1866
  this.freehandCounter = pointColl.length;
1454
1867
  this.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
1455
1868
  this.lowerContext.filter = this.canvasFilter = tempFilter;
1869
+ this.frameObj = tempFrame;
1456
1870
  return data;
1457
1871
  };
1458
1872
  /**
@@ -1550,6 +1964,9 @@ var ImageEditor = /** @class */ (function (_super) {
1550
1964
  this.notify('shape', { prop: 'pushActItemIntoObj' });
1551
1965
  var prevCropObj = extend({}, this.cropObj, {}, true);
1552
1966
  var object = { currObj: {} };
1967
+ var objt = { shapeSettingsObj: {} };
1968
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
1969
+ var shapeSettings = objt['shapeSettingsObj'];
1553
1970
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1554
1971
  var prevObj = object['currObj'];
1555
1972
  prevObj.objColl = extend([], this.objColl, [], true);
@@ -1586,6 +2003,9 @@ var ImageEditor = /** @class */ (function (_super) {
1586
2003
  }
1587
2004
  }
1588
2005
  }
2006
+ var shapeChangedArgs = { action: type, previousShapeSettings: extend({}, shapeSettings, {}, true),
2007
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2008
+ this.triggerShapeChanged(shapeChangedArgs);
1589
2009
  };
1590
2010
  /**
1591
2011
  * Apply Font style for text.
@@ -1599,6 +2019,9 @@ var ImageEditor = /** @class */ (function (_super) {
1599
2019
  this.notify('shape', { prop: 'pushActItemIntoObj' });
1600
2020
  var objColl = extend([], this.objColl, [], true);
1601
2021
  var prevCropObj = extend({}, this.cropObj, {}, true);
2022
+ var objt = { shapeSettingsObj: {} };
2023
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
2024
+ var shapeSettings = objt['shapeSettingsObj'];
1602
2025
  var object = { currObj: {} };
1603
2026
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1604
2027
  var prevObj = object['currObj'];
@@ -1647,6 +2070,10 @@ var ImageEditor = /** @class */ (function (_super) {
1647
2070
  currentText: null, previousFilter: null, isCircleCrop: null } });
1648
2071
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
1649
2072
  }
2073
+ var shapeChangedArgs = { action: 'font-family', previousShapeSettings: extend({}, shapeSettings, {}, true),
2074
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2075
+ shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
2076
+ this.triggerShapeChanged(shapeChangedArgs);
1650
2077
  };
1651
2078
  /**
1652
2079
  * Apply Font size for text.
@@ -1660,6 +2087,9 @@ var ImageEditor = /** @class */ (function (_super) {
1660
2087
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
1661
2088
  this.notify('shape', { prop: 'pushActItemIntoObj' });
1662
2089
  var prevCropObj = extend({}, this.cropObj, {}, true);
2090
+ var objt = { shapeSettingsObj: {} };
2091
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
2092
+ var shapeSettings = objt['shapeSettingsObj'];
1663
2093
  var object = { currObj: {} };
1664
2094
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1665
2095
  var prevObj = object['currObj'];
@@ -1739,6 +2169,10 @@ var ImageEditor = /** @class */ (function (_super) {
1739
2169
  currentText: null, previousFilter: null, isCircleCrop: null } });
1740
2170
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
1741
2171
  }
2172
+ var shapeChangedArgs = { action: 'font-size', previousShapeSettings: extend({}, shapeSettings, {}, true),
2173
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2174
+ shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
2175
+ this.triggerShapeChanged(shapeChangedArgs);
1742
2176
  };
1743
2177
  /**
1744
2178
  * Apply Font color for text.
@@ -1751,6 +2185,9 @@ var ImageEditor = /** @class */ (function (_super) {
1751
2185
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
1752
2186
  this.notify('shape', { prop: 'pushActItemIntoObj' });
1753
2187
  var prevCropObj = extend({}, this.cropObj, {}, true);
2188
+ var objt = { shapeSettingsObj: {} };
2189
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
2190
+ var shapeSettings = objt['shapeSettingsObj'];
1754
2191
  var object = { currObj: {} };
1755
2192
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1756
2193
  var prevObj = object['currObj'];
@@ -1798,6 +2235,10 @@ var ImageEditor = /** @class */ (function (_super) {
1798
2235
  currentText: null, previousFilter: null, isCircleCrop: null } });
1799
2236
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
1800
2237
  }
2238
+ var shapeChangedArgs = { action: 'font-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2239
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2240
+ shapeChangedArgs.currentShapeSettings.fillColor = value;
2241
+ this.triggerShapeChanged(shapeChangedArgs);
1801
2242
  };
1802
2243
  /**
1803
2244
  * Apply Pen stroke width.
@@ -1811,6 +2252,9 @@ var ImageEditor = /** @class */ (function (_super) {
1811
2252
  var temp = extend([], this.pointColl, [], true);
1812
2253
  this.updateFreehandDrawColorChange();
1813
2254
  var prevCropObj = extend({}, this.cropObj, {}, true);
2255
+ var objt = { shapeSettingsObj: {} };
2256
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
2257
+ var shapeSettings = objt['shapeSettingsObj'];
1814
2258
  var object = { currObj: {} };
1815
2259
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1816
2260
  var prevObj = object['currObj'];
@@ -1827,20 +2271,25 @@ var ImageEditor = /** @class */ (function (_super) {
1827
2271
  var obj = { bool: false };
1828
2272
  this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
1829
2273
  if (obj['bool']) {
1830
- var obj_3 = { penStrokeWidth: null };
1831
- this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: obj_3 } });
2274
+ var obj_4 = { penStrokeWidth: null };
2275
+ this.notify('freehand-draw', { prop: 'getPenStrokeWidth', onPropertyChange: false, value: { obj: obj_4 } });
1832
2276
  this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
1833
2277
  this.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
1834
- value: { strokeColor: null, strokeWidth: obj_3['penStrokeWidth'] } });
2278
+ value: { strokeColor: null, strokeWidth: obj_4['penStrokeWidth'] } });
1835
2279
  var indexObj = { freehandSelectedIndex: null };
1836
2280
  this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
1837
- this.pointColl[indexObj['freehandSelectedIndex']].strokeWidth = obj_3['penStrokeWidth'];
2281
+ this.pointColl[indexObj['freehandSelectedIndex']].strokeWidth = obj_4['penStrokeWidth'];
1838
2282
  this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
1839
2283
  value: { operation: 'freehanddrawCustomized', previousObj: prevObj, previousObjColl: prevObj.objColl,
1840
2284
  previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
1841
2285
  previousCropObj: prevCropObj, previousText: null,
1842
2286
  currentText: null, previousFilter: null, isCircleCrop: null } });
1843
2287
  }
2288
+ shapeSettings.type = ShapeType.FreehandDraw;
2289
+ var shapeChangedArgs = { action: 'stroke-width', previousShapeSettings: extend({}, shapeSettings, {}, true),
2290
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2291
+ shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2292
+ this.triggerShapeChanged(shapeChangedArgs);
1844
2293
  };
1845
2294
  /**
1846
2295
  * Apply Pen stroke color.
@@ -1854,6 +2303,9 @@ var ImageEditor = /** @class */ (function (_super) {
1854
2303
  var temp = extend([], this.pointColl, [], true);
1855
2304
  this.updateFreehandDrawColorChange();
1856
2305
  var prevCropObj = extend({}, this.cropObj, {}, true);
2306
+ var objt = { shapeSettingsObj: {} };
2307
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
2308
+ var shapeSettings = objt['shapeSettingsObj'];
1857
2309
  var object = { currObj: {} };
1858
2310
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1859
2311
  var prevObj = object['currObj'];
@@ -1885,6 +2337,11 @@ var ImageEditor = /** @class */ (function (_super) {
1885
2337
  else if (!this.togglePen) {
1886
2338
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.activeObj } });
1887
2339
  }
2340
+ shapeSettings.type = ShapeType.FreehandDraw;
2341
+ var shapeChangedArgs = { action: 'stroke-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2342
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2343
+ shapeChangedArgs.currentShapeSettings.strokeColor = value;
2344
+ this.triggerShapeChanged(shapeChangedArgs);
1888
2345
  };
1889
2346
  /**
1890
2347
  * Apply Shape stroke width.
@@ -1894,30 +2351,47 @@ var ImageEditor = /** @class */ (function (_super) {
1894
2351
  * @returns {void}.
1895
2352
  */
1896
2353
  ImageEditor.prototype.updateStrokeWidth = function (id) {
1897
- this.notify('shape', { prop: 'pushActItemIntoObj' });
1898
- var prevCropObj = extend({}, this.cropObj, {}, true);
1899
- var object = { currObj: {} };
1900
- this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1901
- var prevObj = object['currObj'];
1902
- prevObj.objColl = extend([], this.objColl, [], true);
1903
- prevObj.pointColl = extend([], this.pointColl, [], true);
1904
- prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
1905
- var selPointCollObj = { selPointColl: null };
1906
- this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
1907
- value: { obj: selPointCollObj } });
1908
- prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
1909
- this.objColl.pop();
1910
- this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
1911
- this.activeObj.strokeSettings.strokeWidth *= 2;
1912
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
1913
- strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
1914
- this.objColl.push(this.activeObj);
1915
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
1916
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
1917
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
1918
- previousCropObj: prevCropObj, previousText: null,
1919
- currentText: null, previousFilter: null, isCircleCrop: null } });
1920
- this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2354
+ if (this.activeObj.shape && (this.activeObj.shape !== 'path' || (this.activeObj.shape === 'path' &&
2355
+ this.activeObj.pointColl.length > 0))) {
2356
+ var obj = { shapeSettingsObj: {} };
2357
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
2358
+ var shapeSettings = obj['shapeSettingsObj'];
2359
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
2360
+ var prevCropObj = extend({}, this.cropObj, {}, true);
2361
+ var object = { currObj: {} };
2362
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2363
+ var prevObj = object['currObj'];
2364
+ prevObj.objColl = extend([], this.objColl, [], true);
2365
+ prevObj.pointColl = extend([], this.pointColl, [], true);
2366
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
2367
+ var selPointCollObj = { selPointColl: null };
2368
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
2369
+ value: { obj: selPointCollObj } });
2370
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2371
+ this.objColl.pop();
2372
+ this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
2373
+ this.activeObj.strokeSettings.strokeWidth *= 2;
2374
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
2375
+ strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
2376
+ this.objColl.push(this.activeObj);
2377
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2378
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2379
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2380
+ previousCropObj: prevCropObj, previousText: null,
2381
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2382
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2383
+ var shapeChangedArgs = { action: 'stroke-width', previousShapeSettings: extend({}, shapeSettings, {}, true),
2384
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2385
+ shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
2386
+ this.triggerShapeChanged(shapeChangedArgs);
2387
+ }
2388
+ else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
2389
+ this.activeObj.pointColl.length === 0)) {
2390
+ this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
2391
+ this.activeObj.strokeSettings.strokeWidth *= 2;
2392
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: null, fillColor: null,
2393
+ strokeWidth: this.activeObj.strokeSettings.strokeWidth } });
2394
+ }
1921
2395
  };
1922
2396
  /**
1923
2397
  * Apply Shape stroke color.
@@ -1927,30 +2401,45 @@ var ImageEditor = /** @class */ (function (_super) {
1927
2401
  * @returns {void}.
1928
2402
  */
1929
2403
  ImageEditor.prototype.updateStrokeColor = function (value) {
1930
- this.notify('shape', { prop: 'pushActItemIntoObj' });
1931
- var prevCropObj = extend({}, this.cropObj, {}, true);
1932
- var object = { currObj: {} };
1933
- this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
1934
- var prevObj = object['currObj'];
1935
- prevObj.objColl = extend([], this.objColl, [], true);
1936
- prevObj.pointColl = extend([], this.pointColl, [], true);
1937
- prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
1938
- var selPointCollObj = { selPointColl: null };
1939
- this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
1940
- value: { obj: selPointCollObj } });
1941
- prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
1942
- this.objColl.pop();
1943
- this.activeObj.strokeSettings.strokeColor = value;
1944
- this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
1945
- if (!this.togglePen) {
1946
- this.objColl.push(this.activeObj);
1947
- this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
1948
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
1949
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
1950
- previousCropObj: prevCropObj, previousText: null,
1951
- currentText: null, previousFilter: null, isCircleCrop: null } });
1952
- this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2404
+ var objt = { shapeSettingsObj: {} };
2405
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
2406
+ var shapeSettings = objt['shapeSettingsObj'];
2407
+ if (this.activeObj.shape && (this.activeObj.shape !== 'path' || (this.activeObj.shape === 'path' &&
2408
+ this.activeObj.pointColl.length > 0))) {
2409
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
2410
+ var prevCropObj = extend({}, this.cropObj, {}, true);
2411
+ var object = { currObj: {} };
2412
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2413
+ var prevObj = object['currObj'];
2414
+ prevObj.objColl = extend([], this.objColl, [], true);
2415
+ prevObj.pointColl = extend([], this.pointColl, [], true);
2416
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
2417
+ var selPointCollObj = { selPointColl: null };
2418
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
2419
+ value: { obj: selPointCollObj } });
2420
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2421
+ this.objColl.pop();
2422
+ this.activeObj.strokeSettings.strokeColor = value;
2423
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
2424
+ if (!this.togglePen) {
2425
+ this.objColl.push(this.activeObj);
2426
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2427
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
2428
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2429
+ previousCropObj: prevCropObj, previousText: null,
2430
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2431
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2432
+ }
1953
2433
  }
2434
+ else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
2435
+ this.activeObj.pointColl.length === 0)) {
2436
+ this.activeObj.strokeSettings.strokeColor = value;
2437
+ this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
2438
+ }
2439
+ var shapeChangedArgs = { action: 'stroke-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2440
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2441
+ shapeChangedArgs.currentShapeSettings.strokeColor = value;
2442
+ this.triggerShapeChanged(shapeChangedArgs);
1954
2443
  };
1955
2444
  /**
1956
2445
  * Apply Shape fill color.
@@ -1960,6 +2449,9 @@ var ImageEditor = /** @class */ (function (_super) {
1960
2449
  * @returns {void}.
1961
2450
  */
1962
2451
  ImageEditor.prototype.updateFillColor = function (value) {
2452
+ var obj = { shapeSettingsObj: {} };
2453
+ this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
2454
+ var shapeSettings = obj['shapeSettingsObj'];
1963
2455
  this.notify('shape', { prop: 'pushActItemIntoObj' });
1964
2456
  var prevCropObj = extend({}, this.cropObj, {}, true);
1965
2457
  var object = { currObj: {} };
@@ -1984,6 +2476,125 @@ var ImageEditor = /** @class */ (function (_super) {
1984
2476
  previousCropObj: prevCropObj, previousText: null,
1985
2477
  currentText: null, previousFilter: null, isCircleCrop: null } });
1986
2478
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2479
+ var shapeChangedArgs = { action: 'fill-color', previousShapeSettings: extend({}, shapeSettings, {}, true),
2480
+ currentShapeSettings: extend({}, shapeSettings, {}, true) };
2481
+ shapeChangedArgs.currentShapeSettings.fillColor = value;
2482
+ this.triggerShapeChanged(shapeChangedArgs);
2483
+ };
2484
+ /**
2485
+ * Apply horizontal flip.
2486
+ *
2487
+ * @param { CanvasRenderingContext2D } ctx - Specifies the canvas context 2D.
2488
+ * @param { boolean } isPreventURC - Specifies to update undo redo collection.
2489
+ * @hidden
2490
+ * @returns {void}.
2491
+ */
2492
+ ImageEditor.prototype.horizontalFlip = function (ctx, isPreventURC) {
2493
+ var prevCropObj;
2494
+ var prevObj;
2495
+ if (isNullOrUndefined(isPreventURC)) {
2496
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
2497
+ prevCropObj = extend({}, this.cropObj, {}, true);
2498
+ var object = { currObj: {} };
2499
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2500
+ prevObj = object['currObj'];
2501
+ prevObj.objColl = extend([], this.objColl, [], true);
2502
+ prevObj.pointColl = extend([], this.pointColl, [], true);
2503
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
2504
+ var selPointCollObj = { selPointColl: null };
2505
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
2506
+ value: { obj: selPointCollObj } });
2507
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2508
+ this.objColl.pop();
2509
+ }
2510
+ if (!isBlazor()) {
2511
+ this.notify('toolbar', { prop: 'refreshSlider' });
2512
+ }
2513
+ ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
2514
+ this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
2515
+ value: { ctx: this.activeObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: true, isVFlip: null } });
2516
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
2517
+ if (isNullOrUndefined(isPreventURC)) {
2518
+ this.objColl.push(this.activeObj);
2519
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2520
+ value: { operation: 'imageHFlip', previousObj: prevObj, previousObjColl: prevObj.objColl,
2521
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2522
+ previousCropObj: prevCropObj, previousText: null,
2523
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2524
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2525
+ }
2526
+ };
2527
+ /**
2528
+ * Apply vertical flip.
2529
+ *
2530
+ * @param { CanvasRenderingContext2D } ctx - Specifies the canvas context 2D.
2531
+ * @param { boolean } isPreventURC - Specifies to update undo redo collection.
2532
+ * @hidden
2533
+ * @returns {void}.
2534
+ */
2535
+ ImageEditor.prototype.verticalFlip = function (ctx, isPreventURC) {
2536
+ var prevCropObj;
2537
+ var prevObj;
2538
+ if (isNullOrUndefined(isPreventURC)) {
2539
+ this.notify('shape', { prop: 'pushActItemIntoObj' });
2540
+ prevCropObj = extend({}, this.cropObj, {}, true);
2541
+ var object = { currObj: {} };
2542
+ this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
2543
+ prevObj = object['currObj'];
2544
+ prevObj.objColl = extend([], this.objColl, [], true);
2545
+ prevObj.pointColl = extend([], this.pointColl, [], true);
2546
+ prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
2547
+ var selPointCollObj = { selPointColl: null };
2548
+ this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
2549
+ value: { obj: selPointCollObj } });
2550
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
2551
+ this.objColl.pop();
2552
+ }
2553
+ if (!isBlazor()) {
2554
+ this.notify('toolbar', { prop: 'refreshSlider' });
2555
+ }
2556
+ ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
2557
+ this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
2558
+ value: { ctx: this.activeObj.imageCanvas.getContext('2d'), isImgAnnotation: true, isHFlip: null, isVFlip: true } });
2559
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
2560
+ if (isNullOrUndefined(isPreventURC)) {
2561
+ this.objColl.push(this.activeObj);
2562
+ this.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
2563
+ value: { operation: 'imageVFlip', previousObj: prevObj, previousObjColl: prevObj.objColl,
2564
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
2565
+ previousCropObj: prevCropObj, previousText: null,
2566
+ currentText: null, previousFilter: null, isCircleCrop: null } });
2567
+ this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
2568
+ }
2569
+ };
2570
+ /**
2571
+ * Apply rotate image.
2572
+ *
2573
+ * @param { string } rotate - Specifies the direction of rotation.
2574
+ * @hidden
2575
+ * @returns {void}.
2576
+ */
2577
+ ImageEditor.prototype.rotateImage = function (rotate) {
2578
+ if (!isBlazor()) {
2579
+ this.notify('toolbar', { prop: 'refreshSlider' });
2580
+ }
2581
+ if (rotate === 'rotleft') {
2582
+ this.activeObj.rotatedAngle -= (90 * (Math.PI / 180));
2583
+ }
2584
+ else {
2585
+ this.activeObj.rotatedAngle += (90 * (Math.PI / 180));
2586
+ }
2587
+ this.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: this.activeObj } });
2588
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
2589
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
2590
+ if (!isBlazor()) {
2591
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
2592
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
2593
+ }
2594
+ else {
2595
+ this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
2596
+ this.updateToolbar(this.element, 'quickAccessToolbar', 'image');
2597
+ }
1987
2598
  };
1988
2599
  /**
1989
2600
  * Get pascalToSplitWords from string.
@@ -2016,7 +2627,8 @@ var ImageEditor = /** @class */ (function (_super) {
2016
2627
  var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
2017
2628
  'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
2018
2629
  'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
2019
- 'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure };
2630
+ 'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure,
2631
+ 'transparency': obj['adjustmentLevel'].transparency };
2020
2632
  return typeToAdjustmentLevel["" + type];
2021
2633
  };
2022
2634
  /**
@@ -2028,10 +2640,12 @@ var ImageEditor = /** @class */ (function (_super) {
2028
2640
  */
2029
2641
  ImageEditor.prototype.transformSelect = function (type) {
2030
2642
  this.isCropToolbar = true;
2643
+ this.allowDownScale = false;
2031
2644
  this.setInitialZoomState();
2032
2645
  var activeObj = extend({}, this.activeObj, {}, true);
2033
2646
  this.cropSelectedState();
2034
2647
  this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
2648
+ this.updateImageTransformColl(type);
2035
2649
  this.notify('transform', { prop: 'performTransformation', value: { text: type } });
2036
2650
  this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
2037
2651
  this.isCropToolbar = false;
@@ -2059,6 +2673,19 @@ var ImageEditor = /** @class */ (function (_super) {
2059
2673
  ImageEditor.prototype.initializeImageEditor = function (element, dotnetRef) {
2060
2674
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2061
2675
  this.element = element;
2676
+ if (isBlazor() && this.element.querySelector('.place-holder')) {
2677
+ this.element.querySelector('.place-holder').remove();
2678
+ }
2679
+ if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
2680
+ this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
2681
+ this.element.querySelector('.e-ie-drop-content').style.display = 'block';
2682
+ }
2683
+ if (isBlazor() && this.element.querySelector('.e-ie-drop-area')) {
2684
+ this.element.querySelector('.e-ie-drop-area').style.display = 'block';
2685
+ }
2686
+ if (isBlazor() && this.element.querySelector('.e-toolbar-area')) {
2687
+ this.element.querySelector('.e-toolbar-area').style.display = 'block';
2688
+ }
2062
2689
  var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
2063
2690
  if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
2064
2691
  this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
@@ -2076,6 +2703,9 @@ var ImageEditor = /** @class */ (function (_super) {
2076
2703
  this.inMemoryCanvas = this.createElement('canvas', {
2077
2704
  id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
2078
2705
  });
2706
+ this.baseImgCanvas = this.createElement('canvas', {
2707
+ id: this.element.id + '_baseImgCanvas', attrs: { name: 'canvasImage' }
2708
+ });
2079
2709
  this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
2080
2710
  this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
2081
2711
  this.lowerContext = this.lowerCanvas.getContext('2d');
@@ -2154,6 +2784,19 @@ var ImageEditor = /** @class */ (function (_super) {
2154
2784
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
2155
2785
  ImageEditor.prototype.updateToolbar = function (element, type, value) {
2156
2786
  };
2787
+ /**
2788
+ * Trigger the shapeChanging event for after the shape applied.
2789
+ *
2790
+ * @param { ShapeChangeEventArgs } shapeChangedArgs - Specifies the shapeChaning event args.
2791
+ * @hidden
2792
+ * @returns {void}.
2793
+ */
2794
+ ImageEditor.prototype.triggerShapeChanged = function (shapeChangedArgs) {
2795
+ if (isBlazor() && this.events && this.events.shapeChanged.hasDelegate === true) {
2796
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2797
+ this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', shapeChangedArgs);
2798
+ }
2799
+ };
2157
2800
  var ImageEditor_1;
2158
2801
  __decorate([
2159
2802
  Property('')
@@ -2260,9 +2903,15 @@ var ImageEditor = /** @class */ (function (_super) {
2260
2903
  __decorate([
2261
2904
  Event()
2262
2905
  ], ImageEditor.prototype, "quickAccessToolbarOpen", void 0);
2906
+ __decorate([
2907
+ Event()
2908
+ ], ImageEditor.prototype, "resizing", void 0);
2263
2909
  __decorate([
2264
2910
  Event()
2265
2911
  ], ImageEditor.prototype, "quickAccessToolbarItemClick", void 0);
2912
+ __decorate([
2913
+ Event()
2914
+ ], ImageEditor.prototype, "frameChange", void 0);
2266
2915
  ImageEditor = ImageEditor_1 = __decorate([
2267
2916
  NotifyPropertyChanges
2268
2917
  ], ImageEditor);