@syncfusion/ej2-image-editor 24.2.8 → 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 (76) hide show
  1. package/CHANGELOG.md +3 -51
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +942 -1874
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +974 -1923
  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 +302 -423
  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
@@ -1,4 +1,4 @@
1
- import { Browser, ChildProperty, Complex, Component, Event, EventHandler, L10n, NotifyPropertyChanges, Property, addClass, compile, detach, extend, getComponent, getUniqueID, isBlazor, isNullOrUndefined, removeClass, select } from '@syncfusion/ej2-base';
1
+ import { Browser, ChildProperty, Complex, Component, Event, EventHandler, L10n, NotifyPropertyChanges, Property, addClass, compile, detach, extend, getComponent, getUniqueID, isNullOrUndefined, removeClass, select } from '@syncfusion/ej2-base';
2
2
  import { Dialog, createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
3
3
  import { ColorPicker, NumericTextBox, Slider, Uploader } from '@syncfusion/ej2-inputs';
4
4
  import { Toolbar } from '@syncfusion/ej2-navigations';
@@ -858,25 +858,10 @@ class Crop {
858
858
  }
859
859
  const transitionArgs = { cancel: false, startPoint: { x: startX, y: startY },
860
860
  endPoint: { x: endX, y: endY }, preventScaling: false };
861
- if (!object['isCropToolbar'] && isBlazor() && parent.events && parent.events.cropping.hasDelegate === true) {
862
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
863
- if (parent.currentToolbar === 'resize-toolbar') {
864
- parent.dotNetRef.invokeMethodAsync('CropEventAsync', 'OnCrop', transitionArgs, null);
865
- this.cropEvent(transitionArgs, obj, object);
866
- }
867
- else {
868
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
869
- parent.dotNetRef.invokeMethodAsync('CropEventAsync', 'OnCrop', transitionArgs, null).then((args) => {
870
- this.cropEvent(args, obj, object);
871
- });
872
- }
873
- }
874
- else {
875
- if (!object['isCropToolbar']) {
876
- parent.trigger('cropping', transitionArgs);
877
- }
878
- this.cropEvent(transitionArgs, obj, object);
861
+ if (!object['isCropToolbar']) {
862
+ parent.trigger('cropping', transitionArgs);
879
863
  }
864
+ this.cropEvent(transitionArgs, obj, object);
880
865
  }
881
866
  }
882
867
  cropEvent(transitionArgs, obj, object) {
@@ -911,25 +896,14 @@ class Crop {
911
896
  const aspectIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
912
897
  const nonAspectIcon = parent.element.querySelector('#' + parent.element.id + '_nonaspectratio');
913
898
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
914
- if (!isBlazor() && !object['isCropToolbar'] && (isNullOrUndefined(aspectIcon) && isNullOrUndefined(nonAspectIcon))) {
899
+ if (!object['isCropToolbar'] && (isNullOrUndefined(aspectIcon) && isNullOrUndefined(nonAspectIcon))) {
915
900
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
916
901
  isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
917
902
  }
918
- else if (!object['isCropToolbar']) {
919
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
920
- if (parent.currentToolbar !== 'resize-toolbar') {
921
- parent.updateToolbar(parent.element, 'imageLoaded');
922
- }
923
- }
924
903
  this.resizeWrapper();
925
904
  if (Browser.isDevice) {
926
905
  this.updateUndoRedoColl(prevObj, prevCropObj, object);
927
906
  }
928
- transitionArgs = { startPoint: transitionArgs.startPoint, endPoint: transitionArgs.endPoint };
929
- if (!object['isCropToolbar'] && isBlazor() && parent.events && parent.events.cropped.hasDelegate === true) {
930
- parent.dotNetRef.invokeMethodAsync('CropEventAsync', 'Cropped', null, transitionArgs);
931
- }
932
- else { }
933
907
  }
934
908
  }
935
909
  }
@@ -948,25 +922,16 @@ class Crop {
948
922
  }
949
923
  resizeWrapper() {
950
924
  const parent = this.parent;
951
- if (Browser.isDevice && !isBlazor()) {
925
+ if (Browser.isDevice) {
952
926
  const elem = parent.element;
953
927
  const ctxToolbar = elem.querySelector('#' + elem.id + '_contextualToolbarArea');
954
- if (ctxToolbar.style.position === '' && !this.isTransformCrop) {
928
+ if (ctxToolbar && ctxToolbar.style.position === '' && !this.isTransformCrop) {
955
929
  ctxToolbar.style.position = 'absolute';
956
930
  parent.isStraightening = false;
957
931
  parent.update();
958
932
  parent.notify('filter', { prop: 'setAdjustmentValue', value: { adjustmentValue: parent.canvasFilter } });
959
933
  }
960
934
  }
961
- else if (Browser.isDevice && isBlazor() && !this.isTransformCrop) {
962
- parent.isStraightening = false;
963
- parent.update();
964
- const canvasWrapper = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper');
965
- if (canvasWrapper) {
966
- canvasWrapper.style.height = (parseInt(canvasWrapper.style.height) + 2) + 'px';
967
- }
968
- parent.notify('filter', { prop: 'setAdjustmentValue', value: { adjustmentValue: parent.canvasFilter } });
969
- }
970
935
  }
971
936
  calcRatio(obj, dimension) {
972
937
  const parent = this.parent;
@@ -3432,36 +3397,21 @@ class Draw {
3432
3397
  proxy.parent.lowerCanvas.style.display = 'block';
3433
3398
  }
3434
3399
  parent.isUndoRedo = this.isErrorImage = false;
3435
- if (!isBlazor()) {
3436
- if (Browser.isDevice) {
3437
- parent.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
3438
- parent.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
3439
- const eventargs = { isApplyBtn: false, isDevice: Browser.isDevice, isOkBtn: null,
3440
- isResize: null, isFrame: null, isMainToolbar: true };
3441
- parent.notify('toolbar', { prop: 'init-main-toolbar', onPropertyChange: false, value: eventargs });
3442
- parent.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
3443
- }
3444
- else {
3445
- parent.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
3446
- const eventargs = { isApplyBtn: false, isDevice: false, isOkBtn: null };
3447
- parent.notify('toolbar', { prop: 'init-main-toolbar', onPropertyChange: false, value: eventargs });
3448
- }
3400
+ if (Browser.isDevice) {
3401
+ parent.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
3402
+ parent.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
3403
+ const eventargs = { isApplyBtn: false, isDevice: Browser.isDevice, isOkBtn: null,
3404
+ isResize: null, isFrame: null, isMainToolbar: true };
3405
+ parent.notify('toolbar', { prop: 'init-main-toolbar', onPropertyChange: false, value: eventargs });
3406
+ parent.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
3449
3407
  }
3450
3408
  else {
3451
- parent.updateToolbar(parent.element, 'imageLoaded', 'initial');
3452
- if (Browser.isDevice) {
3453
- parent.element.querySelector('.e-bottom-toolbar-area').style.display = 'block';
3454
- parent.element.querySelector('.e-canvas-wrapper').style.height = (parent.element.offsetHeight
3455
- - parent.toolbarHeight * 2) - 1 + 'px';
3456
- }
3409
+ parent.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
3410
+ const eventargs = { isApplyBtn: false, isDevice: false, isOkBtn: null };
3411
+ parent.notify('toolbar', { prop: 'init-main-toolbar', onPropertyChange: false, value: eventargs });
3457
3412
  }
3458
3413
  if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3459
- if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3460
- parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3461
- }
3462
- else {
3463
- parent.trigger('fileOpened', fileOpened);
3464
- }
3414
+ parent.trigger('fileOpened', fileOpened);
3465
3415
  }
3466
3416
  };
3467
3417
  parent.baseImg.onerror = () => {
@@ -3473,12 +3423,7 @@ class Draw {
3473
3423
  errorLoading() {
3474
3424
  const parent = this.parent;
3475
3425
  const fileOpened = { fileName: null, fileType: null, isValidImage: false };
3476
- if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3477
- parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3478
- }
3479
- else {
3480
- parent.trigger('fileOpened', fileOpened);
3481
- }
3426
+ parent.trigger('fileOpened', fileOpened);
3482
3427
  }
3483
3428
  updateBaseImgCanvas() {
3484
3429
  const parent = this.parent;
@@ -3563,12 +3508,7 @@ class Draw {
3563
3508
  this.resetFrameZoom(false);
3564
3509
  if (obj['bool']) {
3565
3510
  parent.notify('freehand-draw', { prop: 'cancelFhd', onPropertyChange: false });
3566
- if (!isBlazor()) {
3567
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3568
- }
3569
- else {
3570
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3571
- }
3511
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3572
3512
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'cancel' } });
3573
3513
  }
3574
3514
  else if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
@@ -3588,18 +3528,11 @@ class Draw {
3588
3528
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3589
3529
  }
3590
3530
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
3591
- if (!isBlazor()) {
3592
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
3593
- }
3594
- else {
3595
- parent.updateToolbar(parent.element, 'imageLoaded');
3596
- }
3531
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
3597
3532
  parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false, value: { obj: parent.activeObj } });
3598
3533
  }
3599
- else if ((!isBlazor() && (!Browser.isDevice || (Browser.isDevice && !straightenObj['bool'])) &&
3600
- document.querySelector('#' + parent.element.id + '_sliderWrapper')) ||
3601
- (isBlazor() && !parent.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
3602
- parent.currObjType.isFiltered) {
3534
+ else if (((!Browser.isDevice || (Browser.isDevice && !straightenObj['bool'])) &&
3535
+ document.querySelector('#' + parent.element.id + '_sliderWrapper')) || parent.currObjType.isFiltered) {
3603
3536
  this.lowerContext.filter = this.tempAdjValue;
3604
3537
  parent.canvasFilter = this.tempAdjValue;
3605
3538
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.tempAdjValue } });
@@ -3627,18 +3560,10 @@ class Draw {
3627
3560
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
3628
3561
  }
3629
3562
  const eventargs = { type: 'main', isApplyBtn: null, isCropping: null, isZooming: null };
3630
- if (!isBlazor()) {
3631
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3632
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3633
- if (parent.activeObj.shape && parent.activeObj.shape === 'image') {
3634
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3635
- }
3636
- }
3637
- else {
3638
- parent.updateToolbar(parent.element, 'imageLoaded');
3639
- if (parent.activeObj.shape && parent.activeObj.shape === 'image') {
3640
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3641
- }
3563
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3564
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3565
+ if (parent.activeObj.shape && parent.activeObj.shape === 'image') {
3566
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3642
3567
  }
3643
3568
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'cancel' } });
3644
3569
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -3647,12 +3572,7 @@ class Draw {
3647
3572
  else {
3648
3573
  if (isContextualToolbar && (!Browser.isDevice || (Browser.isDevice && !straightenObj['bool']))) {
3649
3574
  const eventargs = { type: 'main', isApplyBtn: null, isCropping: null, isZooming: null };
3650
- if (!isBlazor()) {
3651
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3652
- }
3653
- else {
3654
- parent.updateToolbar(parent.element, 'imageLoaded');
3655
- }
3575
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3656
3576
  }
3657
3577
  else {
3658
3578
  this.cancelItems();
@@ -3668,10 +3588,8 @@ class Draw {
3668
3588
  }
3669
3589
  this.isShapeTextInserted = false;
3670
3590
  this.isNewPath = false;
3671
- if (!isBlazor()) {
3672
- parent.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
3673
- parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
3674
- }
3591
+ parent.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
3592
+ parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
3675
3593
  }
3676
3594
  cancelItems() {
3677
3595
  const parent = this.parent;
@@ -3747,6 +3665,7 @@ class Draw {
3747
3665
  const temp = parent.isCropTab;
3748
3666
  parent.isCropTab = false;
3749
3667
  this.updateCropSelObj();
3668
+ parent.cancelCropSelection = null;
3750
3669
  parent.isCropTab = temp;
3751
3670
  }
3752
3671
  }
@@ -3774,12 +3693,7 @@ class Draw {
3774
3693
  parent.currObjType.isCustomCrop = false;
3775
3694
  this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
3776
3695
  const eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
3777
- if (!isBlazor()) {
3778
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3779
- }
3780
- else {
3781
- parent.updateToolbar(parent.element, 'imageLoaded');
3782
- }
3696
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3783
3697
  }
3784
3698
  cancelPen() {
3785
3699
  const parent = this.parent;
@@ -3840,12 +3754,7 @@ class Draw {
3840
3754
  parent.clearSelection();
3841
3755
  }
3842
3756
  }
3843
- if (!isBlazor()) {
3844
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3845
- }
3846
- else {
3847
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3848
- }
3757
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3849
3758
  this.tempTextSettings = { text: 'Enter Text', fontFamily: parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false,
3850
3759
  italic: false, underline: false };
3851
3760
  }
@@ -3889,12 +3798,7 @@ class Draw {
3889
3798
  }
3890
3799
  }
3891
3800
  parent.currObjType.isDragging = false;
3892
- if (!isBlazor()) {
3893
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3894
- }
3895
- else {
3896
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3897
- }
3801
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3898
3802
  }
3899
3803
  cancelSelection() {
3900
3804
  const parent = this.parent;
@@ -4091,41 +3995,20 @@ class Draw {
4091
3995
  startY: obj['shapeSettingsObj']['startY'], width: obj['shapeSettingsObj']['width'], height: obj['shapeSettingsObj']['height'] };
4092
3996
  const selectionChangingArgs = { action: 'insert', previousSelectionSettings: selectionSettings,
4093
3997
  currentSelectionSettings: selectionSettings };
4094
- if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
4095
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4096
- parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then((selectionChangingArgs) => {
4097
- parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
4098
- value: { selectionSettings: selectionChangingArgs.currentSelectionSettings } });
4099
- if (selectionChangingArgs.currentSelectionSettings.type === 'Custom') {
4100
- this.drawObject('duplicate', parent.activeObj, null, null, true);
4101
- }
4102
- else {
4103
- if (actPoint.startX !== 0 || actPoint.startY !== 0 ||
4104
- actPoint.width !== 0 || actPoint.height !== 0) {
4105
- points = { startX: actPoint.startX, startY: actPoint.startY,
4106
- endX: actPoint.endX, endY: actPoint.endY,
4107
- width: actPoint.width, height: actPoint.height };
4108
- }
4109
- this.drawObject('duplicate', null, true, points);
4110
- }
4111
- });
3998
+ parent.trigger('selectionChanging', selectionChangingArgs);
3999
+ parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
4000
+ value: { selectionSettings: selectionChangingArgs.currentSelectionSettings } });
4001
+ if (selectionChangingArgs.currentSelectionSettings.type === 'Custom') {
4002
+ this.drawObject('duplicate', parent.activeObj, null, null, true);
4112
4003
  }
4113
4004
  else {
4114
- parent.trigger('selectionChanging', selectionChangingArgs);
4115
- parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
4116
- value: { selectionSettings: selectionChangingArgs.currentSelectionSettings } });
4117
- if (selectionChangingArgs.currentSelectionSettings.type === 'Custom') {
4118
- this.drawObject('duplicate', parent.activeObj, null, null, true);
4119
- }
4120
- else {
4121
- if (actPoint.startX !== 0 || actPoint.startY !== 0 ||
4122
- actPoint.width !== 0 || actPoint.height !== 0) {
4123
- points = { startX: actPoint.startX, startY: actPoint.startY,
4124
- endX: actPoint.endX, endY: actPoint.endY,
4125
- width: actPoint.width, height: actPoint.height };
4126
- }
4127
- this.drawObject('duplicate', null, true, points);
4005
+ if (actPoint.startX !== 0 || actPoint.startY !== 0 ||
4006
+ actPoint.width !== 0 || actPoint.height !== 0) {
4007
+ points = { startX: actPoint.startX, startY: actPoint.startY,
4008
+ endX: actPoint.endX, endY: actPoint.endY,
4009
+ width: actPoint.width, height: actPoint.height };
4128
4010
  }
4011
+ this.drawObject('duplicate', null, true, points);
4129
4012
  }
4130
4013
  }
4131
4014
  drawCustomSelection(cropShape, startX, startY, width, height) {
@@ -4704,19 +4587,12 @@ class Draw {
4704
4587
  });
4705
4588
  this.imgCanvasPoints = points;
4706
4589
  let count = 0;
4707
- if ((!isBlazor() && parent.transform.straighten === 3 && !this.preventStraightening) ||
4708
- (isBlazor() && parent.transform.straighten === 5 && !this.preventStraightening)) {
4590
+ if (parent.transform.straighten === 3 && !this.preventStraightening) {
4709
4591
  this.preventStraightening = true;
4710
4592
  const temp = parent.prevStraightenedDegree;
4711
4593
  parent.prevStraightenedDegree = parent.transform.straighten;
4712
4594
  parent.setStraighten(0);
4713
- if (isBlazor()) {
4714
- parent.setStraighten(5);
4715
- }
4716
- else {
4717
- parent.setStraighten(3);
4718
- }
4719
-
4595
+ parent.setStraighten(3);
4720
4596
  parent.prevStraightenedDegree = temp;
4721
4597
  this.preventStraightening = false;
4722
4598
  }
@@ -4753,19 +4629,12 @@ class Draw {
4753
4629
  toolbar.style.display = 'none';
4754
4630
  }
4755
4631
  const obj = { defToolbarItems: null };
4756
- if (!isBlazor()) {
4757
- parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
4758
- if (obj['defToolbarItems'].length === 0 &&
4759
- (isNullOrUndefined(document.getElementById(id + '_toolbar'))) &&
4760
- parent.element.querySelector('#' + id + '_toolbarArea')) {
4761
- const height = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
4762
- parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
4763
- }
4764
- }
4765
- else {
4766
- if (parent.element.querySelector('#' + id + '_toolbarArea')) {
4767
- parent.toolbarHeight = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
4768
- }
4632
+ parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
4633
+ if (obj['defToolbarItems'].length === 0 &&
4634
+ (isNullOrUndefined(document.getElementById(id + '_toolbar'))) &&
4635
+ parent.element.querySelector('#' + id + '_toolbarArea')) {
4636
+ const height = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
4637
+ parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
4769
4638
  }
4770
4639
  parent.reset();
4771
4640
  parent.update();
@@ -4831,9 +4700,7 @@ class Draw {
4831
4700
  this.reset();
4832
4701
  this.openNewImage();
4833
4702
  }
4834
- if (!isBlazor()) {
4835
- getComponent(document.getElementById(parent.element.id + '_dialog'), 'dialog').destroy();
4836
- }
4703
+ getComponent(document.getElementById(parent.element.id + '_dialog'), 'dialog').destroy();
4837
4704
  this.isImageEdited = false;
4838
4705
  }
4839
4706
  showDialogPopup() {
@@ -4942,12 +4809,7 @@ class Draw {
4942
4809
  this.openURL = url;
4943
4810
  if (parent.isImageLoaded && !parent.isChangesSaved && (this.isImageEdited || parent.pointColl.length > 0 || parent.objColl.length > 0)) {
4944
4811
  this.isFileChanged = true;
4945
- if (!isBlazor()) {
4946
- this.showDialogPopup();
4947
- }
4948
- else {
4949
- parent.dotNetRef.invokeMethodAsync('UpdateDialog', true);
4950
- }
4812
+ this.showDialogPopup();
4951
4813
  }
4952
4814
  else {
4953
4815
  this.checkToolbarTemplate(inputElement, url);
@@ -5527,59 +5389,9 @@ class Draw {
5527
5389
  frameLineStyle: parent.toPascalCase(parent.frameObj.border), lineCount: parent.frameObj.amount };
5528
5390
  const frameChange = { cancel: false, previousFrameSetting: prevFrameSettings,
5529
5391
  currentFrameSetting: currFrameSettings };
5530
- if (isBlazor()) {
5531
- if (parent.events && parent.events.frameChanging.hasDelegate === true) {
5532
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5533
- parent.dotNetRef.invokeMethodAsync('OnFrameChangingAsync', 'FrameChanging', frameChange, null).then((args) => {
5534
- if (!args.cancel) {
5535
- this.setFrameObj(args.currentFrameSetting);
5536
- const obj = { currObj: {} };
5537
- parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: obj } });
5538
- parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false, value: {
5539
- operation: 'frame', previousObj: obj['currObj'], previousObjColl: obj['currObj']['objColl'],
5540
- previousPointColl: obj['currObj']['pointColl'], previousSelPointColl: obj['currObj']['selPointColl'],
5541
- previousCropObj: extend({}, parent.cropObj, {}, true), previousText: null, currentText: null,
5542
- previousFilter: null, isCircleCrop: null
5543
- } });
5544
- const fillColorDiv = parent.element.querySelector('.e-ie-toolbar-e-frame-color');
5545
- if (fillColorDiv) {
5546
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5547
- parent.element.querySelector('.e-ie-toolbar-e-frame-color' + parent.DDBPREVIEW).style.background = parent.frameObj.color;
5548
- }
5549
- const graColorDiv = parent.element.querySelector('.e-ie-toolbar-e-frame-gradient');
5550
- if (graColorDiv) {
5551
- const noColorDiv = document.querySelector('.e-dropdown-popup.e-frame-gradient-dd-btn');
5552
- if (noColorDiv) {
5553
- noColorDiv.querySelector('.e-nocolor-item').classList.remove('e-selected');
5554
- }
5555
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5556
- parent.element.querySelector('.e-ie-toolbar-e-frame-gradient' + parent.DDBPREVIEW).classList.remove('e-nocolor-item');
5557
- if (parent.frameObj.gradientColor === '') {
5558
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5559
- parent.element.querySelector('.e-ie-toolbar-e-frame-gradient' + parent.DDBPREVIEW).classList.add('e-nocolor-item');
5560
- }
5561
- else {
5562
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
5563
- parent.element.querySelector('.e-ie-toolbar-e-frame-gradient' + parent.DDBPREVIEW).style.background = parent.frameObj.gradientColor;
5564
- }
5565
- }
5566
- parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
5567
- parent.curFrameObjEvent = { currentFrameSetting: args.currentFrameSetting };
5568
- parent.isFrameBtnClick = true;
5569
- }
5570
- });
5571
- }
5572
- else {
5573
- if (!frameChange.cancel) {
5574
- this.setFrameObj(frameChange.currentFrameSetting);
5575
- }
5576
- }
5577
- }
5578
- else {
5579
- parent.trigger('frameChange', frameChange);
5580
- if (!frameChange.cancel) {
5581
- this.setFrameObj(frameChange.currentFrameSetting);
5582
- }
5392
+ parent.trigger('frameChange', frameChange);
5393
+ if (!frameChange.cancel) {
5394
+ this.setFrameObj(frameChange.currentFrameSetting);
5583
5395
  }
5584
5396
  return frameChange;
5585
5397
  }
@@ -5949,17 +5761,7 @@ class Export {
5949
5761
  this.parent.off('destroyed', this.destroy);
5950
5762
  }
5951
5763
  export(args) {
5952
- if (isBlazor()) {
5953
- const obj = { shape: '' };
5954
- this.parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: obj } });
5955
- if (obj['shape'] !== '') {
5956
- this.parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
5957
- this.parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
5958
- }
5959
- }
5960
- else {
5961
- this.parent.notify('toolbar', { prop: 'refreshShapeDrawing', onPropertyChange: false });
5962
- }
5764
+ this.parent.notify('toolbar', { prop: 'refreshShapeDrawing', onPropertyChange: false });
5963
5765
  this.updatePvtVar();
5964
5766
  switch (args.prop) {
5965
5767
  case 'export':
@@ -6012,16 +5814,8 @@ class Export {
6012
5814
  value: { x: null, y: null, isMouseDown: null } });
6013
5815
  const beforeSave = { cancel: false, fileName: fileName ? fileName : imageName,
6014
5816
  fileType: type };
6015
- if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
6016
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6017
- parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then((beforeSave) => {
6018
- this.beforeSaveEvent(beforeSave, type, fileName, imageName);
6019
- });
6020
- }
6021
- else {
6022
- parent.trigger('beforeSave', beforeSave);
6023
- this.beforeSaveEvent(beforeSave, type, fileName, imageName);
6024
- }
5817
+ parent.trigger('beforeSave', beforeSave);
5818
+ this.beforeSaveEvent(beforeSave, type, fileName, imageName);
6025
5819
  }
6026
5820
  }
6027
5821
  beforeSaveEvent(observableSaveArgs, type, fileName, imageName) {
@@ -6039,9 +5833,7 @@ class Export {
6039
5833
  }
6040
5834
  const saved = { fileName: fileName ? fileName : imageName, fileType: type };
6041
5835
  parent.trigger('saved', saved);
6042
- if (!isBlazor()) {
6043
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
6044
- }
5836
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
6045
5837
  parent.lowerCanvas.style.left = parent.upperCanvas.style.left = '';
6046
5838
  parent.lowerCanvas.style.top = parent.upperCanvas.style.top = '';
6047
5839
  parent.lowerCanvas.style.maxWidth = parent.upperCanvas.style.maxWidth = '';
@@ -6111,15 +5903,7 @@ class Export {
6111
5903
  value: { obj: selPointCollObj } });
6112
5904
  if (this.parent.aspectWidth) {
6113
5905
  parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
6114
- if (!isBlazor()) {
6115
- parent.notify('toolbar', { prop: 'resizeClick', value: { bool: false } });
6116
- }
6117
- else {
6118
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6119
- parent.performResizeClick();
6120
- }
6121
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6122
- parent.currentToolbar = 'resize-toolbar';
5906
+ parent.notify('toolbar', { prop: 'resizeClick', value: { bool: false } });
6123
5907
  parent.okBtn();
6124
5908
  if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
6125
5909
  width = this.parent.aspectHeight;
@@ -7687,15 +7471,11 @@ class FreehandDrawing {
7687
7471
  if (selectedPoint.strokeColor === '#42a5f5') {
7688
7472
  selectedPoint.strokeColor = this.tempFHDStyles.strokeColor;
7689
7473
  }
7690
- if (!isBlazor()) {
7691
- parent.notify('toolbar', { prop: 'setSelectedFreehandColor', value: { color: '#42a5f5' } });
7692
- }
7474
+ parent.notify('toolbar', { prop: 'setSelectedFreehandColor', value: { color: '#42a5f5' } });
7693
7475
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
7694
7476
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
7695
7477
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
7696
- if (!isBlazor()) {
7697
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7698
- }
7478
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7699
7479
  if (selectedPoint) {
7700
7480
  selectedPoint.isSelected = false;
7701
7481
  }
@@ -7706,9 +7486,7 @@ class FreehandDrawing {
7706
7486
  const parent = this.parent;
7707
7487
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7708
7488
  const selectedPoint = parent.pointColl[this.fhdSelIdx];
7709
- if (!isBlazor()) {
7710
- parent.notify('toolbar', { prop: 'setSelectedFreehandColor', value: { color: '#42a5f5' } });
7711
- }
7489
+ parent.notify('toolbar', { prop: 'setSelectedFreehandColor', value: { color: '#42a5f5' } });
7712
7490
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
7713
7491
  this.lowerContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
7714
7492
  this.pointCounter = 0;
@@ -7723,12 +7501,7 @@ class FreehandDrawing {
7723
7501
  parent.activeObj.strokeSettings.strokeWidth = this.penStrokeWidth = this.tempFHDStyles.strokeWidth;
7724
7502
  this.tempFHDStyles = { strokeColor: null, strokeWidth: null, fillColor: null };
7725
7503
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
7726
- if (!isBlazor()) {
7727
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7728
- }
7729
- else {
7730
- parent.updateToolbar(parent.element, 'imageLoaded');
7731
- }
7504
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7732
7505
  }
7733
7506
  selectFhd(index) {
7734
7507
  const parent = this.parent;
@@ -7766,10 +7539,6 @@ class FreehandDrawing {
7766
7539
  else {
7767
7540
  parent.okBtn();
7768
7541
  }
7769
- if (isBlazor()) {
7770
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7771
- parent.getShapeValue('pen');
7772
- }
7773
7542
  }
7774
7543
  deleteFhd(index, isId) {
7775
7544
  const parent = this.parent;
@@ -7804,9 +7573,7 @@ class FreehandDrawing {
7804
7573
  this.fhdHovIdx = this.fhdSelIdx = null;
7805
7574
  parent.notify('selection', { prop: 'resetFreehandDrawVariables' });
7806
7575
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
7807
- if (!isBlazor()) {
7808
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7809
- }
7576
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7810
7577
  }
7811
7578
  }
7812
7579
  zoomX(x) {
@@ -8146,24 +7913,14 @@ class FreehandDrawing {
8146
7913
  if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
8147
7914
  parent.activeObj.strokeSettings.strokeWidth = 2;
8148
7915
  }
8149
- if (!isBlazor()) {
8150
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
8151
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
8152
- }
8153
- else {
8154
- parent.updateToolbar(parent.element, 'pen');
8155
- }
7916
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
7917
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
8156
7918
  }
8157
7919
  else {
8158
7920
  parent.upperCanvas.style.cursor = parent.cursor = 'default';
8159
7921
  parent.notify('shape', { prop: 'apply', onPropertyChange: false, value: { shape: null, obj: null, canvas: null } });
8160
- if (!isBlazor()) {
8161
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
8162
- parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
8163
- }
8164
- else {
8165
- parent.updateToolbar(parent.element, 'imageLoaded');
8166
- }
7922
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
7923
+ parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
8167
7924
  parent.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
8168
7925
  }
8169
7926
  }
@@ -8202,48 +7959,22 @@ class FreehandDrawing {
8202
7959
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
8203
7960
  const parent = this.parent;
8204
7961
  const point = parent.pointColl[this.fhdSelIdx];
8205
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
8206
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
8207
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
8208
- this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
8209
- if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
8210
- parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
8211
- const penColorElement = parent.element.querySelector('.e-ie-toolbar-e-pen-color .e-dropdownbtn-preview');
8212
- if (penColorElement) {
8213
- penColorElement.style.background = shapeChangingArgs.currentShapeSettings.strokeColor;
8214
- }
8215
- }
8216
- if (this.fhdSelID) {
8217
- point.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
8218
- point.strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
8219
- point.points = shapeChangingArgs.currentShapeSettings.points;
8220
- point.opacity = shapeChangingArgs.currentShapeSettings.opacity;
8221
- }
8222
- if (shapeChangingArgs.action === 'select') {
8223
- this.freehandRedraw(this.upperContext);
8224
- parent.updateToolbar(parent.element, 'imageLoaded');
8225
- parent.updateToolbar(parent.element, 'pen');
8226
- }
8227
- });
7962
+ parent.trigger('shapeChanging', shapeChangingArgs);
7963
+ this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
7964
+ if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
7965
+ parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7966
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
8228
7967
  }
8229
- else {
8230
- parent.trigger('shapeChanging', shapeChangingArgs);
8231
- this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
8232
- if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
8233
- parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
8234
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
8235
- }
8236
- if (this.fhdSelID) {
8237
- point.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
8238
- point.strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
8239
- point.points = shapeChangingArgs.currentShapeSettings.points;
8240
- point.opacity = shapeChangingArgs.currentShapeSettings.opacity;
8241
- }
8242
- if (shapeChangingArgs.action === 'select') {
8243
- this.freehandRedraw(this.upperContext);
8244
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
8245
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
8246
- }
7968
+ if (this.fhdSelID && point && shapeChangingArgs.currentShapeSettings) {
7969
+ point.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7970
+ point.strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
7971
+ point.points = shapeChangingArgs.currentShapeSettings.points;
7972
+ point.opacity = shapeChangingArgs.currentShapeSettings.opacity;
7973
+ }
7974
+ if (shapeChangingArgs.action === 'select') {
7975
+ this.freehandRedraw(this.upperContext);
7976
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
7977
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
8247
7978
  }
8248
7979
  }
8249
7980
  setCenterSelPoints() {
@@ -8345,7 +8076,7 @@ class Selection {
8345
8076
  this.setActivePoint(args.value['startX'], args.value['startY']);
8346
8077
  break;
8347
8078
  case 'clearSelection':
8348
- this.clearSelection();
8079
+ this.clearSelection(args.value['resetCrop']);
8349
8080
  break;
8350
8081
  case 'calcShapeRatio':
8351
8082
  this.calcShapeRatio(args.value['x'], args.value['y'], args.value['imgWidth'], args.value['imgHeight']);
@@ -9375,15 +9106,7 @@ class Selection {
9375
9106
  if (splitWords !== undefined && splitWords[0] === 'crop') {
9376
9107
  this.isCropSelection = true;
9377
9108
  }
9378
- if (!this.isCropSelection && parent.eventType !== 'resize' && isBlazor() && parent.events && parent.events.onShapeResizeStart.hasDelegate === true) {
9379
- shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-start';
9380
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
9381
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs, null).then((shapeResizingArgs) => {
9382
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9383
- value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
9384
- });
9385
- }
9386
- else if (!this.isCropSelection) {
9109
+ if (!this.isCropSelection) {
9387
9110
  if (this.currentDrawingShape !== '') {
9388
9111
  shapeResizingArgs.action = 'drawing';
9389
9112
  }
@@ -9404,51 +9127,20 @@ class Selection {
9404
9127
  width: shapeResizingArgs.currentShapeSettings.width,
9405
9128
  height: shapeResizingArgs.currentShapeSettings.height } };
9406
9129
  this.selectionResizingArgs = selectionResizingArgs;
9407
- if (isBlazor() && isNullOrUndefined(parent.eventType) && parent.events &&
9408
- parent.events.onSelectionResizeStart.hasDelegate === true) {
9409
- selectionResizingArgs.action = 'resize-start';
9410
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
9411
- parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionResizingArgs).then((selectionResizingArgs) => {
9412
- parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
9413
- value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
9414
- });
9415
- }
9416
- else {
9417
- parent.trigger('selectionChanging', selectionResizingArgs);
9418
- parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
9419
- value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
9420
- }
9130
+ parent.trigger('selectionChanging', selectionResizingArgs);
9131
+ parent.notify('shape', { prop: 'updSelChangeEventArgs', onPropertyChange: false,
9132
+ value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
9421
9133
  }
9422
9134
  }
9423
9135
  else if (type === 'mouse-down' || type === 'mouse-up') {
9424
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
9425
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
9426
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeResizingArgs, null).then((shapeResizingArgs) => {
9427
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9428
- value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
9429
- });
9430
- }
9431
- else {
9432
- parent.trigger('shapeChanging', shapeResizingArgs);
9433
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9434
- value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
9435
- }
9136
+ parent.trigger('shapeChanging', shapeResizingArgs);
9137
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9138
+ value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
9436
9139
  }
9437
9140
  else {
9438
- if (isBlazor() && isNullOrUndefined(parent.eventType) && parent.events &&
9439
- parent.events.onShapeDragStart.hasDelegate === true) {
9440
- shapeMovingArgs.action = 'drag-start';
9441
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
9442
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragStart', shapeMovingArgs, null).then((shapeMovingArgs) => {
9443
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9444
- value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
9445
- });
9446
- }
9447
- else {
9448
- parent.trigger('shapeChanging', shapeMovingArgs);
9449
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9450
- value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
9451
- }
9141
+ parent.trigger('shapeChanging', shapeMovingArgs);
9142
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
9143
+ value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
9452
9144
  }
9453
9145
  parent.eventType = type;
9454
9146
  }
@@ -11040,16 +10732,8 @@ class Selection {
11040
10732
  this.dragCanvas = parent.togglePan = true;
11041
10733
  }
11042
10734
  const imageEditorClickEventArgs = { point: this.setXYPoints(e) };
11043
- if (isBlazor() && parent.events && parent.events.clicked.hasDelegate === true) {
11044
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11045
- parent.dotNetRef.invokeMethodAsync('ClickEventAsync', 'click', imageEditorClickEventArgs).then((imageEditorClickEventArgs) => {
11046
- this.clickEvent(imageEditorClickEventArgs, e);
11047
- });
11048
- }
11049
- else {
11050
- parent.trigger('click', imageEditorClickEventArgs);
11051
- this.clickEvent(imageEditorClickEventArgs, e);
11052
- }
10735
+ parent.trigger('click', imageEditorClickEventArgs);
10736
+ this.clickEvent(imageEditorClickEventArgs, e);
11053
10737
  }
11054
10738
  getImagePoints(x, y) {
11055
10739
  const parent = this.parent;
@@ -11155,13 +10839,8 @@ class Selection {
11155
10839
  }
11156
10840
  }
11157
10841
  if (!isShape && !parent.togglePen && !this.isCropSelection) {
11158
- if (!isBlazor()) {
11159
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
11160
- parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
11161
- }
11162
- else if (parent.isImageLoaded) {
11163
- parent.updateToolbar(parent.element, 'imageLoaded', 'okBtnClick');
11164
- }
10842
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
10843
+ parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
11165
10844
  }
11166
10845
  if (this.dragCanvas && this.isPan && (parent.cursor === 'grab' || this.isTouch)
11167
10846
  && !isShape && !isFreehandDraw && !parent.togglePen) {
@@ -11177,9 +10856,7 @@ class Selection {
11177
10856
  if (this.isFhdEditing) {
11178
10857
  parent.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
11179
10858
  this.isFhdCustomized = false;
11180
- if (!isBlazor()) {
11181
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11182
- }
10859
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11183
10860
  }
11184
10861
  const shape = parent.activeObj.shape;
11185
10862
  const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'text', 'image'];
@@ -11187,13 +10864,8 @@ class Selection {
11187
10864
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
11188
10865
  value: { x: null, y: null, isMouseDown: null } });
11189
10866
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
11190
- if (!isBlazor()) {
11191
- parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
11192
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
11193
- }
11194
- else {
11195
- parent.updateToolbar(parent.element, 'imageLoaded');
11196
- }
10867
+ parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
10868
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
11197
10869
  }
11198
10870
  this.canvasMouseDownHandler(e);
11199
10871
  }
@@ -11242,13 +10914,7 @@ class Selection {
11242
10914
  parent.notify('freehand-draw', { prop: 'selectFhd', value: { type: 'ok' } });
11243
10915
  parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
11244
10916
  value: { strokeColor: null, strokeWidth: null } });
11245
- if (!isBlazor()) {
11246
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
11247
- }
11248
- else {
11249
- parent.updateToolbar(parent.element, 'pen');
11250
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
11251
- }
10917
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
11252
10918
  }
11253
10919
  else if (indexObj['freehandSelectedIndex']) {
11254
10920
  parent.okBtn();
@@ -11269,13 +10935,18 @@ class Selection {
11269
10935
  if (qbArea) {
11270
10936
  qbArea.style.display = 'none';
11271
10937
  }
11272
- }
11273
- if (!isBlazor()) {
11274
- const isPenDraw = parent.togglePen;
11275
- parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
11276
- if (isPenDraw) {
11277
- parent.freehandDraw(true);
11278
- }
10938
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10939
+ const point = parent.pointColl[indexObj['freehandSelectedIndex']];
10940
+ const shapeSettings = { id: 'pen_' + (indexObj['freehandSelectedIndex'] + 1), type: ShapeType.FreehandDraw,
10941
+ startX: point.points[0].x, startY: point.points[0].y, strokeColor: point.strokeColor,
10942
+ strokeWidth: point.strokeWidth, points: point.points, opacity: point.opacity };
10943
+ const shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
10944
+ parent.trigger('shapeChange', shapeChangedArgs);
10945
+ }
10946
+ const isPenDraw = parent.togglePen;
10947
+ parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
10948
+ if (isPenDraw) {
10949
+ parent.freehandDraw(true);
11279
10950
  }
11280
10951
  this.isFhdEditing = false;
11281
10952
  if (isLineArrow) {
@@ -11509,54 +11180,6 @@ class Selection {
11509
11180
  if (splitWords !== undefined && splitWords[0] === 'crop') {
11510
11181
  isCropSelection = true;
11511
11182
  }
11512
- if (isBlazor() && parent.eventType) {
11513
- if (parent.eventType === 'pan') {
11514
- if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
11515
- parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
11516
- }
11517
- }
11518
- else if (parent.eventType === 'resize') {
11519
- if (!this.isCropSelection && parent.events && parent.events.onShapeResizeEnd.hasDelegate === true) {
11520
- this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11521
- this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
11522
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11523
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then((shapeResizingArgs) => {
11524
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11525
- value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
11526
- });
11527
- }
11528
- else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
11529
- parent.events.onSelectionResizeEnd.hasDelegate === true) {
11530
- const currentSelectionSettings = { type: parent.activeObj.shape,
11531
- startX: this.shapeResizingArgs.currentShapeSettings.startX,
11532
- startY: this.shapeResizingArgs.currentShapeSettings.startY,
11533
- width: this.shapeResizingArgs.currentShapeSettings.width,
11534
- height: this.shapeResizingArgs.currentShapeSettings.height };
11535
- this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
11536
- this.selectionResizingArgs.action = 'resize-end';
11537
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11538
- parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then((selectionResizingArgs) => {
11539
- parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
11540
- value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
11541
- });
11542
- }
11543
- }
11544
- else {
11545
- if (this.shapeMovingArgs && parent.events && parent.events.onShapeDragEnd.hasDelegate === true) {
11546
- this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11547
- this.shapeMovingArgs.action = 'drag-end';
11548
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11549
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragEnd', this.shapeMovingArgs, null).then((shapeMovingArgs) => {
11550
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11551
- value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
11552
- });
11553
- }
11554
- }
11555
- this.shapeResizingArgs = null;
11556
- this.shapeMovingArgs = null;
11557
- parent.panEventArgs = null;
11558
- parent.eventType = null;
11559
- }
11560
11183
  if (this.currentDrawingShape === 'path') {
11561
11184
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11562
11185
  const elem = e.srcElement;
@@ -11630,9 +11253,7 @@ class Selection {
11630
11253
  if (!this.isFhdEditing) {
11631
11254
  this.applyCurrActObj(x, y);
11632
11255
  parent.currObjType.isResize = false;
11633
- if (!isBlazor()) {
11634
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11635
- }
11256
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11636
11257
  }
11637
11258
  }
11638
11259
  if (parent.activeObj) {
@@ -11648,37 +11269,26 @@ class Selection {
11648
11269
  isCropSelection = true;
11649
11270
  }
11650
11271
  const shape = parent.activeObj.shape;
11651
- if (!isBlazor()) {
11652
- const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
11653
- if (shapeColl.indexOf(shape) > -1) {
11654
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11655
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11656
- }
11657
- else if (shape === 'text') {
11658
- if (parent.textArea.style.display === 'none') {
11659
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11660
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11661
- }
11662
- }
11663
- else if (this.isFhdEditing) {
11664
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
11272
+ const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
11273
+ if (shapeColl.indexOf(shape) > -1) {
11274
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11275
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11276
+ }
11277
+ else if (shape === 'text') {
11278
+ if (parent.textArea.style.display === 'none') {
11279
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11665
11280
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11666
11281
  }
11667
- else if (!isCropSelection) {
11668
- const eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
11669
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
11670
- }
11671
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11672
11282
  }
11673
- else {
11674
- const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image'];
11675
- if (shapeColl.indexOf(shape) > -1) {
11676
- parent.updateToolbar(parent.element, parent.activeObj.shape);
11677
- }
11678
- else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
11679
- parent.updateToolbar(parent.element, 'text');
11680
- }
11283
+ else if (this.isFhdEditing) {
11284
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
11285
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11286
+ }
11287
+ else if (!isCropSelection) {
11288
+ const eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
11289
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
11681
11290
  }
11291
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11682
11292
  }
11683
11293
  }
11684
11294
  if (parent.activeObj.shape !== undefined) {
@@ -11690,24 +11300,15 @@ class Selection {
11690
11300
  if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
11691
11301
  parent.textArea.style.display === 'none') {
11692
11302
  if (parent.activeObj.shape === 'text') {
11693
- if (!isBlazor()) {
11694
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11695
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11696
- }
11303
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11304
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11697
11305
  }
11698
11306
  else {
11699
- if (!isBlazor()) {
11700
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11701
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11702
- }
11703
- }
11704
- if (!isBlazor()) {
11705
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11706
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11707
- }
11708
- else {
11709
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
11307
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11308
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11710
11309
  }
11310
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11311
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11711
11312
  }
11712
11313
  if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
11713
11314
  parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
@@ -12139,16 +11740,8 @@ class Selection {
12139
11740
  const beforeSave = { fileName: obj['fileName'], fileType: obj['fileType'], cancel: false };
12140
11741
  switch (e.key) {
12141
11742
  case (e.ctrlKey && 's'):
12142
- if (isBlazor() && parent.events && parent.events.saving.hasDelegate === true) {
12143
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12144
- parent.dotNetRef.invokeMethodAsync('BeforeSaveEventAsync', 'BeforeSave', beforeSave).then((args) => {
12145
- this.beforeSaveEvent(args, e);
12146
- });
12147
- }
12148
- else {
12149
- parent.trigger('beforeSave', beforeSave);
12150
- this.beforeSaveEvent(beforeSave, e);
12151
- }
11743
+ parent.trigger('beforeSave', beforeSave);
11744
+ this.beforeSaveEvent(beforeSave, e);
12152
11745
  break;
12153
11746
  case (e.ctrlKey && 'z'):
12154
11747
  if (parent.allowUndoRedo) {
@@ -12229,37 +11822,21 @@ class Selection {
12229
11822
  parent.notify('transform', { prop: 'resize', value: { width: point.x, height: point.y, isAspectRatio: false } });
12230
11823
  }
12231
11824
  }
12232
- if (isBlazor()) {
12233
- const aspectRatioHeight = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-textbox');
12234
- const aspectRatioWidth = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-textbox');
12235
- if ((blrAspRatElem && blrAspRatElem.classList.contains('e-hidden'))) {
12236
- if (aspectRatioHeight && aspectRatioHeight.value === "") {
12237
- aspectRatioHeight.value = aspectRatioHeight.placeholder;
12238
- aspectRatioHeight.value = aspectRatioHeight.placeholder;
12239
- }
12240
- if (aspectRatioWidth && aspectRatioWidth.value === "") {
12241
- aspectRatioWidth.value = aspectRatioWidth.placeholder;
12242
- aspectRatioWidth.value = aspectRatioWidth.placeholder;
11825
+ const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
11826
+ const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
11827
+ if (isNullOrUndefined(aspectRatioElement)) {
11828
+ if (aspectRatioHeight) {
11829
+ const elem = getComponent(aspectRatioHeight, 'numerictextbox');
11830
+ if (aspectRatioHeight && aspectRatioHeight.value === '') {
11831
+ elem.value = parseFloat(elem.placeholder);
11832
+ aspectRatioHeight.value = elem.placeholder + 'px';
12243
11833
  }
12244
11834
  }
12245
- }
12246
- else {
12247
- const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
12248
- const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
12249
- if (isNullOrUndefined(aspectRatioElement)) {
12250
- if (aspectRatioHeight) {
12251
- const elem = getComponent(aspectRatioHeight, 'numerictextbox');
12252
- if (aspectRatioHeight && aspectRatioHeight.value === '') {
12253
- elem.value = parseFloat(elem.placeholder);
12254
- aspectRatioHeight.value = elem.placeholder + 'px';
12255
- }
12256
- }
12257
- if (aspectRatioWidth) {
12258
- const elem = getComponent(aspectRatioWidth, 'numerictextbox');
12259
- if (aspectRatioWidth && aspectRatioWidth.value === '') {
12260
- elem.value = parseFloat(elem.placeholder);
12261
- aspectRatioWidth.value = elem.placeholder + 'px';
12262
- }
11835
+ if (aspectRatioWidth) {
11836
+ const elem = getComponent(aspectRatioWidth, 'numerictextbox');
11837
+ if (aspectRatioWidth && aspectRatioWidth.value === '') {
11838
+ elem.value = parseFloat(elem.placeholder);
11839
+ aspectRatioWidth.value = elem.placeholder + 'px';
12263
11840
  }
12264
11841
  }
12265
11842
  }
@@ -12280,7 +11857,7 @@ class Selection {
12280
11857
  let bool = false;
12281
11858
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12282
11859
  const target = e.target;
12283
- if ((target.id === this.parent.element.id + '_ok' || target.id === '') && !isBlazor()) {
11860
+ if (target.id === this.parent.element.id + '_ok' || target.id === '') {
12284
11861
  bool = true;
12285
11862
  }
12286
11863
  return bool;
@@ -12316,9 +11893,7 @@ class Selection {
12316
11893
  e.preventDefault();
12317
11894
  if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
12318
11895
  parent.okBtn();
12319
- if (!isBlazor()) {
12320
- parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
12321
- }
11896
+ parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
12322
11897
  }
12323
11898
  let type = '';
12324
11899
  if (e.type === 'mousewheel' && (parent.zoomSettings.zoomTrigger & ZoomTrigger.MouseWheel) === ZoomTrigger.MouseWheel) {
@@ -12366,18 +11941,23 @@ class Selection {
12366
11941
  parent.textArea.setAttribute('rows', this.textRow.toString());
12367
11942
  this.isInitialTextEdited = false;
12368
11943
  }
12369
- clearSelection() {
11944
+ clearSelection(resetCrop) {
12370
11945
  const parent = this.parent;
12371
11946
  if (!parent.disabled && parent.isImageLoaded) {
12372
- parent.togglePen = false;
12373
- parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
12374
- this.dragElement = '';
12375
- this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
12376
- parent.currObjType.shape = '';
12377
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
12378
- parent.currObjType.isActiveObj = true;
12379
- parent.currObjType.isCustomCrop = false;
12380
- parent.upperCanvas.style.cursor = parent.cursor = 'default';
11947
+ if (resetCrop) {
11948
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
11949
+ }
11950
+ else {
11951
+ parent.togglePen = false;
11952
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
11953
+ this.dragElement = '';
11954
+ this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
11955
+ parent.currObjType.shape = '';
11956
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
11957
+ parent.currObjType.isActiveObj = true;
11958
+ parent.currObjType.isCustomCrop = false;
11959
+ parent.upperCanvas.style.cursor = parent.cursor = 'default';
11960
+ }
12381
11961
  }
12382
11962
  }
12383
11963
  setDragDirection(width, height) {
@@ -12686,14 +12266,7 @@ class Selection {
12686
12266
  if (splitWords !== undefined && splitWords[0] === 'crop') {
12687
12267
  this.isCropSelection = true;
12688
12268
  }
12689
- if (!this.isCropSelection && isBlazor() && isNullOrUndefined(parent.eventType) &&
12690
- parent.events && parent.events.shapeChanging.hasDelegate === true) {
12691
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12692
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
12693
- this.shapeEvent(shapeChangingArgs);
12694
- });
12695
- }
12696
- else if (!this.isCropSelection) {
12269
+ if (!this.isCropSelection) {
12697
12270
  parent.trigger('shapeChanging', shapeChangingArgs);
12698
12271
  this.shapeEvent(shapeChangingArgs);
12699
12272
  }
@@ -12709,36 +12282,14 @@ class Selection {
12709
12282
  startY: shapeChangingArgs.currentShapeSettings.startY,
12710
12283
  width: shapeChangingArgs.currentShapeSettings.width,
12711
12284
  height: shapeChangingArgs.currentShapeSettings.height } };
12712
- if (isBlazor() && parent.events && parent.events.onSelectionResizeStart.hasDelegate === true) {
12713
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12714
- parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeStart', selectionChangingArgs).then((selectionChangingArgs) => {
12715
- shapeChangingArgs.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
12716
- shapeChangingArgs.currentShapeSettings.startY = selectionChangingArgs.currentSelectionSettings.startY;
12717
- shapeChangingArgs.currentShapeSettings.width = selectionChangingArgs.currentSelectionSettings.width;
12718
- shapeChangingArgs.currentShapeSettings.height = selectionChangingArgs.currentSelectionSettings.height;
12719
- this.shapeEvent(shapeChangingArgs);
12720
- });
12721
- }
12722
- else {
12723
- parent.trigger('selectionChanging', selectionChangingArgs);
12724
- shapeChangingArgs.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
12725
- shapeChangingArgs.currentShapeSettings.startY = selectionChangingArgs.currentSelectionSettings.startY;
12726
- shapeChangingArgs.currentShapeSettings.width = selectionChangingArgs.currentSelectionSettings.width;
12727
- shapeChangingArgs.currentShapeSettings.height = selectionChangingArgs.currentSelectionSettings.height;
12728
- this.shapeEvent(shapeChangingArgs);
12729
- }
12285
+ parent.trigger('selectionChanging', selectionChangingArgs);
12286
+ shapeChangingArgs.currentShapeSettings.startX = selectionChangingArgs.currentSelectionSettings.startX;
12287
+ shapeChangingArgs.currentShapeSettings.startY = selectionChangingArgs.currentSelectionSettings.startY;
12288
+ shapeChangingArgs.currentShapeSettings.width = selectionChangingArgs.currentSelectionSettings.width;
12289
+ shapeChangingArgs.currentShapeSettings.height = selectionChangingArgs.currentSelectionSettings.height;
12290
+ this.shapeEvent(shapeChangingArgs);
12730
12291
  }
12731
12292
  isShape = true;
12732
- if (isBlazor()) {
12733
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12734
- const tempCursor = parent.upperCanvas.style.cursor;
12735
- this.setCursor(x, y);
12736
- if (shapeChangingArgs.action === 'select' && parent.upperCanvas.style.cursor === 'move') {
12737
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12738
- parent.getShapeValue(parent.activeObj.shape);
12739
- }
12740
- parent.upperCanvas.style.cursor = tempCursor;
12741
- }
12742
12293
  }
12743
12294
  }
12744
12295
  return isShape;
@@ -12959,9 +12510,7 @@ class Selection {
12959
12510
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
12960
12511
  }
12961
12512
  }
12962
- if (!isBlazor()) {
12963
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
12964
- }
12513
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
12965
12514
  }
12966
12515
  }
12967
12516
  getCurrentFlipState() {
@@ -13068,12 +12617,7 @@ class Selection {
13068
12617
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
13069
12618
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
13070
12619
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
13071
- if (!isBlazor()) {
13072
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13073
- }
13074
- else {
13075
- parent.updateToolbar(parent.element, 'imageLoaded');
13076
- }
12620
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13077
12621
  }
13078
12622
  else if (parent.activeObj.shape) {
13079
12623
  parent.objColl.push(parent.activeObj);
@@ -13093,15 +12637,8 @@ class Selection {
13093
12637
  shapeChangingArgs = { cancel: false, action: 'delete', previousShapeSettings: previousShapeSettings, currentShapeSettings: null };
13094
12638
  parent.notify('shape', { prop: 'setKeyHistory', onPropertyChange: false, value: { keyHistory: '' } });
13095
12639
  parent.clearSelection();
13096
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
13097
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null);
13098
- }
13099
- else {
13100
- parent.trigger('shapeChanging', shapeChangingArgs);
13101
- if (!isBlazor()) {
13102
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13103
- }
13104
- }
12640
+ parent.trigger('shapeChanging', shapeChangingArgs);
12641
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
13105
12642
  if (!isNullOrUndefined(prevObj.objColl[prevObj.objColl.length - 1].currIndex)) {
13106
12643
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13107
12644
  value: { operation: 'deleteObj', previousObj: prevObj, previousObjColl: this.tempObjColl,
@@ -13131,6 +12668,11 @@ class Selection {
13131
12668
  updatePrevShapeSettings(obj) {
13132
12669
  const parent = this.parent;
13133
12670
  const fontStyle = [];
12671
+ if (isNullOrUndefined(parent.activeObj.currIndex)) {
12672
+ const shapeIDObj = { id: 'shape_' + (parent.objColl.length + 1) };
12673
+ parent.notify('shape', { prop: 'getNewShapeId', onPropertyChange: false, value: { obj: shapeIDObj } });
12674
+ parent.activeObj.currIndex = shapeIDObj['id'];
12675
+ }
13134
12676
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
13135
12677
  if (parent.activeObj.textSettings.bold) {
13136
12678
  fontStyle.push('bold');
@@ -13262,14 +12804,8 @@ class Selection {
13262
12804
  let width;
13263
12805
  let widthElement;
13264
12806
  let heightElement;
13265
- if (isBlazor()) {
13266
- widthElement = elem.querySelector('.e-ie-toolbar-e-resize-width-input .e-textbox');
13267
- heightElement = elem.querySelector('.e-ie-toolbar-e-resize-height-input .e-textbox');
13268
- }
13269
- else {
13270
- widthElement = elem.querySelector('#' + elem.id + '_resizeWidth');
13271
- heightElement = elem.querySelector('#' + elem.id + '_resizeHeight');
13272
- }
12807
+ widthElement = elem.querySelector('#' + elem.id + '_resizeWidth');
12808
+ heightElement = elem.querySelector('#' + elem.id + '_resizeHeight');
13273
12809
  if (widthElement && heightElement) {
13274
12810
  let heightString = heightElement.value.replace(/,/g, '');
13275
12811
  let widthString = widthElement.value.replace(/,/g, '');
@@ -13292,14 +12828,8 @@ class Selection {
13292
12828
  let isValue = true;
13293
12829
  let widthElement;
13294
12830
  let heightElement;
13295
- if (!isBlazor()) {
13296
- widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
13297
- heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
13298
- }
13299
- else {
13300
- widthElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-textbox');
13301
- heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-textbox');
13302
- }
12831
+ widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
12832
+ heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
13303
12833
  if (widthElement && heightElement) {
13304
12834
  if (heightElement.value.replace(/,/g, '') === '' && widthElement.value.replace(/,/g, '') === '') {
13305
12835
  isValue = false;
@@ -13337,22 +12867,22 @@ class Shape {
13337
12867
  let uploader;
13338
12868
  switch (args.prop) {
13339
12869
  case 'drawEllipse':
13340
- this.drawEllipse(args.value['x'], args.value['y'], args.value['radiusX'], args.value['radiusY'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree']);
12870
+ this.drawEllipse(args.value['x'], args.value['y'], args.value['radiusX'], args.value['radiusY'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree'], args.value['isSelected']);
13341
12871
  break;
13342
12872
  case 'drawLine':
13343
- this.drawLine(args.value['startX'], args.value['startY'], args.value['endX'], args.value['endY'], args.value['strokeWidth'], args.value['strokeColor']);
12873
+ this.drawLine(args.value['startX'], args.value['startY'], args.value['endX'], args.value['endY'], args.value['strokeWidth'], args.value['strokeColor'], args.value['isSelected']);
13344
12874
  break;
13345
12875
  case 'drawArrow':
13346
- this.drawArrow(args.value['startX'], args.value['startY'], args.value['endX'], args.value['endY'], args.value['strokeWidth'], args.value['strokeColor'], args.value['arrowStart'], args.value['arrowEnd']);
12876
+ this.drawArrow(args.value['startX'], args.value['startY'], args.value['endX'], args.value['endY'], args.value['strokeWidth'], args.value['strokeColor'], args.value['arrowStart'], args.value['arrowEnd'], args.value['isSelected']);
13347
12877
  break;
13348
12878
  case 'drawPath':
13349
- this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
12879
+ this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor'], args.value['isSelected']);
13350
12880
  break;
13351
12881
  case 'drawRectangle':
13352
- this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree']);
12882
+ this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree'], args.value['isSelected']);
13353
12883
  break;
13354
12884
  case 'drawText':
13355
- this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color']);
12885
+ this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected']);
13356
12886
  break;
13357
12887
  case 'redrawActObj':
13358
12888
  this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
@@ -13526,7 +13056,7 @@ class Shape {
13526
13056
  this.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
13527
13057
  break;
13528
13058
  case 'drawImage':
13529
- this.drawImage(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['src'], args.value['degree'], args.value['isAspectRatio'], args.value['opacity']);
13059
+ this.drawImage(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['src'], args.value['degree'], args.value['isAspectRatio'], args.value['opacity'], args.value['isSelected']);
13530
13060
  break;
13531
13061
  case 'reset':
13532
13062
  this.reset();
@@ -13588,26 +13118,26 @@ class Shape {
13588
13118
  { text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
13589
13119
  this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
13590
13120
  }
13591
- drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
13121
+ drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
13592
13122
  this.initializeShape('ellipse');
13593
13123
  const start = x && y ? { x: x, y: y } : null;
13594
- this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
13124
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree, null, isSelected);
13595
13125
  }
13596
- drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
13126
+ drawLine(startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
13597
13127
  this.initializeShape('line');
13598
13128
  const start = startX && startY ? { x: startX, y: startY } : null;
13599
13129
  const width = endX - startX;
13600
13130
  const height = endY - startY;
13601
- this.drawShape('line', strokeWidth, strokeColor, null, start, width, height);
13131
+ this.drawShape('line', strokeWidth, strokeColor, null, start, width, height, null, null, null, null, null, isSelected);
13602
13132
  }
13603
- drawPath(pointColl, strokeWidth, strokeColor) {
13133
+ drawPath(pointColl, strokeWidth, strokeColor, isSelected) {
13604
13134
  const parent = this.parent;
13605
13135
  this.initializeShape('path');
13606
13136
  if (pointColl) {
13607
- this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl);
13137
+ this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl, null, null, null, null, isSelected);
13608
13138
  }
13609
13139
  else {
13610
- this.drawShape('line', strokeWidth, strokeColor);
13140
+ this.drawShape('line', strokeWidth, strokeColor, null, null, null, null, null, null, null, null, null, isSelected);
13611
13141
  const obj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
13612
13142
  obj.shape = 'path';
13613
13143
  obj.lineDraw = null;
@@ -13616,20 +13146,20 @@ class Shape {
13616
13146
  parent.objColl[parent.objColl.length - 1] = obj;
13617
13147
  }
13618
13148
  }
13619
- drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
13149
+ drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
13620
13150
  this.initializeShape('arrow');
13621
13151
  const start = startX && startY ? { x: startX, y: startY } : null;
13622
13152
  const width = endX - startX;
13623
13153
  const height = endY - startY;
13624
- this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
13154
+ this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd, null, null, isSelected);
13625
13155
  }
13626
- drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
13156
+ drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
13627
13157
  this.initializeShape('rectangle');
13628
13158
  const start = x && y ? { x: x, y: y } : null;
13629
- this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
13159
+ this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree, null, isSelected);
13630
13160
  }
13631
- drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
13632
- this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
13161
+ drawText(x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
13162
+ this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected);
13633
13163
  }
13634
13164
  initializeShape(type) {
13635
13165
  const parent = this.parent;
@@ -13667,7 +13197,7 @@ class Shape {
13667
13197
  }
13668
13198
  return arrowType;
13669
13199
  }
13670
- drawShape(type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree, opacity) {
13200
+ drawShape(type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree, opacity, isSelected) {
13671
13201
  const parent = this.parent;
13672
13202
  if (!parent.disabled && parent.isImageLoaded) {
13673
13203
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
@@ -13683,11 +13213,9 @@ class Shape {
13683
13213
  parent.activeObj.pointColl = [];
13684
13214
  parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
13685
13215
  parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: 'path' } });
13686
- if (!isBlazor()) {
13687
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
13688
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13689
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13690
- }
13216
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
13217
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13218
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13691
13219
  }
13692
13220
  else {
13693
13221
  if (type !== 'freehanddraw' && type !== '') {
@@ -13745,50 +13273,24 @@ class Shape {
13745
13273
  const shapeSettings = obj['shapeSettingsObj'];
13746
13274
  const shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
13747
13275
  currentShapeSettings: shapeSettings };
13748
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
13749
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
13750
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
13751
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
13752
- this.setDimension(width, height);
13753
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
13754
- if (degree) {
13755
- parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
13756
- parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
13757
- }
13758
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
13759
- parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13760
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
13761
- if (parent.isPublicMethod) {
13762
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13763
- }
13764
- parent.isPublicMethod = false;
13765
- });
13276
+ parent.trigger('shapeChanging', shapeChangingArgs);
13277
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
13278
+ this.setDimension(width, height);
13279
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
13280
+ if (degree) {
13281
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
13282
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
13766
13283
  }
13767
- else {
13768
- parent.trigger('shapeChanging', shapeChangingArgs);
13769
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
13770
- this.setDimension(width, height);
13771
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
13772
- if (degree) {
13773
- parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
13774
- parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
13775
- }
13776
- if (!isBlazor()) {
13777
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
13778
- }
13779
- else {
13780
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
13781
- }
13782
- parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13783
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
13784
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
13785
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13786
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13787
- if (parent.isPublicMethod) {
13788
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13789
- }
13790
- parent.isPublicMethod = false;
13284
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
13285
+ parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13286
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
13287
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
13288
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13289
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13290
+ if (parent.isPublicMethod && !isSelected) {
13291
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13791
13292
  }
13293
+ parent.isPublicMethod = false;
13792
13294
  }
13793
13295
  }
13794
13296
  }
@@ -13829,7 +13331,7 @@ class Shape {
13829
13331
  value: { obj: selPointCollObj } });
13830
13332
  this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
13831
13333
  }
13832
- drawShapeText(text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
13334
+ drawShapeText(text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected) {
13833
13335
  const parent = this.parent;
13834
13336
  if (!parent.disabled && parent.isImageLoaded) {
13835
13337
  if (parent.currObjType.shape === 'freehanddraw') {
@@ -13877,24 +13379,12 @@ class Shape {
13877
13379
  const shapeSettings = obj['shapeSettingsObj'];
13878
13380
  const shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
13879
13381
  currentShapeSettings: shapeSettings };
13880
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
13881
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
13882
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
13883
- this.drawShapeTextEvent(shapeChangingArgs);
13884
- if (parent.isPublicMethod) {
13885
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13886
- }
13887
- parent.isPublicMethod = false;
13888
- });
13889
- }
13890
- else {
13891
- parent.trigger('shapeChanging', shapeChangingArgs);
13892
- this.drawShapeTextEvent(shapeChangingArgs);
13893
- if (parent.isPublicMethod) {
13894
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13895
- }
13896
- parent.isPublicMethod = false;
13382
+ parent.trigger('shapeChanging', shapeChangingArgs);
13383
+ this.drawShapeTextEvent(shapeChangingArgs);
13384
+ if (parent.isPublicMethod && !isSelected) {
13385
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13897
13386
  }
13387
+ parent.isPublicMethod = false;
13898
13388
  }
13899
13389
  }
13900
13390
  drawShapeImageEvent(shapeChangingArgs, isSelect) {
@@ -13910,16 +13400,10 @@ class Shape {
13910
13400
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
13911
13401
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
13912
13402
  if (isSelect) {
13913
- if (!isBlazor()) {
13914
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
13915
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13916
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13917
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
13918
- }
13919
- else {
13920
- parent.updateToolbar(parent.element, parent.activeObj.shape);
13921
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
13922
- }
13403
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
13404
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13405
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13406
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
13923
13407
  }
13924
13408
  else {
13925
13409
  parent.okBtn();
@@ -13940,22 +13424,11 @@ class Shape {
13940
13424
  previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13941
13425
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
13942
13426
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
13943
- if (isBlazor()) {
13944
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'text');
13945
- }
13946
- else {
13947
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
13948
- }
13427
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
13949
13428
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13950
- if (isBlazor()) {
13951
- parent.updateToolbar(parent.element, 'text');
13952
- parent.getFontSizes();
13953
- }
13954
- else {
13955
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
13956
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13957
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13958
- }
13429
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
13430
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13431
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13959
13432
  }
13960
13433
  initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor) {
13961
13434
  const parent = this.parent;
@@ -13974,9 +13447,9 @@ class Shape {
13974
13447
  parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
13975
13448
  parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
13976
13449
  }
13977
- drawImage(x, y, width, height, src, degree, isAspectRatio, opacity) {
13450
+ drawImage(x, y, width, height, src, degree, isAspectRatio, opacity, isSelected) {
13978
13451
  this.initializeShape('image');
13979
- this.onLoadImgShape(x, y, width, height, src, null, degree, isAspectRatio, opacity);
13452
+ this.onLoadImgShape(x, y, width, height, src, null, degree, isAspectRatio, opacity, isSelected);
13980
13453
  }
13981
13454
  redrawActObj(x, y, isMouseDown) {
13982
13455
  let splitWords;
@@ -14107,15 +13580,10 @@ class Shape {
14107
13580
  }
14108
13581
  switch (parent.activeObj.shape) {
14109
13582
  case 'ellipse':
14110
- if (isBlazor()) {
14111
- parent.activeObj.activePoint.width = shapeSettings.radius;
14112
- }
14113
- else {
14114
- parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
14115
- parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
14116
- parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
14117
- parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14118
- }
13583
+ parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
13584
+ parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
13585
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
13586
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14119
13587
  if (shapeSettings.degree) {
14120
13588
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14121
13589
  }
@@ -14123,15 +13591,13 @@ class Shape {
14123
13591
  case 'line':
14124
13592
  case 'arrow':
14125
13593
  parent.activeObj.activePoint.width = shapeSettings.length;
14126
- if (!isBlazor()) {
14127
- parent.activeObj.activePoint.endX = shapeSettings.endX;
14128
- parent.activeObj.activePoint.endY = shapeSettings.endY;
14129
- parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
14130
- parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14131
- if (parent.activeObj.shape === 'arrow') {
14132
- parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
14133
- parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
14134
- }
13594
+ parent.activeObj.activePoint.endX = shapeSettings.endX;
13595
+ parent.activeObj.activePoint.endY = shapeSettings.endY;
13596
+ parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
13597
+ parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
13598
+ if (parent.activeObj.shape === 'arrow') {
13599
+ parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
13600
+ parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
14135
13601
  }
14136
13602
  break;
14137
13603
  case 'text':
@@ -14155,6 +13621,9 @@ class Shape {
14155
13621
  break;
14156
13622
  }
14157
13623
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
13624
+ parent.activeObj.textSettings.bold = false;
13625
+ parent.activeObj.textSettings.italic = false;
13626
+ parent.activeObj.textSettings.underline = false;
14158
13627
  for (let i = 0; i < shapeSettings.fontStyle.length; i++) {
14159
13628
  switch (shapeSettings.fontStyle[i]) {
14160
13629
  case 'bold':
@@ -14873,12 +14342,7 @@ class Shape {
14873
14342
  const parent = this.parent;
14874
14343
  const degree = this.getRotDegOfShape(parent.activeObj);
14875
14344
  this.transformTextArea();
14876
- if (isBlazor()) {
14877
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
14878
- }
14879
- else {
14880
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
14881
- }
14345
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
14882
14346
  const dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
14883
14347
  const removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
14884
14348
  const editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
@@ -15191,12 +14655,7 @@ class Shape {
15191
14655
  if (parent.objColl[parent.objColl.length - 1]) {
15192
14656
  parent.selectShape(parent.objColl[parent.objColl.length - 1].currIndex);
15193
14657
  }
15194
- if (!isBlazor()) {
15195
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
15196
- }
15197
- else {
15198
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
15199
- }
14658
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
15200
14659
  const obj = { shapeSettingsObj: {} };
15201
14660
  parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
15202
14661
  const shapeSettings = obj['shapeSettingsObj'];
@@ -15242,16 +14701,11 @@ class Shape {
15242
14701
  parent.notify('selection', { prop: 'setTouchEndPoint', onPropertyChange: false,
15243
14702
  value: { x: e.touches[0].clientX, y: e.touches[0].clientY } });
15244
14703
  }
15245
- if (!isBlazor()) {
15246
- parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: true } });
15247
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
15248
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
15249
- parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: false } });
15250
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
15251
- }
15252
- else {
15253
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn', 'textAreaClicked');
15254
- }
14704
+ parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: true } });
14705
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
14706
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
14707
+ parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: false } });
14708
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
15255
14709
  if (!isNullOrUndefined(x) && !isNullOrUndefined(y)) {
15256
14710
  const bbox = parent.lowerCanvas.getBoundingClientRect();
15257
14711
  x -= bbox.left;
@@ -15441,11 +14895,9 @@ class Shape {
15441
14895
  const URL = window.URL;
15442
14896
  const url = URL.createObjectURL(e.target.files[0]);
15443
14897
  this.onLoadImgShape(null, null, null, null, url.toString(), true);
15444
- if (!isBlazor()) {
15445
- document.getElementById(this.parent.element.id + '_fileUpload').value = '';
15446
- }
14898
+ document.getElementById(this.parent.element.id + '_fileUpload').value = '';
15447
14899
  }
15448
- onLoadImgShape(x, y, width, height, url, isSelect, degree, isAspectRatio, opacity) {
14900
+ onLoadImgShape(x, y, width, height, url, isSelect, degree, isAspectRatio, opacity, isSelected) {
15449
14901
  // eslint-disable-next-line @typescript-eslint/no-this-alias
15450
14902
  const proxy = this;
15451
14903
  const parent = this.parent;
@@ -15463,10 +14915,10 @@ class Shape {
15463
14915
  this.initShapeProps();
15464
14916
  this.shapeImg.onload = () => {
15465
14917
  proxy.upperContext.drawImage(proxy.shapeImg, 0, 0, proxy.shapeImg.width, proxy.shapeImg.height);
15466
- proxy.updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity);
14918
+ proxy.updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity, isSelected);
15467
14919
  };
15468
14920
  }
15469
- updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity) {
14921
+ updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity, isSelected) {
15470
14922
  const parent = this.parent;
15471
14923
  parent.activeObj.imageElement = this.shapeImg;
15472
14924
  parent.activeObj.imageCanvas = parent.createElement('canvas');
@@ -15515,24 +14967,12 @@ class Shape {
15515
14967
  const shapeSettings = obj['shapeSettingsObj'];
15516
14968
  const shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
15517
14969
  currentShapeSettings: shapeSettings };
15518
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
15519
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
15520
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then((shapeChangingArgs) => {
15521
- this.drawShapeImageEvent(shapeChangingArgs, isSelect);
15522
- if (parent.isPublicMethod) {
15523
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
15524
- }
15525
- parent.isPublicMethod = false;
15526
- });
15527
- }
15528
- else {
15529
- parent.trigger('shapeChanging', shapeChangingArgs);
15530
- this.drawShapeImageEvent(shapeChangingArgs, isSelect);
15531
- if (parent.isPublicMethod) {
15532
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
15533
- }
15534
- parent.isPublicMethod = false;
14970
+ parent.trigger('shapeChanging', shapeChangingArgs);
14971
+ this.drawShapeImageEvent(shapeChangingArgs, isSelect);
14972
+ if (parent.isPublicMethod && !isSelected) {
14973
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
15535
14974
  }
14975
+ parent.isPublicMethod = false;
15536
14976
  }
15537
14977
  updateObj(dimObj, x, y) {
15538
14978
  const parent = this.parent;
@@ -15839,7 +15279,7 @@ class Shape {
15839
15279
  }
15840
15280
  const shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
15841
15281
  shapeChangedArgs.currentShapeSettings.fontStyle = [item];
15842
- parent.triggerShapeChanged(shapeChangedArgs);
15282
+ parent.trigger('shapeChange', shapeChangedArgs);
15843
15283
  }
15844
15284
  updateFontStyle(item, objColl, fontWeight, fontStyle) {
15845
15285
  const parent = this.parent;
@@ -16064,12 +15504,7 @@ class Shape {
16064
15504
  parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
16065
15505
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
16066
15506
  }
16067
- if (!isBlazor()) {
16068
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
16069
- }
16070
- else {
16071
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
16072
- }
15507
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
16073
15508
  if (isNullOrUndefined(isMouseDown)) {
16074
15509
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
16075
15510
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
@@ -16235,13 +15670,6 @@ class Shape {
16235
15670
  shapeDetails.height = obj.activePoint.height;
16236
15671
  shapeDetails.opacity = obj.opacity;
16237
15672
  break;
16238
- case 'image':
16239
- shapeDetails.imageData = obj.imageCanvas.toDataURL();
16240
- shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16241
- shapeDetails.width = obj.activePoint.width;
16242
- shapeDetails.height = obj.activePoint.height;
16243
- shapeDetails.opacity = obj.opacity;
16244
- break;
16245
15673
  }
16246
15674
  return shapeDetails;
16247
15675
  }
@@ -16259,7 +15687,12 @@ class Shape {
16259
15687
  const parent = this.parent;
16260
15688
  let shapeDetails;
16261
15689
  if (!parent.disabled && parent.isImageLoaded) {
16262
- this.applyActObj();
15690
+ if (parent.textArea.style.display !== 'none') {
15691
+ parent.okBtn();
15692
+ }
15693
+ else {
15694
+ this.applyActObj(true);
15695
+ }
16263
15696
  if (id.split('_')[0] === 'shape') {
16264
15697
  let obj;
16265
15698
  for (let i = 0, len = parent.objColl.length; i < len; i++) {
@@ -16280,7 +15713,12 @@ class Shape {
16280
15713
  const parent = this.parent;
16281
15714
  const shapeDetailsColl = [];
16282
15715
  if (!parent.disabled && parent.isImageLoaded) {
16283
- this.applyActObj();
15716
+ if (parent.textArea.style.display !== 'none') {
15717
+ parent.okBtn();
15718
+ }
15719
+ else {
15720
+ this.applyActObj(true);
15721
+ }
16284
15722
  for (let i = 0, len = parent.objColl.length; i < len; i++) {
16285
15723
  const shapeDetails = this.getObjDetails(parent.objColl[i]);
16286
15724
  shapeDetailsColl.push(shapeDetails);
@@ -16430,31 +15868,20 @@ class Shape {
16430
15868
  this.lowerContext.filter = object['canvasFilter'];
16431
15869
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
16432
15870
  value: { obj: parent.activeObj } });
16433
- if (!isBlazor()) {
16434
- if (parent.activeObj.shape === 'text') {
16435
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
16436
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16437
- }
16438
- else if (parent.activeObj.shape === 'pen') {
16439
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
16440
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16441
- }
16442
- else {
16443
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
16444
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16445
- }
16446
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
16447
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
15871
+ if (parent.activeObj.shape === 'text') {
15872
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
15873
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
15874
+ }
15875
+ else if (parent.activeObj.shape === 'pen') {
15876
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
15877
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16448
15878
  }
16449
15879
  else {
16450
- parent.updateToolbar(parent.element, parent.activeObj.shape);
16451
- if (parent.activeObj.shape === 'path') {
16452
- parent.updateToolbar(parent.element, 'path', 'pathQuickAccessToolbar');
16453
- }
16454
- else {
16455
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
16456
- }
15880
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
15881
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16457
15882
  }
15883
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
15884
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
16458
15885
  }
16459
15886
  }
16460
15887
  else if (id.split('_')[0] === 'pen') {
@@ -16468,14 +15895,8 @@ class Shape {
16468
15895
  if (obj['isIndex']) {
16469
15896
  isSelected = true;
16470
15897
  parent.notify('freehand-draw', { prop: 'selectFhd', value: { id: id } });
16471
- if (isBlazor()) {
16472
- parent.updateToolbar(parent.element, 'pen');
16473
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
16474
- }
16475
- else {
16476
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
16477
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
16478
- }
15898
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
15899
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
16479
15900
  }
16480
15901
  else {
16481
15902
  isSelected = false;
@@ -16487,29 +15908,29 @@ class Shape {
16487
15908
  deleteShape(id) {
16488
15909
  const parent = this.parent;
16489
15910
  if (!parent.disabled && parent.isImageLoaded) {
16490
- this.applyActObj();
16491
- if (id.split('_')[0] === 'shape') {
16492
- for (let i = 0, len = parent.objColl.length; i < len; i++) {
16493
- if (parent.objColl[i].currIndex === id) {
16494
- parent.objColl.splice(i, 1);
16495
- break;
15911
+ if (parent.activeObj.currIndex && parent.activeObj.currIndex === id) {
15912
+ parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
15913
+ }
15914
+ else {
15915
+ this.applyActObj();
15916
+ if (id.split('_')[0] === 'shape') {
15917
+ for (let i = 0, len = parent.objColl.length; i < len; i++) {
15918
+ if (parent.objColl[i].currIndex === id) {
15919
+ parent.objColl.splice(i, 1);
15920
+ break;
15921
+ }
16496
15922
  }
16497
15923
  }
16498
- }
16499
- else if (id.split('_')[0] === 'pen') {
16500
- parent.notify('freehand-draw', { prop: 'handle-freehand-draw', value: { id: id } });
15924
+ else if (id.split('_')[0] === 'pen') {
15925
+ parent.notify('freehand-draw', { prop: 'handle-freehand-draw', value: { id: id } });
15926
+ }
16501
15927
  }
16502
15928
  const object = { canvasFilter: null };
16503
15929
  parent.notify('toolbar', { prop: 'getCanvasFilter', onPropertyChange: false, value: { obj: object } });
16504
15930
  this.lowerContext.filter = object['canvasFilter'];
16505
15931
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
16506
15932
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
16507
- if (!isBlazor()) {
16508
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
16509
- }
16510
- else {
16511
- parent.updateToolbar(parent.element, 'imageLoaded');
16512
- }
15933
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
16513
15934
  }
16514
15935
  }
16515
15936
  getMaxText(isTextBox, text, obj) {
@@ -16960,18 +16381,10 @@ class Transform {
16960
16381
  const parent = this.parent;
16961
16382
  const transitionArgs = { cancel: false, previousDegree: parent.transform.degree,
16962
16383
  currentDegree: Math.abs(parent.transform.degree + degree) === 360 ? 0 : parent.transform.degree + degree };
16963
- if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
16964
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
16965
- parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'OnRotate', transitionArgs, null).then((args) => {
16966
- this.rotateEvent(args, degree);
16967
- });
16968
- }
16969
- else {
16970
- if (!this.isPreventSelect) {
16971
- parent.trigger('rotating', transitionArgs);
16972
- }
16973
- this.rotateEvent(transitionArgs, degree);
16384
+ if (!this.isPreventSelect) {
16385
+ parent.trigger('rotating', transitionArgs);
16974
16386
  }
16387
+ this.rotateEvent(transitionArgs, degree);
16975
16388
  }
16976
16389
  rotateEvent(transitionArgs, degree) {
16977
16390
  const parent = this.parent;
@@ -17033,16 +16446,6 @@ class Transform {
17033
16446
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
17034
16447
  this.prevZoomValue = parent.zoomSettings.zoomFactor;
17035
16448
  }
17036
- transitionArgs = { previousDegree: transitionArgs.previousDegree, currentDegree: transitionArgs.currentDegree };
17037
- if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotated.hasDelegate === true) {
17038
- const rotatedArgs = { degree: transitionArgs.currentDegree };
17039
- parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'Rotated', null, rotatedArgs);
17040
- }
17041
- else if (!this.isPreventSelect) { }
17042
- if (isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
17043
- parent.notify('draw', { prop: 'resetStraightenDestPoints' });
17044
- parent.notify('draw', { prop: 'setDestForStraighten' });
17045
- }
17046
16449
  }
17047
16450
  else {
17048
16451
  parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: parent.prevEventObjPoint } });
@@ -17149,18 +16552,10 @@ class Transform {
17149
16552
  const parent = this.parent;
17150
16553
  const transitionArgs = { direction: direction, cancel: false,
17151
16554
  previousDirection: parent.toPascalCase(parent.transform.currFlipState || direction) };
17152
- if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipping.hasDelegate === true) {
17153
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
17154
- parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'OnFlip', transitionArgs, null).then((args) => {
17155
- this.flipEvent(args, direction);
17156
- });
17157
- }
17158
- else {
17159
- if (!this.isPreventSelect) {
17160
- parent.trigger('flipping', transitionArgs);
17161
- }
17162
- this.flipEvent(transitionArgs, direction);
16555
+ if (!this.isPreventSelect) {
16556
+ parent.trigger('flipping', transitionArgs);
17163
16557
  }
16558
+ this.flipEvent(transitionArgs, direction);
17164
16559
  }
17165
16560
  flipEvent(transitionArgs, direction) {
17166
16561
  const parent = this.parent;
@@ -17306,12 +16701,6 @@ class Transform {
17306
16701
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
17307
16702
  this.prevZoomValue = parent.zoomSettings.zoomFactor;
17308
16703
  }
17309
- transitionArgs = { previousDirection: transitionArgs.previousDirection, direction: transitionArgs.direction };
17310
- if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipped.hasDelegate === true) {
17311
- const flipped = { direction: transitionArgs.direction };
17312
- parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'Flipped', null, flipped);
17313
- }
17314
- else { }
17315
16704
  }
17316
16705
  updateFlipState(direction) {
17317
16706
  const degree = this.parent.transform.degree;
@@ -17390,9 +16779,7 @@ class Transform {
17390
16779
  if (isNullOrUndefined(isResize) && (parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor && zoomFactor > 0 ||
17391
16780
  (parent.zoomSettings.zoomFactor > parent.zoomSettings.minZoomFactor && zoomFactor < 0 && this.disableZoomOutBtn(true)) ||
17392
16781
  (parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor && zoomFactor < 0))) {
17393
- if (!isBlazor()) {
17394
- parent.notify('toolbar', { prop: 'zoom-up-handler', onPropertyChange: false });
17395
- }
16782
+ parent.notify('toolbar', { prop: 'zoom-up-handler', onPropertyChange: false });
17396
16783
  return;
17397
16784
  }
17398
16785
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
@@ -17448,31 +16835,10 @@ class Transform {
17448
16835
  const previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
17449
16836
  const zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
17450
16837
  currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
17451
- if (!parent.isCropToolbar && isBlazor() && parent.isZoomBtnClick && parent.events && parent.events.zooming.hasDelegate === true) {
17452
- zoomEventArgs.zoomTrigger = parseInt(this.getZoomTriggerType(zoomEventArgs.zoomTrigger));
17453
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
17454
- parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs, null).then((args) => {
17455
- this.zoomEvent(args, zoomFactor, isPreventApply);
17456
- });
17457
- }
17458
- else {
17459
- if (!parent.isCropToolbar && parent.isZoomBtnClick) {
17460
- parent.trigger('zooming', zoomEventArgs);
17461
- }
17462
- this.zoomEvent(zoomEventArgs, zoomFactor, isPreventApply);
16838
+ if (!parent.isCropToolbar && parent.isZoomBtnClick) {
16839
+ parent.trigger('zooming', zoomEventArgs);
17463
16840
  }
17464
- }
17465
- }
17466
- getZoomTriggerType(type) {
17467
- switch (type) {
17468
- case 'MouseWheel':
17469
- return '1';
17470
- case 'Pinch':
17471
- return '2';
17472
- case 'Commands':
17473
- return '4';
17474
- default:
17475
- return '8';
16841
+ this.zoomEvent(zoomEventArgs, zoomFactor, isPreventApply);
17476
16842
  }
17477
16843
  }
17478
16844
  zoomEvent(zoomEventArgs, zoomFact, isPreventApply) {
@@ -17482,13 +16848,7 @@ class Transform {
17482
16848
  parent.isZoomBtnClick = false;
17483
16849
  return;
17484
16850
  }
17485
- if (!isBlazor()) {
17486
- parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
17487
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
17488
- }
17489
- else if ((parent.currentToolbar !== 'resize-toolbar' && parent.currentToolbar !== 'crop-toolbar') && parent.element.querySelector('.e-contextual-toolbar-wrapper') && !parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hidden')) {
17490
- parent.updateToolbar(parent.element, 'closeContextualToolbar');
17491
- }
16851
+ parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
17492
16852
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
17493
16853
  value: { x: null, y: null, isMouseDown: true } });
17494
16854
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -17585,25 +16945,14 @@ class Transform {
17585
16945
  }
17586
16946
  parent.isUndoRedo = false;
17587
16947
  let zoomOut;
17588
- if (!isBlazor()) {
17589
- zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
17590
- if (zoomOut && zoomFactor <= minZoomFactor) {
17591
- zoomOut.classList.add('e-disabled');
17592
- zoomOut.parentElement.classList.add('e-overlay');
17593
- }
17594
- else if (zoomOut) {
17595
- zoomOut.classList.remove('e-disabled');
17596
- zoomOut.parentElement.classList.remove('e-overlay');
17597
- }
16948
+ zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
16949
+ if (zoomOut && zoomFactor <= minZoomFactor) {
16950
+ zoomOut.classList.add('e-disabled');
16951
+ zoomOut.parentElement.classList.add('e-overlay');
17598
16952
  }
17599
- else {
17600
- zoomOut = parent.element.querySelector('#zoomout');
17601
- if (zoomOut && zoomFactor <= minZoomFactor) {
17602
- zoomOut.classList.add('e-overlay');
17603
- }
17604
- else if (zoomOut) {
17605
- zoomOut.classList.remove('e-overlay');
17606
- }
16953
+ else if (zoomOut) {
16954
+ zoomOut.classList.remove('e-disabled');
16955
+ zoomOut.parentElement.classList.remove('e-overlay');
17607
16956
  }
17608
16957
  this.autoEnablePan();
17609
16958
  if (this.tempActiveObj) {
@@ -17624,26 +16973,13 @@ class Transform {
17624
16973
  parent.objColl.pop();
17625
16974
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
17626
16975
  points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
17627
- if (!isBlazor()) {
17628
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
17629
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
17630
- }
17631
- }
17632
- if (!isBlazor()) {
17633
- parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
17634
- }
17635
- else {
17636
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
16976
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
16977
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
17637
16978
  }
16979
+ parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
17638
16980
  parent.notify('selection', { prop: 'setZoomType', onPropertyChange: false, value: { zoomType: 'Toolbar' } });
17639
16981
  zoomEventArgs = { zoomPoint: zoomEventArgs.zoomPoint, previousZoomFactor: zoomEventArgs.previousZoomFactor, currentZoomFactor: zoomEventArgs.currentZoomFactor, zoomTrigger: zoomEventArgs.zoomTrigger };
17640
- if (isBlazor() && !parent.isCropToolbar && parent.isZoomBtnClick && parent.events && parent.events.zoomed.hasDelegate === true) {
17641
- zoomEventArgs.zoomTrigger = typeof zoomEventArgs.zoomTrigger !== 'number' ? parseInt(this.getZoomTriggerType(zoomEventArgs.zoomTrigger)) : zoomEventArgs.zoomTrigger;
17642
- const zoomedArgs = { zoomPoint: zoomEventArgs.zoomPoint, zoomFactor: zoomEventArgs.currentZoomFactor, zoomTrigger: zoomEventArgs.zoomTrigger };
17643
- parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'Zoomed', null, zoomedArgs);
17644
- parent.isZoomBtnClick = false;
17645
- }
17646
- else if (!parent.isCropToolbar && parent.isZoomBtnClick) {
16982
+ if (!parent.isCropToolbar && parent.isZoomBtnClick) {
17647
16983
  parent.isZoomBtnClick = false;
17648
16984
  }
17649
16985
  }
@@ -17655,12 +16991,7 @@ class Transform {
17655
16991
  if (!isNullOrUndefined(isZoomOut)) {
17656
16992
  parent.transform.zoomFactor -= 0.1;
17657
16993
  }
17658
- if (isBlazor()) {
17659
- zoomOut = parent.element.querySelector('#zoomout');
17660
- }
17661
- else {
17662
- zoomOut = parent.element.querySelector('#' + parent.element.id + '_zoomOut');
17663
- }
16994
+ zoomOut = parent.element.querySelector('#' + parent.element.id + '_zoomOut');
17664
16995
  const destPoints = { destLeft: parent.img.destLeft, destTop: parent.img.destTop,
17665
16996
  destWidth: parent.img.destWidth, destHeight: parent.img.destHeight };
17666
16997
  if (parent.activeObj.shape) {
@@ -17672,23 +17003,13 @@ class Transform {
17672
17003
  actPoint.startY || parent.img.destLeft + parent.img.destWidth <
17673
17004
  actPoint.endX || parent.img.destTop + parent.img.destHeight < actPoint.endY
17674
17005
  || zoomFactor === minZoomFactor) {
17675
- if (!isBlazor()) {
17676
- zoomOut.classList.add('e-disabled');
17677
- zoomOut.parentElement.classList.add('e-overlay');
17678
- }
17679
- else {
17680
- zoomOut.classList.add('e-overlay');
17681
- }
17006
+ zoomOut.classList.add('e-disabled');
17007
+ zoomOut.parentElement.classList.add('e-overlay');
17682
17008
  isDisabled = true;
17683
17009
  }
17684
17010
  else {
17685
- if (!isBlazor()) {
17686
- zoomOut.classList.remove('e-disabled');
17687
- zoomOut.parentElement.classList.remove('e-overlay');
17688
- }
17689
- else {
17690
- zoomOut.classList.remove('e-overlay');
17691
- }
17011
+ zoomOut.classList.remove('e-disabled');
17012
+ zoomOut.parentElement.classList.remove('e-overlay');
17692
17013
  isDisabled = false;
17693
17014
  }
17694
17015
  }
@@ -17700,23 +17021,13 @@ class Transform {
17700
17021
  parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
17701
17022
  if (obj['isIntersect'] ||
17702
17023
  zoomFactor === minZoomFactor) {
17703
- if (!isBlazor()) {
17704
- zoomOut.classList.add('e-disabled');
17705
- zoomOut.parentElement.classList.add('e-overlay');
17706
- }
17707
- else {
17708
- zoomOut.classList.add('e-overlay');
17709
- }
17024
+ zoomOut.classList.add('e-disabled');
17025
+ zoomOut.parentElement.classList.add('e-overlay');
17710
17026
  isDisabled = true;
17711
17027
  }
17712
17028
  else {
17713
- if (!isBlazor()) {
17714
- zoomOut.classList.remove('e-disabled');
17715
- zoomOut.parentElement.classList.remove('e-overlay');
17716
- }
17717
- else {
17718
- zoomOut.classList.remove('e-overlay');
17719
- }
17029
+ zoomOut.classList.remove('e-disabled');
17030
+ zoomOut.parentElement.classList.remove('e-overlay');
17720
17031
  isDisabled = false;
17721
17032
  }
17722
17033
  }
@@ -17954,18 +17265,8 @@ class Transform {
17954
17265
  const obj = { panDown: null };
17955
17266
  parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
17956
17267
  const panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
17957
- if (isBlazor() && isNullOrUndefined(parent.eventType) && parent.events && parent.events.onPanStart.hasDelegate === true) {
17958
- parent.eventType = 'pan';
17959
- parent.panEventArgs = panEventArgs;
17960
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
17961
- parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanStart', panEventArgs).then((args) => {
17962
- this.panEvent(args, xDiff, yDiff);
17963
- });
17964
- }
17965
- else {
17966
- parent.trigger('panning', panEventArgs);
17967
- this.panEvent(panEventArgs, xDiff, yDiff);
17968
- }
17268
+ parent.trigger('panning', panEventArgs);
17269
+ this.panEvent(panEventArgs, xDiff, yDiff);
17969
17270
  }
17970
17271
  panEvent(panEventArgs, xDiff, yDiff) {
17971
17272
  if (panEventArgs.cancel) {
@@ -18416,44 +17717,25 @@ class Transform {
18416
17717
  }
18417
17718
  const frameObj = { bool: null };
18418
17719
  parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObj } });
18419
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
18420
- if (frameObj['bool'] || (isBlazor() && parent.currentToolbar === 'frame-toolbar')) {
18421
- isFrameToolbar = true;
18422
- }
18423
17720
  if (!straightenObj['bool'] && ((ctToolbar && !ctToolbar.parentElement.classList.contains('e-hide')) ||
18424
17721
  (hdWrapper && !hdWrapper.parentElement.classList.contains('e-hide')))) {
18425
17722
  ctWrapper.classList.add('e-hide');
18426
17723
  if (!isCropSelection) {
18427
17724
  parent.okBtn();
18428
17725
  }
18429
- if (!isBlazor()) {
18430
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
18431
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18432
- }
18433
- else {
18434
- parent.updateToolbar(parent.element, 'imageLoaded');
18435
- }
17726
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
17727
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18436
17728
  }
18437
17729
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
18438
17730
  if (freehandObj['bool']) {
18439
- if (!isBlazor()) {
18440
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18441
- }
18442
- else {
18443
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
18444
- }
17731
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18445
17732
  }
18446
17733
  if (parent.activeObj.shape !== undefined) {
18447
17734
  isActiveObj = true;
18448
17735
  if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
18449
17736
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
18450
17737
  value: { x: null, y: null, isMouseDown: null } });
18451
- if (isBlazor()) {
18452
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
18453
- }
18454
- else {
18455
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18456
- }
17738
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18457
17739
  }
18458
17740
  else {
18459
17741
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
@@ -18473,6 +17755,11 @@ class Transform {
18473
17755
  }
18474
17756
  else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
18475
17757
  toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
17758
+ if (toolbarHeight === 0 && parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1) {
17759
+ const obj = { toolbarHeight: 0 };
17760
+ parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
17761
+ toolbarHeight = obj['toolbarHeight'];
17762
+ }
18476
17763
  }
18477
17764
  if (Browser.isDevice && straightenObj['bool']) {
18478
17765
  cxtTbarHeight = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea').clientHeight;
@@ -18512,10 +17799,8 @@ class Transform {
18512
17799
  if (canvasWrapper) {
18513
17800
  canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
18514
17801
  canvasWrapper.style.height = parent.element.offsetHeight + 'px';
18515
- const obj = { toolbarHeight: !isBlazor() ? 0 : parent.toolbarHeight };
18516
- if (!isBlazor()) {
18517
- parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
18518
- }
17802
+ const obj = { toolbarHeight: 0 };
17803
+ parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
18519
17804
  if (Browser.isDevice) {
18520
17805
  canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj['toolbarHeight']) - cxtTbarHeight) - 4 + 'px';
18521
17806
  }
@@ -18567,15 +17852,13 @@ class Transform {
18567
17852
  hideSpinner(parent.element);
18568
17853
  parent.element.style.opacity = '1';
18569
17854
  const obj1 = { defToolbarItems: null };
18570
- if (!isBlazor()) {
18571
- parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
18572
- if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
18573
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
18574
- const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
18575
- toolbar.refreshOverflow();
18576
- if (ctWrapper && !straightenObj['bool']) {
18577
- ctWrapper.classList.add('e-hide');
18578
- }
17855
+ parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
17856
+ if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
17857
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
17858
+ const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
17859
+ toolbar.refreshOverflow();
17860
+ if (ctWrapper && !straightenObj['bool']) {
17861
+ ctWrapper.classList.add('e-hide');
18579
17862
  }
18580
17863
  }
18581
17864
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -18600,43 +17883,23 @@ class Transform {
18600
17883
  if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
18601
17884
  parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' ||
18602
17885
  parent.activeObj.shape === 'image') {
18603
- if (!isBlazor()) {
18604
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
18605
- }
18606
- else {
18607
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
18608
- }
17886
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
18609
17887
  }
18610
17888
  }
18611
17889
  }
18612
17890
  if (freehandObj['bool']) {
18613
- if (isBlazor()) {
18614
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
18615
- }
18616
- else {
18617
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
18618
- }
17891
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
18619
17892
  }
18620
17893
  if (isFrameToolbar) {
18621
- if (isBlazor()) {
18622
- parent.updateToolbar(parent.element, 'frame');
18623
- }
18624
- else {
18625
- parent.notify('toolbar', { prop: 'callFrameToolbar', onPropertyChange: false });
18626
- }
17894
+ parent.notify('toolbar', { prop: 'callFrameToolbar', onPropertyChange: false });
18627
17895
  }
18628
17896
  else if (parent.isResize) {
18629
17897
  parent.aspectWidth = Math.ceil(parent.img.destWidth);
18630
17898
  parent.aspectHeight = Math.ceil(parent.img.destHeight);
18631
- if (isBlazor()) {
18632
- parent.updateToolbar(parent.element, 'resize');
18633
- }
18634
- else {
18635
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
18636
- isApplyBtn: false, isCropping: false } });
18637
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
18638
- isApplyBtn: false, isCropping: false } });
18639
- }
17899
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
17900
+ isApplyBtn: false, isCropping: false } });
17901
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
17902
+ isApplyBtn: false, isCropping: false } });
18640
17903
  }
18641
17904
  if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
18642
17905
  const totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
@@ -18662,24 +17925,14 @@ class Transform {
18662
17925
  else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
18663
17926
  parent.transform.zoomFactor = 0;
18664
17927
  parent.transform.cropZoomFactor = null;
18665
- if (isBlazor()) {
18666
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
18667
- }
18668
- else {
18669
- parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
18670
- }
17928
+ parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
18671
17929
  }
18672
17930
  }
18673
17931
  }
18674
17932
  calcMaxDimension(width, height, obj, isImgShape) {
18675
17933
  const object = { toolbarHeight: 0 };
18676
17934
  const parent = this.parent;
18677
- if (!isBlazor()) {
18678
- parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: object } });
18679
- }
18680
- else {
18681
- object['toolbarHeight'] = parent.toolbarHeight;
18682
- }
17935
+ parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: object } });
18683
17936
  let canvasMaxWidth = isImgShape ? parent.element.clientWidth / 3 :
18684
17937
  parent.element.clientWidth;
18685
17938
  let canvasMaxHeight = isImgShape ? (parent.element.clientHeight - object['toolbarHeight']) / 3 :
@@ -19029,36 +18282,20 @@ class Transform {
19029
18282
  parent.notify('toolbar', { prop: 'init-main-toolbar', value: { isApplyBtn: false, isDevice: true, isOkBtn: true, isResize: true } });
19030
18283
  }
19031
18284
  }
18285
+ const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
18286
+ const aspectHeight = aspectRatioHeight.value === '' ? aspectRatioHeight.placeholder : aspectRatioHeight.value;
19032
18287
  const resizeEventArgs = { cancel: false, previousWidth: Math.ceil(parent.img.destWidth),
19033
18288
  previousHeight: Math.ceil(parent.img.destHeight), width: Math.ceil(width), height: height && height !== 0 ? Math.ceil(height) :
19034
- (parent.aspectHeight ? parent.aspectHeight : Math.ceil(parent.img.destHeight)),
18289
+ (isAspectRatio ? Math.ceil(parseFloat(aspectHeight)) : Math.ceil(parent.img.destHeight)),
19035
18290
  isAspectRatio: isAspectRatio ? isAspectRatio : false };
19036
- if (!isBlazor()) {
19037
- parent.trigger('resizing', resizeEventArgs);
19038
- if (!resizeEventArgs.cancel) {
19039
- this.resizeEventHandler(resizeEventArgs);
19040
- }
19041
- else if (parent.aspectHeight && parent.aspectWidth) {
19042
- parent.aspectHeight = resizeEventArgs.previousHeight;
19043
- parent.aspectWidth = resizeEventArgs.previousWidth;
19044
- }
19045
- }
19046
- else if (isBlazor() && parent.events && parent.events.imageResizing.hasDelegate === true && !parent.isResizeOkBtn) {
19047
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
19048
- parent.dotNetRef.invokeMethodAsync('OnImageResizingAsync', 'ImageResizing', resizeEventArgs, null).then((args) => {
19049
- this.resizeEventCancel = args.cancel;
19050
- if (!args.cancel) {
19051
- this.resizeEventHandler(args);
19052
- }
19053
- else if (parent.aspectHeight && parent.aspectWidth) {
19054
- parent.aspectHeight = resizeEventArgs.previousHeight;
19055
- parent.aspectWidth = resizeEventArgs.previousWidth;
19056
- }
19057
- });
19058
- }
19059
- else if (!this.resizeEventCancel) {
18291
+ parent.trigger('resizing', resizeEventArgs);
18292
+ if (!resizeEventArgs.cancel) {
19060
18293
  this.resizeEventHandler(resizeEventArgs);
19061
18294
  }
18295
+ else if (parent.aspectHeight && parent.aspectWidth) {
18296
+ parent.aspectHeight = resizeEventArgs.previousHeight;
18297
+ parent.aspectWidth = resizeEventArgs.previousWidth;
18298
+ }
19062
18299
  }
19063
18300
  resizeEventHandler(args) {
19064
18301
  const parent = this.parent;
@@ -19077,13 +18314,7 @@ class Transform {
19077
18314
  const originalWidth = parent.img.destWidth;
19078
18315
  const originalHeight = parent.img.destHeight;
19079
18316
  let aspectRatioWidthValue;
19080
- if (!isBlazor()) {
19081
- aspectRatioWidthValue = parseFloat(aspectRatioWidth.value === '' ? aspectRatioWidth.placeholder :
19082
- aspectRatioWidth.value);
19083
- }
19084
- else {
19085
- aspectRatioWidthValue = parseFloat(widthElem.value === '' ? widthElem.placeholder : widthElem.value);
19086
- }
18317
+ aspectRatioWidthValue = parseFloat(aspectRatioWidth.value === '' ? aspectRatioWidth.placeholder : aspectRatioWidth.value);
19087
18318
  if (aspectRatioHeight) {
19088
18319
  let value = aspectRatioWidthValue / (originalWidth / originalHeight);
19089
18320
  const height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
@@ -19131,28 +18362,17 @@ class Transform {
19131
18362
  parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
19132
18363
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
19133
18364
  height: parent.img.srcHeight };
19134
- if (isBlazor()) {
19135
- parent.updateToolbar(parent.element, 'resize');
19136
- }
19137
- else {
19138
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
19139
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19140
- parent.notify('transform', { prop: 'setPreventDownScale', value: { bool: false } });
19141
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
19142
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19143
- }
18365
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
18366
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
18367
+ parent.notify('transform', { prop: 'setPreventDownScale', value: { bool: false } });
18368
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
18369
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19144
18370
  }
19145
18371
  else {
19146
18372
  parent.notify('transform', { prop: 'resizeCrop', value: { width: args.width, height: args.height } });
19147
18373
  }
19148
18374
  }
19149
18375
  this.resizedImgAngle = parent.transform.degree;
19150
- args = { previousHeight: args.previousHeight, previousWidth: args.previousWidth, width: args.width, height: args.height, isAspectRatio: args.isAspectRatio };
19151
- if (isBlazor() && parent.isResizeOkBtn && parent.events && parent.events.imageResized.hasDelegate === true) {
19152
- const resizeArgs = { width: args.width, height: args.height, isAspectRatio: args.isAspectRatio };
19153
- parent.dotNetRef.invokeMethodAsync('OnImageResizingAsync', 'ImageResized', null, resizeArgs);
19154
- }
19155
- else { }
19156
18376
  }
19157
18377
  straightenImage(degree) {
19158
18378
  const parent = this.parent;
@@ -19160,13 +18380,7 @@ class Transform {
19160
18380
  parent.notify('draw', { prop: 'select', onPropertyChange: false,
19161
18381
  value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
19162
18382
  }
19163
- if (isBlazor()) {
19164
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
19165
- parent.performCropClick();
19166
- }
19167
- else {
19168
- parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19169
- }
18383
+ parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19170
18384
  parent.setStraighten(degree, true);
19171
18385
  parent.okBtn();
19172
18386
  }
@@ -19272,33 +18486,22 @@ class UndoRedo {
19272
18486
  const parent = this.parent;
19273
18487
  refreshToolbar = refreshToolbar ? refreshToolbar : false;
19274
18488
  if (refreshToolbar) {
19275
- if (!isBlazor()) {
19276
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: true } });
19277
- }
18489
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: true } });
19278
18490
  this.tempUndoRedoColl = extend([], this.appliedUndoRedoColl, [], true);
19279
18491
  this.tempUndoRedoStep = this.undoRedoStep;
19280
18492
  }
19281
- else if (!isBlazor()) {
19282
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19283
- }
18493
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19284
18494
  this.undoRedoColl = this.undoRedoColl.slice(0, this.undoRedoStep);
19285
18495
  this.appliedUndoRedoColl = this.appliedUndoRedoColl.slice(0, this.undoRedoStep);
19286
18496
  parent.isUndoRedo = parent.currObjType.isUndoAction = false;
19287
- if (!isBlazor()) {
19288
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19289
- }
19290
- else {
19291
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19292
- }
18497
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19293
18498
  }
19294
18499
  updateCurrUrc(type) {
19295
18500
  const parent = this.parent;
19296
18501
  if (parent.isResize || this.isPreventing) {
19297
18502
  return;
19298
18503
  }
19299
- if (!isBlazor()) {
19300
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19301
- }
18504
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19302
18505
  if (type === 'ok') {
19303
18506
  parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: false } });
19304
18507
  const collection = this.tempUndoRedoColl.length > 0 ?
@@ -19358,12 +18561,7 @@ class UndoRedo {
19358
18561
  this.undoRedoColl = extend([], this.appliedUndoRedoColl, [], true);
19359
18562
  if (type === 'ok') {
19360
18563
  this.undoRedoStep = this.undoRedoColl.length;
19361
- if (!isBlazor()) {
19362
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19363
- }
19364
- else {
19365
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19366
- }
18564
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19367
18565
  }
19368
18566
  if (parent.transform.zoomFactor > 0) {
19369
18567
  parent.togglePan = true;
@@ -19389,25 +18587,18 @@ class UndoRedo {
19389
18587
  this.undoRedoStep = this.tempUndoRedoStep;
19390
18588
  this.tempUndoRedoColl = [];
19391
18589
  this.tempUndoRedoStep = 0;
19392
- if (!isBlazor()) {
19393
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19394
- }
18590
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19395
18591
  }
19396
18592
  }
19397
18593
  refreshToolbarActions() {
19398
18594
  const parent = this.parent;
19399
- if (!isBlazor()) {
19400
- if (parent.activeObj.shape) {
19401
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
19402
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19403
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
19404
- }
19405
- else {
19406
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
19407
- }
18595
+ if (parent.activeObj.shape) {
18596
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
18597
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
18598
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
19408
18599
  }
19409
- else if (isNullOrUndefined(parent.activeObj.shape)) {
19410
- parent.updateToolbar(parent.element, 'imageLoaded');
18600
+ else {
18601
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
19411
18602
  }
19412
18603
  }
19413
18604
  applyCurrentChanges() {
@@ -19417,7 +18608,7 @@ class UndoRedo {
19417
18608
  parent.togglePan = false;
19418
18609
  parent.notify('selection', { prop: 'setDragCanvas', value: { bool: false } });
19419
18610
  }
19420
- if (parent.element.querySelector('.e-contextual-toolbar-wrapper') && !isBlazor()) {
18611
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
19421
18612
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19422
18613
  }
19423
18614
  if (parent.togglePen) {
@@ -19449,14 +18640,9 @@ class UndoRedo {
19449
18640
  }
19450
18641
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
19451
18642
  this.undoRedoStep--;
19452
- if (!isBlazor()) {
19453
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19454
- if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
19455
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19456
- }
19457
- }
19458
- else {
19459
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
18643
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
18644
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
18645
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19460
18646
  }
19461
18647
  parent.isUndoRedo = true;
19462
18648
  const obj = this.undoRedoColl[this.undoRedoStep];
@@ -19584,12 +18770,7 @@ class UndoRedo {
19584
18770
  if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
19585
18771
  this.refreshToolbarActions();
19586
18772
  this.undoRedoStep++;
19587
- if (!isBlazor()) {
19588
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19589
- }
19590
- else {
19591
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19592
- }
18773
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19593
18774
  parent.isUndoRedo = true;
19594
18775
  const obj = this.undoRedoColl[this.undoRedoStep - 1];
19595
18776
  if (this.undoRedoColl.length === this.undoRedoStep) {
@@ -19606,7 +18787,7 @@ class UndoRedo {
19606
18787
  parent.cropObj = extend({}, obj.currentCropObj, {}, true);
19607
18788
  parent.afterCropActions = obj.currentObj.afterCropActions;
19608
18789
  this.lowerContext.filter = obj.currentObj.filter;
19609
- if (!isBlazor() && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
18790
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
19610
18791
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19611
18792
  }
19612
18793
  parent.notify('filter', { prop: 'setAdjustmentLevel', onPropertyChange: false, value: { adjustmentLevel: obj.currentObj.adjustmentLevel } });
@@ -19878,12 +19059,7 @@ class UndoRedo {
19878
19059
  this.upperContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
19879
19060
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
19880
19061
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
19881
- if (!isBlazor()) {
19882
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
19883
- }
19884
- else {
19885
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
19886
- }
19062
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
19887
19063
  const textArea = parent.textArea;
19888
19064
  textArea.style.display = 'block';
19889
19065
  textArea.style.fontFamily = obj.textSettings.fontFamily;
@@ -19945,40 +19121,24 @@ class UndoRedo {
19945
19121
  parent.notify('selection', { prop: 'setDragCanvas', value: { bool: true } });
19946
19122
  }
19947
19123
  parent.notify('draw', { prop: 'setCancelAction', onPropertyChange: false, value: { bool: false } });
19948
- if (!isBlazor()) {
19949
- if (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] === 'crop') {
19950
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19951
- isApplyBtn: true, isCropping: true, isZooming: null, cType: null } });
19952
- }
19953
- else {
19954
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
19955
- }
19956
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19124
+ if (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] === 'crop') {
19125
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19126
+ isApplyBtn: true, isCropping: true, isZooming: null, cType: null } });
19957
19127
  }
19958
- else if (isNullOrUndefined(parent.activeObj.shape) || parent.activeObj.shape.split('-')[0] !== 'crop') {
19959
- parent.updateToolbar(parent.element, 'imageLoaded');
19960
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19128
+ else {
19129
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
19961
19130
  }
19131
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19962
19132
  if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
19963
19133
  document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
19964
19134
  }
19965
- if (!isBlazor()) {
19966
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19967
- }
19968
- else {
19969
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19970
- }
19135
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19971
19136
  if (parent.transform.degree !== 0) {
19972
19137
  parent.notify('transform', { prop: 'drawPannedImage', onPropertyChange: false,
19973
19138
  value: { xDiff: 0, yDiff: 0 } });
19974
19139
  }
19975
19140
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
19976
19141
  parent.currObjType.isCustomCrop = false;
19977
- if (isBlazor() && parent.events && parent.events.historyChanged.hasDelegate === true) {
19978
- let imageAction = this.getImageAction(operation);
19979
- const args = { length: this.undoRedoColl.length, index: this.undoRedoStep, actionTrigger: isUndo ? 'Undo' : 'Redo', imageAction: imageAction };
19980
- parent.dotNetRef.invokeMethodAsync('OnHistoryChangedAsync', args);
19981
- }
19982
19142
  }
19983
19143
  getImageAction(operation) {
19984
19144
  if (['brightness', 'contrast', 'saturation', 'opacity', 'blur', 'hue'].indexOf(operation) !== -1) {
@@ -20059,17 +19219,7 @@ class UndoRedo {
20059
19219
  previousSelPointColl: previousSelPointColl, currentSelPointColl: currentObj.selPointColl,
20060
19220
  previousCropObj: previousCropObj, currentCropObj: extend({}, parent.cropObj, {}, true),
20061
19221
  previousText: previousText, currentText: currentText, filter: previousFilter, isCircleCrop: isCircleCrop });
20062
- if (!isBlazor()) {
20063
- parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
20064
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
20065
- }
20066
- else if (parent.currentToolbar !== 'pen-toolbar') {
20067
- let toolbarValue = null;
20068
- if (parent.currentToolbar === 'text-toolbar' && operation === 'textAreaCustomization') {
20069
- toolbarValue = 'textAreaClicked';
20070
- }
20071
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn', toolbarValue);
20072
- }
19222
+ parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
20073
19223
  }
20074
19224
  }
20075
19225
  updateUrObj(objColl, operation) {
@@ -20125,15 +19275,10 @@ class UndoRedo {
20125
19275
  parent.objColl.pop();
20126
19276
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
20127
19277
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
20128
- if (!isBlazor()) {
20129
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
20130
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20131
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20132
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20133
- }
20134
- else {
20135
- parent.updateToolbar(parent.element, 'imageLoaded');
20136
- }
19278
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
19279
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19280
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19281
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20137
19282
  }
20138
19283
  getZeroZoomObjPointValue(obj, point) {
20139
19284
  const parent = this.parent;
@@ -20459,26 +19604,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20459
19604
  this.isFrameBtnClick = false;
20460
19605
  /** @hidden */
20461
19606
  this.isChangesSaved = false;
20462
- if (isBlazor()) {
20463
- new Crop(this);
20464
- new Draw(this);
20465
- new Filter(this);
20466
- new FreehandDrawing(this);
20467
- new Selection(this);
20468
- new Shape(this);
20469
- new Transform(this);
20470
- new UndoRedo(this);
20471
- new Export(this);
20472
- }
20473
- else {
20474
- ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
20475
- ImageEditor_1.Inject(UndoRedo);
20476
- ImageEditor_1.Inject(Filter);
20477
- ImageEditor_1.Inject(Shape);
20478
- ImageEditor_1.Inject(FreehandDrawing);
20479
- if (element) {
20480
- this.appendTo(element);
20481
- }
19607
+ ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
19608
+ ImageEditor_1.Inject(UndoRedo);
19609
+ ImageEditor_1.Inject(Filter);
19610
+ ImageEditor_1.Inject(Shape);
19611
+ ImageEditor_1.Inject(FreehandDrawing);
19612
+ if (element) {
19613
+ this.appendTo(element);
20482
19614
  }
20483
19615
  }
20484
19616
  /**
@@ -20587,13 +19719,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20587
19719
  }
20588
19720
  this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
20589
19721
  this.upperContext.fillStyle = this.themeColl[this.theme]['secondaryColor'];
20590
- if (isBlazor()) {
20591
- this.updateToolbar(this.element, 'imageLoaded');
20592
- }
20593
- else {
20594
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20595
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20596
- }
19722
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19723
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20597
19724
  }
20598
19725
  break;
20599
19726
  case 'finetuneSettings':
@@ -20605,13 +19732,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20605
19732
  case 'locale':
20606
19733
  if (newProperties.locale) {
20607
19734
  this.notify('toolbar', { prop: 'setLocale', onPropertyChange: false, value: { locale: newProperties.locale } });
20608
- if (isBlazor()) {
20609
- this.updateToolbar(this.element, 'imageLoaded');
20610
- }
20611
- else {
20612
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20613
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20614
- }
19735
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19736
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20615
19737
  }
20616
19738
  break;
20617
19739
  case 'allowUndoRedo':
@@ -20621,47 +19743,25 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20621
19743
  else {
20622
19744
  this.allowUndoRedo = false;
20623
19745
  }
20624
- if (isBlazor()) {
20625
- this.updateToolbar(this.element, 'imageLoaded');
20626
- }
20627
- else {
20628
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20629
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20630
- }
19746
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19747
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20631
19748
  break;
20632
19749
  case 'showQuickAccessToolbar':
20633
19750
  if (newProperties.showQuickAccessToolbar) {
20634
19751
  this.showQuickAccessToolbar = true;
20635
- if (!isBlazor()) {
20636
- this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
20637
- }
19752
+ this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
20638
19753
  indexObj = { freehandSelectedIndex: null };
20639
19754
  this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
20640
19755
  if (this.activeObj.shape) {
20641
- if (isBlazor()) {
20642
- this.updateToolbar(this.element, 'quickAccessToolbar', this.activeObj.shape);
20643
- }
20644
- else {
20645
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
20646
- }
19756
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
20647
19757
  }
20648
19758
  else if (indexObj['freehandSelectedIndex']) {
20649
- if (isBlazor()) {
20650
- this.updateToolbar(this.element, 'quickAccessToolbar', 'pen');
20651
- }
20652
- else {
20653
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
20654
- }
19759
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
20655
19760
  }
20656
19761
  }
20657
19762
  else {
20658
19763
  this.showQuickAccessToolbar = false;
20659
- if (isBlazor()) {
20660
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
20661
- }
20662
- else {
20663
- this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
20664
- }
19764
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
20665
19765
  }
20666
19766
  break;
20667
19767
  case 'zoomSettings':
@@ -20671,22 +19771,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20671
19771
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
20672
19772
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
20673
19773
  ZoomTrigger.Commands);
20674
- if (isBlazor()) {
20675
- this.updateToolbar(this.element, 'imageLoaded');
20676
- }
20677
- else {
20678
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20679
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20680
- }
19774
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19775
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20681
19776
  }
20682
19777
  else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
20683
- if (isBlazor()) {
20684
- this.updateToolbar(this.element, 'imageLoaded');
20685
- }
20686
- else {
20687
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20688
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20689
- }
19778
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19779
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20690
19780
  }
20691
19781
  break;
20692
19782
  case 'selectionSettings':
@@ -20701,33 +19791,24 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20701
19791
  case 'toolbar':
20702
19792
  if (newProperties.toolbar) {
20703
19793
  this.toolbar = newProperties.toolbar;
20704
- if (isBlazor()) {
20705
- this.updateToolbar(this.element, 'imageLoaded');
20706
- }
20707
- else {
20708
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20709
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20710
- }
19794
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19795
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20711
19796
  }
20712
19797
  break;
20713
19798
  case 'toolbarTemplate':
20714
19799
  if (newProperties.toolbarTemplate) {
20715
- if (!isBlazor()) {
20716
- this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
20717
- this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
20718
- this.element.appendChild(this.createElement('div', {
20719
- id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
20720
- }));
20721
- this.toolbarTemplateFn();
20722
- }
19800
+ this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
19801
+ this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
19802
+ this.element.appendChild(this.createElement('div', {
19803
+ id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
19804
+ }));
19805
+ this.toolbarTemplateFn();
20723
19806
  }
20724
19807
  break;
20725
19808
  case 'quickAccessToolbarTemplate':
20726
19809
  if (newProperties.quickAccessToolbarTemplate) {
20727
- if (!isBlazor()) {
20728
- this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
20729
- this.quickAccessToolbarTemplateFn();
20730
- }
19810
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
19811
+ this.quickAccessToolbarTemplateFn();
20731
19812
  }
20732
19813
  break;
20733
19814
  }
@@ -20743,14 +19824,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20743
19824
  if (!this.element.getAttribute('class')) {
20744
19825
  this.element.removeAttribute('class');
20745
19826
  }
20746
- if (isBlazor()) {
20747
- this.element.classList.remove('e-image-editor');
20748
- }
20749
- else {
20750
- this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
20751
- this.notify('destroyed', null);
20752
- super.destroy();
20753
- }
19827
+ this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
19828
+ this.notify('destroyed', null);
19829
+ super.destroy();
20754
19830
  this.unwireEvent();
20755
19831
  this.element.innerHTML = '';
20756
19832
  }
@@ -20939,7 +20015,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20939
20015
  this.element.style.boxSizing = 'border-box';
20940
20016
  const obj = { toolbarHeight: 0 };
20941
20017
  this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
20942
- const height = obj['toolbarHeight'];
20018
+ let height = obj['toolbarHeight'];
20019
+ if (this.toolbar && this.toolbar.length > 0 && this.toolbar.indexOf('Open') === -1) {
20020
+ height = 0;
20021
+ }
20943
20022
  this.element.style.width = this.width;
20944
20023
  this.element.style.height = this.height;
20945
20024
  const canvasWrapper = this.element.appendChild(this.createElement('div', { id: this.element.id + '_canvasWrapper',
@@ -21107,10 +20186,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21107
20186
  /**
21108
20187
  * Clears the current selection performed in the image editor.
21109
20188
  *
20189
+ * @param { boolean } resetCrop - Specifies to reset last cropped image.
20190
+ *
21110
20191
  * @returns {void}.
21111
20192
  */
21112
- clearSelection() {
21113
- this.notify('selection', { prop: 'clearSelection', onPropertyChange: false });
20193
+ clearSelection(resetCrop) {
20194
+ this.notify('selection', { prop: 'clearSelection', onPropertyChange: false, value: { resetCrop: resetCrop } });
21114
20195
  }
21115
20196
  /**
21116
20197
  * Crops an image based on the selection done in the image editor.
@@ -21158,7 +20239,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21158
20239
  */
21159
20240
  getImageData() {
21160
20241
  const obj = { canvas: null };
21161
- if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
20242
+ const dummyObj = { bool: false };
20243
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: dummyObj } });
20244
+ if (dummyObj['bool'] || this.togglePen || this.activeObj.shape) {
21162
20245
  this.okBtn();
21163
20246
  }
21164
20247
  this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
@@ -21197,13 +20280,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21197
20280
  this.clearContext(this.lowerContext);
21198
20281
  this.clearContext(this.upperContext);
21199
20282
  this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
21200
- if (!isBlazor()) {
21201
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
21202
- isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
21203
- if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
21204
- getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
21205
- this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
21206
- }
20283
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20284
+ isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
20285
+ if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
20286
+ getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
20287
+ this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
21207
20288
  }
21208
20289
  const isImageLoaded = this.isImageLoaded;
21209
20290
  this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
@@ -21268,36 +20349,28 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21268
20349
  }
21269
20350
  this.notifyResetForAllModules();
21270
20351
  this.notify('filter', { prop: 'update-finetunes' });
21271
- if (!isBlazor()) {
21272
- if (this.toolbarTemplate) {
21273
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
21274
- }
21275
- else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
21276
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
21277
- }
21278
- this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
20352
+ if (this.toolbarTemplate) {
20353
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
21279
20354
  }
20355
+ else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
20356
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
20357
+ }
20358
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
21280
20359
  this.isImageLoaded = isImageLoaded;
21281
20360
  this.straightenBaseImageCanvas();
21282
20361
  this.isImageLoaded = false;
21283
20362
  this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
21284
20363
  this.isImageLoaded = isImageLoaded;
21285
20364
  this.prevStraightenedDegree = 0;
21286
- if (!isBlazor()) {
21287
- const ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
21288
- if (ctWrapper) {
21289
- ctWrapper.classList.add('e-hide');
21290
- }
21291
- this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
21292
- this.notify('toolbar', { prop: 'enable-disable-btns' });
21293
- const straightenObj = { bool: this.isStraightening };
21294
- if (Browser.isDevice && straightenObj['bool']) {
21295
- this.notify('crop', { prop: 'resizeWrapper' });
21296
- }
20365
+ const ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
20366
+ if (ctWrapper) {
20367
+ ctWrapper.classList.add('e-hide');
21297
20368
  }
21298
- else {
21299
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
21300
- this.activeObj.textSettings.fontFamily = this.defaultFontFamily;
20369
+ this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
20370
+ this.notify('toolbar', { prop: 'enable-disable-btns' });
20371
+ const straightenObj = { bool: this.isStraightening };
20372
+ if (Browser.isDevice && straightenObj['bool']) {
20373
+ this.notify('crop', { prop: 'resizeWrapper' });
21301
20374
  }
21302
20375
  }
21303
20376
  }
@@ -21317,9 +20390,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21317
20390
  */
21318
20391
  rotate(degree) {
21319
20392
  const obj = { isRotate: false };
20393
+ if (degree === 90 || degree === -90) {
20394
+ this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
20395
+ }
21320
20396
  this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
21321
20397
  this.notify('draw', { prop: 'redrawDownScale' });
21322
- this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
21323
20398
  return obj['isRotate'];
21324
20399
  }
21325
20400
  /**
@@ -21357,8 +20432,20 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21357
20432
  this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
21358
20433
  this.notify('draw', { prop: 'select', onPropertyChange: false,
21359
20434
  value: { type: type, startX: startX, startY: startY, width: width, height: height } });
21360
- this.notify('draw', { prop: 'select', onPropertyChange: false,
21361
- value: { type: type, startX: startX, startY: startY, width: width, height: height } });
20435
+ if ((startX && startY) || (width && height)) {
20436
+ this.notify('draw', { prop: 'select', onPropertyChange: false,
20437
+ value: { type: type, startX: startX, startY: startY, width: width, height: height } });
20438
+ }
20439
+ else {
20440
+ this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
20441
+ totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
20442
+ rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
20443
+ destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
20444
+ srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
20445
+ aspectWidth: null, aspectHeight: null, straightenZoom: 0,
20446
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
20447
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
20448
+ }
21362
20449
  }
21363
20450
  /**
21364
20451
  * Enable or disable a freehand drawing option in an Image Editor.
@@ -21430,16 +20517,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21430
20517
  * @param {string} strokeColor - Specifies the stroke color of ellipse.
21431
20518
  * @param {string} fillColor - Specifies the fill color of the ellipse.
21432
20519
  * @param {number} degree - Specifies the degree to rotate the ellipse.
20520
+ * @param {boolean} isSelected - Specifies to show the ellipse in the selected state.
21433
20521
  * @returns {boolean}.
21434
20522
  *
21435
20523
  */
21436
- drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
20524
+ drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
21437
20525
  let isEllipse = false;
21438
20526
  const isPointsInRange = this.allowShape(x, y);
21439
20527
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21440
20528
  isEllipse = true;
21441
20529
  this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
21442
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
20530
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
21443
20531
  this.notify('draw', { prop: 'redrawDownScale' });
21444
20532
  }
21445
20533
  return isEllipse;
@@ -21453,15 +20541,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21453
20541
  * @param {number} endY - Specifies end point y-coordinates of the line.
21454
20542
  * @param {number} strokeWidth - Specifies the stroke width of line.
21455
20543
  * @param {string} strokeColor - Specifies the stroke color of line.
20544
+ * @param {boolean} isSelected - Specifies to show the line in the selected state.
21456
20545
  * @returns {boolean}.
21457
20546
  */
21458
- drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
20547
+ drawLine(startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
21459
20548
  let isLine = false;
21460
20549
  const isPointsInRange = this.allowShape(startX, startY);
21461
20550
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
21462
20551
  isLine = true;
21463
20552
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
21464
- endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
20553
+ endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
21465
20554
  this.notify('draw', { prop: 'redrawDownScale' });
21466
20555
  }
21467
20556
  return isLine;
@@ -21477,15 +20566,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21477
20566
  * @param {string} strokeColor - Specifies the stroke color of arrow.
21478
20567
  * @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
21479
20568
  * @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
20569
+ * @param {boolean} isSelected - Specifies to show the arrow in the selected state.
21480
20570
  * @returns {boolean}.
21481
20571
  */
21482
- drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
20572
+ drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
21483
20573
  let isArrow = false;
21484
20574
  const isPointsInRange = this.allowShape(startX, startY);
21485
20575
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
21486
20576
  isArrow = true;
21487
20577
  this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
21488
- endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
20578
+ endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
20579
+ isSelected: isSelected } });
21489
20580
  this.notify('draw', { prop: 'redrawDownScale' });
21490
20581
  }
21491
20582
  return isArrow;
@@ -21496,9 +20587,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21496
20587
  * @param {Point[]} pointColl – Specifies collection of start and end x, y-coordinates of path.
21497
20588
  * @param {number} strokeWidth - Specifies the stroke width of path.
21498
20589
  * @param {string} strokeColor - Specifies the stroke color of path.
20590
+ * @param {boolean} isSelected - Specifies to show the path in the selected state.
21499
20591
  * @returns {boolean}.
21500
20592
  */
21501
- drawPath(pointColl, strokeWidth, strokeColor, opacity) {
20593
+ drawPath(pointColl, strokeWidth, strokeColor, isSelected) {
21502
20594
  this.isPublicMethod = true;
21503
20595
  const obj = { inRange: false };
21504
20596
  let isPath = false;
@@ -21514,7 +20606,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21514
20606
  if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
21515
20607
  isPath = true;
21516
20608
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
21517
- strokeWidth: strokeWidth, strokeColor: strokeColor } });
20609
+ strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
21518
20610
  this.notify('draw', { prop: 'redrawDownScale' });
21519
20611
  }
21520
20612
  return isPath;
@@ -21530,15 +20622,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21530
20622
  * @param {string} strokeColor - Specifies the stroke color of rectangle.
21531
20623
  * @param {string} fillColor - Specifies the fill color of the rectangle.
21532
20624
  * @param {number} degree - Specifies the degree to rotate the rectangle.
20625
+ * @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
21533
20626
  * @returns {boolean}.
21534
20627
  */
21535
- drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
20628
+ drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
21536
20629
  let isRectangle = false;
21537
20630
  const isPointsInRange = this.allowShape(x, y);
21538
20631
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21539
20632
  isRectangle = true;
21540
20633
  this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
21541
- strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
20634
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
21542
20635
  this.notify('draw', { prop: 'redrawDownScale' });
21543
20636
  }
21544
20637
  return isRectangle;
@@ -21556,16 +20649,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21556
20649
  * @param {boolean} bold - Specifies whether the text is bold or not.
21557
20650
  * @param {boolean} italic - Specifies whether the text is italic or not.
21558
20651
  * @param {string} color - Specifies font color of the text.
20652
+ * @param {boolean} isSelected - Specifies to show the text in the selected state.
21559
20653
  * @returns {boolean}.
21560
20654
  *
21561
20655
  */
21562
- drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
20656
+ drawText(x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
21563
20657
  let isText = false;
21564
20658
  const isPointsInRange = this.allowShape(x, y);
21565
20659
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21566
20660
  isText = true;
21567
20661
  this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
21568
- fontSize: fontSize, bold: bold, italic: italic, color: color } });
20662
+ fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected } });
21569
20663
  this.notify('draw', { prop: 'redrawDownScale' });
21570
20664
  }
21571
20665
  return isText;
@@ -21582,16 +20676,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21582
20676
  * @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
21583
20677
  * @param {number} degree - Specifies the degree to rotate the image.
21584
20678
  * @param {number} opacity - Specifies the value for the image.
20679
+ * @param {boolean} isSelected - Specifies to show the image in the selected state.
21585
20680
  * @returns {boolean}.
21586
20681
  *
21587
20682
  */
21588
- drawImage(data, x, y, width, height, isAspectRatio, degree, opacity) {
20683
+ drawImage(data, x, y, width, height, isAspectRatio, degree, opacity, isSelected) {
21589
20684
  let isImage = false;
21590
20685
  const isPointsInRange = this.allowShape(x, y);
21591
20686
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21592
20687
  const length = this.objColl.length;
21593
20688
  this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
21594
- src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity } });
20689
+ src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
21595
20690
  this.notify('draw', { prop: 'redrawDownScale' });
21596
20691
  if (this.objColl.length > length) {
21597
20692
  isImage = true;
@@ -21639,10 +20734,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21639
20734
  *
21640
20735
  */
21641
20736
  getShapeSetting(id) {
21642
- const shapeDetails = {};
20737
+ const obj = { shapeDetails: null };
21643
20738
  this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
21644
- value: { id: id, obj: shapeDetails } });
20739
+ value: { id: id, obj: obj } });
21645
20740
  this.notify('draw', { prop: 'redrawDownScale' });
20741
+ const shapeDetails = obj['shapeDetails'] ? obj['shapeDetails'] : {};
21646
20742
  return shapeDetails;
21647
20743
  }
21648
20744
  /**
@@ -21746,28 +20842,23 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21746
20842
  if ((width.toString()).length <= 4 && (height.toString()).length <= 4) {
21747
20843
  const destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
21748
20844
  height: this.img.destHeight };
21749
- if (isBlazor()) {
21750
- this.updateToolbar(this.element, 'resize');
20845
+ if (isAspectRatio) {
20846
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
20847
+ isApplyBtn: false, isCropping: false } });
20848
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
20849
+ isApplyBtn: false, isCropping: false } });
21751
20850
  }
21752
20851
  else {
21753
- if (isAspectRatio) {
21754
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
21755
- isApplyBtn: false, isCropping: false } });
21756
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
21757
- isApplyBtn: false, isCropping: false } });
21758
- }
21759
- else {
21760
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
21761
- isApplyBtn: false, isCropping: false } });
21762
- }
21763
- const aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
21764
- const aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
21765
- if (aspectRatioWidth && aspectRatioHeight) {
21766
- getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
21767
- aspectRatioWidth.value = Math.floor(width).toString() + ' px';
21768
- getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
21769
- aspectRatioHeight.value = Math.floor(height).toString() + ' px';
21770
- }
20852
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
20853
+ isApplyBtn: false, isCropping: false } });
20854
+ }
20855
+ const aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
20856
+ const aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
20857
+ if (aspectRatioWidth && aspectRatioHeight) {
20858
+ getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
20859
+ aspectRatioWidth.value = Math.floor(width).toString() + ' px';
20860
+ getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
20861
+ aspectRatioHeight.value = Math.floor(height).toString() + ' px';
21771
20862
  }
21772
20863
  this.notify('transform', { prop: 'resize', value: { width: width, height: height, isAspectRatio: isAspectRatio } });
21773
20864
  if (destPoints.startX !== this.img.destLeft || destPoints.startY !== this.img.destTop ||
@@ -21815,13 +20906,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21815
20906
  extend(this.tempFrameObj, this.frameObj);
21816
20907
  this.tempFrameZoomLevel = this.transform.zoomFactor;
21817
20908
  this.frameDestPoints = extend({}, this.img, {}, true);
21818
- if (!isBlazor()) {
21819
- this.notify('toolbar', { prop: 'frameToolbarClick' });
21820
- }
21821
- else {
21822
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21823
- this.performFrameClick();
21824
- }
20909
+ this.notify('toolbar', { prop: 'frameToolbarClick' });
21825
20910
  this.frameObj.type = frameType.toLowerCase();
21826
20911
  this.frameObj.color = color;
21827
20912
  this.frameObj.gradientColor = gradientColor;
@@ -21876,50 +20961,154 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21876
20961
  * {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
21877
20962
  *
21878
20963
  * @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
20964
+ * @param {boolean} isSelected - Specifies to show the shape in the selected state.
21879
20965
  * @returns {boolean}.
21880
20966
  *
21881
20967
  */
21882
- updateShape(setting) {
20968
+ updateShape(setting, isSelected) {
21883
20969
  const obj = { isSelected: false };
21884
- this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
21885
- if (obj['isSelected']) {
21886
- this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
21887
- value: { shapeSettings: setting } });
21888
- const activeObj = extend({}, this.activeObj, {}, true);
21889
- this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
21890
- this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
21891
- this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
21892
- this.okBtn();
21893
- this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
21894
- this.notify('draw', { prop: 'redrawDownScale' });
20970
+ let isTextArea = false;
20971
+ const freehandObj = { bool: false };
20972
+ if (isNullOrUndefined(setting.id)) {
20973
+ if (setting.strokeColor) {
20974
+ this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
20975
+ }
20976
+ if (setting.fillColor) {
20977
+ this.activeObj.strokeSettings.fillColor = setting.fillColor;
20978
+ }
20979
+ if (setting.strokeWidth) {
20980
+ this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
20981
+ }
20982
+ if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
20983
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
20984
+ }
20985
+ }
20986
+ else {
20987
+ if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
20988
+ this.textArea.style.display === 'inline-block')) {
20989
+ this.okBtn();
20990
+ isTextArea = true;
20991
+ }
20992
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
20993
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
20994
+ if (obj['isSelected']) {
20995
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
20996
+ value: { shapeSettings: setting } });
20997
+ const activeObj = extend({}, this.activeObj, {}, true);
20998
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
20999
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
21000
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
21001
+ if (activeObj.shape) {
21002
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
21003
+ }
21004
+ if (this.activeObj.shape === 'text') {
21005
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
21006
+ }
21007
+ if (freehandObj['bool']) {
21008
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
21009
+ }
21010
+ this.okBtn(isSelected);
21011
+ if (freehandObj['bool']) {
21012
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
21013
+ }
21014
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
21015
+ this.notify('draw', { prop: 'redrawDownScale' });
21016
+ if (isTextArea) {
21017
+ this.enableTextEditing();
21018
+ }
21019
+ if (isSelected) {
21020
+ this.selectShape(setting.id);
21021
+ }
21022
+ }
21023
+ }
21024
+ return obj['isSelected'];
21025
+ }
21026
+ /**
21027
+ * Duplicates a shape based on the given shape ID in the ImageEditor.
21028
+ * Use 'getShapeSettings' method to get the shape and then pass a shapeId from the returned shape to clone a shape.
21029
+ *
21030
+ * @param {string} shapeId - Specifies the shape id to clone a shape on an image.
21031
+ * @returns {boolean}.
21032
+ *
21033
+ */
21034
+ cloneShape(shapeId) {
21035
+ const obj = { isSelected: false };
21036
+ if (shapeId.split('_')[0] === 'shape') {
21037
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
21038
+ if (obj['isSelected']) {
21039
+ this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
21040
+ this.okBtn();
21041
+ this.notify('draw', { prop: 'redrawDownScale' });
21042
+ }
21043
+ }
21044
+ return obj['isSelected'];
21045
+ }
21046
+ /**
21047
+ * Update filter to the canvas in the ImageEditor.
21048
+ *
21049
+ * @param {ImageFilterOption } filterOption - Specifies the filter options to the image.
21050
+ *
21051
+ * @returns {string}.
21052
+ *
21053
+ */
21054
+ getImageFilter(filterOption) {
21055
+ const canvas = this.createElement('canvas');
21056
+ const ctx = canvas.getContext('2d');
21057
+ this.notify('filter', { prop: 'updateAdj', value: { type: filterOption.toLowerCase(), value: null, isPreview: true, ctx: ctx } });
21058
+ return ctx.filter;
21059
+ }
21060
+ /**
21061
+ * Enable text area editing in the ImageEditor.
21062
+ *
21063
+ * @returns {void}.
21064
+ *
21065
+ */
21066
+ enableTextEditing() {
21067
+ const activeObj = extend({}, this.activeObj, {}, true);
21068
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
21069
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: false } });
21070
+ this.activeObj = activeObj;
21071
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
21072
+ }
21073
+ /**
21074
+ * Specifies if it's possible to undo the last recent action made in an Image Editor.
21075
+ *
21076
+ * @returns {boolean}.
21077
+ *
21078
+ */
21079
+ canUndo() {
21080
+ let canUndo = false;
21081
+ const object = this.getUndoRedoColl();
21082
+ const undoRedoIndex = object['index'];
21083
+ if (undoRedoIndex > 0) {
21084
+ canUndo = true;
21895
21085
  }
21896
- return obj['isSelected'];
21086
+ return canUndo;
21897
21087
  }
21898
21088
  /**
21899
- * Duplicates a shape based on the given shape ID in the ImageEditor.
21900
- * Use 'getShapeSettings' method to get the shape and then pass a shapeId from the returned shape to clone a shape.
21089
+ * Specifies if it's possible to redo the last recent action made in an Image Editor.
21901
21090
  *
21902
- * @param {string} shapeId - Specifies the shape id to clone a shape on an image.
21903
21091
  * @returns {boolean}.
21904
21092
  *
21905
21093
  */
21906
- cloneShape(shapeId) {
21907
- const obj = { isSelected: false };
21908
- if (shapeId.split('_')[0] === 'shape') {
21909
- this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
21910
- if (obj['isSelected']) {
21911
- if (isBlazor()) {
21912
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21913
- this.duplicateShape(false, true);
21914
- }
21915
- else {
21916
- this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
21917
- }
21918
- this.okBtn();
21919
- this.notify('draw', { prop: 'redrawDownScale' });
21920
- }
21094
+ canRedo() {
21095
+ let canRedo = false;
21096
+ const object = this.getUndoRedoColl();
21097
+ const undoRedoColl = object['undoRedoColl'];
21098
+ const undoRedoIndex = object['index'];
21099
+ if (undoRedoColl && undoRedoColl.length > 0 && undoRedoIndex < undoRedoColl.length - 1) {
21100
+ canRedo = true;
21921
21101
  }
21922
- return obj['isSelected'];
21102
+ if (undoRedoIndex === undoRedoColl.length) {
21103
+ canRedo = false;
21104
+ }
21105
+ else if (undoRedoIndex === 0 && undoRedoColl.length > 0) {
21106
+ canRedo = true;
21107
+ }
21108
+ else if (undoRedoIndex > 0) {
21109
+ canRedo = true;
21110
+ }
21111
+ return canRedo;
21923
21112
  }
21924
21113
  // Toolbar related codes
21925
21114
  toolbarTemplateFn() {
@@ -22004,6 +21193,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22004
21193
  this.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
22005
21194
  this.notify('freehand-draw', { prop: 'color-change', value: { color: obj['tempFreeHandDrawEditingStyles'].strokeColor } });
22006
21195
  }
21196
+ getUndoRedoColl() {
21197
+ const obj = { undoRedoColl: null, index: null };
21198
+ const undoRedoObj = { undoRedoStep: null };
21199
+ const object = { appliedUndoRedoColl: [] };
21200
+ this.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
21201
+ this.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
21202
+ obj['undoRedoColl'] = object['appliedUndoRedoColl'];
21203
+ obj['index'] = undoRedoObj['undoRedoStep'];
21204
+ return obj;
21205
+ }
22007
21206
  updateImageTransformColl(type) {
22008
21207
  let value;
22009
21208
  if (type === 'rotateleft') {
@@ -22147,10 +21346,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22147
21346
  shapeSettings.type = ShapeType.FreehandDraw;
22148
21347
  }
22149
21348
  const shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22150
- this.triggerShapeChanged(shapeChangedArgs);
21349
+ this.trigger('shapeChange', shapeChangedArgs);
22151
21350
  }
22152
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
22153
- if (aspectIcon || nonAspectIcon || (isBlazor() && this.currentToolbar === 'resize-toolbar')) {
21351
+ if (aspectIcon || nonAspectIcon) {
22154
21352
  const obj = { width: null, height: null };
22155
21353
  this.notify('selection', { prop: 'getNumTextValue', onPropertyChange: false, value: { obj: obj } });
22156
21354
  const point = { x: obj['width'], y: obj['height'] };
@@ -22184,7 +21382,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22184
21382
  isCircleCrop: null } });
22185
21383
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
22186
21384
  const obj = this.cancelCropSelection;
22187
- if ((!isBlazor() && obj && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon)) || (isBlazor() && obj && blrNAspRatElem && blrNAspRatElem.classList.contains('e-hidden'))) {
21385
+ if ((obj && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon))) {
22188
21386
  obj.previousObj.aspectWidth = obj.currentObj.aspectWidth = this.aspectWidth;
22189
21387
  obj.previousObj.aspectHeight = obj.currentObj.aspectHeight = this.aspectHeight;
22190
21388
  obj.previousCropObj = extend({}, this.cropObj, {}, true);
@@ -22238,9 +21436,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22238
21436
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
22239
21437
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
22240
21438
  }
22241
- else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) ||
22242
- (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
22243
- this.currObjType.isFiltered) {
21439
+ else if (document.querySelector('#' + this.element.id + '_sliderWrapper') || this.currObjType.isFiltered) {
22244
21440
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
22245
21441
  this.currObjType.isFiltered = false;
22246
21442
  const obj = { value: null };
@@ -22256,12 +21452,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22256
21452
  else if (obj['bool']) {
22257
21453
  this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
22258
21454
  this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
22259
- if (isBlazor()) {
22260
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
22261
- }
22262
- else {
22263
- this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
22264
- }
21455
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
22265
21456
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
22266
21457
  }
22267
21458
  else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
@@ -22287,20 +21478,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22287
21478
  }
22288
21479
  this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
22289
21480
  }
22290
- if (!isBlazor() && !obj['isCropToolbar']) {
21481
+ if (!obj['isCropToolbar']) {
22291
21482
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
22292
21483
  isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
22293
21484
  }
22294
- else if (isBlazor() && !obj['isCropToolbar'] && (this.currentToolbar == 'resize-toolbar' || this.currentToolbar == 'frame-toolbar')) {
22295
- this.updateToolbar(this.element, 'imageLoaded');
22296
- }
22297
21485
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
22298
21486
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
22299
21487
  this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
22300
21488
  this.isResizeOkBtn = false;
22301
21489
  this.notify('draw', { prop: 'redrawDownScale' });
22302
21490
  this.isChangesSaved = false;
22303
- this.triggerActionComplete();
22304
21491
  }
22305
21492
  /**
22306
21493
  * Set the temporary filter properties.
@@ -22359,18 +21546,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22359
21546
  const data = this.getImageData();
22360
21547
  if (ctWrapper) {
22361
21548
  ctWrapper.classList.remove('e-hide');
22362
- if (isBlazor()) {
22363
- this.element.querySelector('.e-ie-toolbar-check-btn').classList.remove('e-hidden');
22364
- this.element.querySelector('.e-ie-toolbar-close-btn').classList.remove('e-hidden');
22365
- }
22366
21549
  }
22367
- if (!isBlazor()) {
22368
- if (!Browser.isDevice) {
22369
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
22370
- isApplyBtn: true, isCropping: false } });
22371
- }
22372
- this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
21550
+ if (!Browser.isDevice) {
21551
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
21552
+ isApplyBtn: true, isCropping: false } });
22373
21553
  }
21554
+ this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
22374
21555
  this.objColl = objColl;
22375
21556
  this.pointColl = pointColl;
22376
21557
  this.freehandCounter = pointColl.length;
@@ -22388,25 +21569,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22388
21569
  * @returns {void}.
22389
21570
  */
22390
21571
  setCurrAdjustmentValue(type, value) {
22391
- const finetuneValueChanging = { finetune: this.getFinetuneOption(type),
22392
- value: value, cancel: false };
22393
- if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
22394
- finetuneValueChanging.value = parseInt(finetuneValueChanging.value.toString());
22395
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
22396
- this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanging', finetuneValueChanging, null).then((finetuneValueChanging) => {
22397
- if (finetuneValueChanging.cancel) {
22398
- return;
22399
- }
22400
- this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
22401
- });
22402
- }
22403
- else {
22404
- this.trigger('finetuneValueChanging', finetuneValueChanging);
22405
- if (finetuneValueChanging.cancel) {
22406
- return;
22407
- }
22408
- this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
21572
+ const finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
21573
+ this.trigger('finetuneValueChanging', finetuneValueChanging);
21574
+ if (finetuneValueChanging.cancel) {
21575
+ return;
22409
21576
  }
21577
+ this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
22410
21578
  }
22411
21579
  /**
22412
21580
  * Get the square point for path.
@@ -22500,24 +21668,22 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22500
21668
  currentText: null, previousFilter: null, isCircleCrop: null } });
22501
21669
  }
22502
21670
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
22503
- if (!isBlazor()) {
22504
- if (Browser.isDevice) {
22505
- if (document.getElementById(this.element.id + '_bottomToolbar')) {
22506
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
22507
- const toolbar = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
22508
- toolbar.refreshOverflow();
22509
- }
21671
+ if (Browser.isDevice) {
21672
+ if (document.getElementById(this.element.id + '_bottomToolbar')) {
21673
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
21674
+ const toolbar = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
21675
+ toolbar.refreshOverflow();
22510
21676
  }
22511
- else {
22512
- if (document.getElementById(this.element.id + '_toolbar')) {
22513
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
22514
- const toolbar = getComponent(this.element.id + '_toolbar', 'toolbar');
22515
- toolbar.refreshOverflow();
22516
- }
21677
+ }
21678
+ else {
21679
+ if (document.getElementById(this.element.id + '_toolbar')) {
21680
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
21681
+ const toolbar = getComponent(this.element.id + '_toolbar', 'toolbar');
21682
+ toolbar.refreshOverflow();
22517
21683
  }
22518
21684
  }
22519
21685
  const shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
22520
- this.triggerShapeChanged(shapeChangedArgs);
21686
+ this.trigger('shapeChange', shapeChangedArgs);
22521
21687
  }
22522
21688
  /**
22523
21689
  * Apply Font style for text.
@@ -22588,7 +21754,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22588
21754
  }
22589
21755
  const shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22590
21756
  shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
22591
- this.triggerShapeChanged(shapeChangedArgs);
21757
+ this.trigger('shapeChange', shapeChangedArgs);
22592
21758
  }
22593
21759
  /**
22594
21760
  * Apply Font size for text.
@@ -22690,7 +21856,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22690
21856
  }
22691
21857
  const shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22692
21858
  shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
22693
- this.triggerShapeChanged(shapeChangedArgs);
21859
+ this.trigger('shapeChange', shapeChangedArgs);
22694
21860
  }
22695
21861
  /**
22696
21862
  * Apply Font color for text.
@@ -22761,7 +21927,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22761
21927
  }
22762
21928
  const shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22763
21929
  shapeChangedArgs.currentShapeSettings.fillColor = value;
22764
- this.triggerShapeChanged(shapeChangedArgs);
21930
+ this.trigger('shapeChange', shapeChangedArgs);
22765
21931
  }
22766
21932
  /**
22767
21933
  * Apply Pen stroke width.
@@ -22816,7 +21982,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22816
21982
  shapeSettings.type = ShapeType.FreehandDraw;
22817
21983
  const shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22818
21984
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
22819
- this.triggerShapeChanged(shapeChangedArgs);
21985
+ this.trigger('shapeChange', shapeChangedArgs);
22820
21986
  }
22821
21987
  /**
22822
21988
  * Apply Pen stroke color.
@@ -22886,7 +22052,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22886
22052
  shapeSettings.type = ShapeType.FreehandDraw;
22887
22053
  const shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22888
22054
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
22889
- this.triggerShapeChanged(shapeChangedArgs);
22055
+ this.trigger('shapeChange', shapeChangedArgs);
22890
22056
  }
22891
22057
  /**
22892
22058
  * Apply Shape stroke width.
@@ -22932,7 +22098,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22932
22098
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
22933
22099
  const shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22934
22100
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
22935
- this.triggerShapeChanged(shapeChangedArgs);
22101
+ this.trigger('shapeChange', shapeChangedArgs);
22936
22102
  }
22937
22103
  else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
22938
22104
  this.activeObj.pointColl.length === 0)) {
@@ -22989,7 +22155,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22989
22155
  }
22990
22156
  const shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22991
22157
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
22992
- this.triggerShapeChanged(shapeChangedArgs);
22158
+ this.trigger('shapeChange', shapeChangedArgs);
22993
22159
  }
22994
22160
  /**
22995
22161
  * Apply Shape fill color.
@@ -23029,7 +22195,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23029
22195
  }
23030
22196
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
23031
22197
  const shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
23032
- this.triggerShapeChanged(shapeChangedArgs);
22198
+ this.trigger('shapeChange', shapeChangedArgs);
23033
22199
  }
23034
22200
  /**
23035
22201
  * Apply horizontal flip.
@@ -23060,9 +22226,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23060
22226
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23061
22227
  this.objColl.pop();
23062
22228
  }
23063
- if (!isBlazor()) {
23064
- this.notify('toolbar', { prop: 'refreshSlider' });
23065
- }
22229
+ this.notify('toolbar', { prop: 'refreshSlider' });
23066
22230
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
23067
22231
  const activePoint = this.duplicateImage();
23068
22232
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
@@ -23108,9 +22272,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23108
22272
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23109
22273
  this.objColl.pop();
23110
22274
  }
23111
- if (!isBlazor()) {
23112
- this.notify('toolbar', { prop: 'refreshSlider' });
23113
- }
22275
+ this.notify('toolbar', { prop: 'refreshSlider' });
23114
22276
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
23115
22277
  const activePoint = this.duplicateImage();
23116
22278
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
@@ -23154,9 +22316,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23154
22316
  value: { obj: selPointCollObj } });
23155
22317
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23156
22318
  this.objColl.pop();
23157
- if (!isBlazor()) {
23158
- this.notify('toolbar', { prop: 'refreshSlider' });
23159
- }
22319
+ this.notify('toolbar', { prop: 'refreshSlider' });
23160
22320
  if (rotate === 'rotleft') {
23161
22321
  this.activeObj.rotatedAngle -= (90 * (Math.PI / 180));
23162
22322
  }
@@ -23173,14 +22333,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23173
22333
  previousCropObj: prevCropObj, previousText: null,
23174
22334
  currentText: null, previousFilter: null, isCircleCrop: null } });
23175
22335
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
23176
- if (isBlazor()) {
23177
- this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
23178
- this.updateToolbar(this.element, 'quickAccessToolbar', 'image');
23179
- }
23180
- else {
23181
- this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
23182
- this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
23183
- }
22336
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
22337
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
23184
22338
  }
23185
22339
  /**
23186
22340
  * Get pascalToSplitWords from string.
@@ -23239,6 +22393,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23239
22393
  * @returns {void}.
23240
22394
  */
23241
22395
  transformSelect(type) {
22396
+ if (this.transform.straighten === 0 && (type === 'rotateleft' || type === 'rotateright') &&
22397
+ 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',
22398
+ 'crop-9:16', 'crop-16:9'].indexOf(this.activeObj.shape) !== -1) {
22399
+ this.activeObj.shape = 'crop-' + this.activeObj.shape.split('-')[1].split(':')[1] + ':' + this.activeObj.shape.split('-')[1].split(':')[0];
22400
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: this.activeObj.shape, isTransform: true } });
22401
+ }
23242
22402
  this.isCropToolbar = true;
23243
22403
  this.allowDownScale = false;
23244
22404
  const straighten = this.transform.straighten;
@@ -23335,12 +22495,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23335
22495
  */
23336
22496
  setStraighten(value, isMethod) {
23337
22497
  const straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
23338
- if (isBlazor()) {
23339
- this.prevStraightenEvent = this.transform.straighten;
23340
- }
23341
- else {
23342
- this.trigger('rotating', straightenEventArgs);
23343
- }
22498
+ this.trigger('rotating', straightenEventArgs);
23344
22499
  if (!straightenEventArgs.cancel) {
23345
22500
  this.performStraighten(straightenEventArgs);
23346
22501
  }
@@ -23465,85 +22620,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23465
22620
  }
23466
22621
  return flipState;
23467
22622
  }
23468
- // Blazor codes
23469
- /**
23470
- * To Initialize the component rendering
23471
- *
23472
- * @private
23473
- * @param {HTMLCanvasElement} element - Specifies the canvas element.
23474
- * @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
23475
- * @returns {void}
23476
- */
23477
- initializeImageEditor(element, dotnetRef) {
23478
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23479
- this.element = element;
23480
- if (isBlazor() && this.element.querySelector('.place-holder')) {
23481
- this.element.querySelector('.place-holder').remove();
23482
- }
23483
- if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
23484
- this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
23485
- this.element.querySelector('.e-ie-drop-content').style.display = 'block';
23486
- }
23487
- if (isBlazor() && this.element.querySelector('.e-ie-drop-area')) {
23488
- this.element.querySelector('.e-ie-drop-area').style.display = 'block';
23489
- }
23490
- if (isBlazor() && this.element.querySelector('.e-toolbar-area')) {
23491
- this.element.querySelector('.e-toolbar-area').style.display = 'block';
23492
- }
23493
- const canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
23494
- if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
23495
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').scrollHeight;
23496
- }
23497
- else {
23498
- this.toolbarHeight = 0;
23499
- }
23500
- canvasWrapper.style.height = (this.element.offsetHeight - this.toolbarHeight - 2) + 'px';
23501
- canvasWrapper.style.width = (this.element.offsetWidth - 2) + 'px';
23502
- this.lowerCanvas = this.element.querySelector('.e-lower-canvas');
23503
- this.upperCanvas = this.element.querySelector('.e-upper-canvas');
23504
- this.lowerCanvas.id = this.element.id + '_lowerCanvas';
23505
- this.upperCanvas.id = this.element.id + '_upperCanvas';
23506
- this.textArea = this.element.querySelector('.e-textarea');
23507
- this.inMemoryCanvas = this.createElement('canvas', {
23508
- id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
23509
- });
23510
- this.baseImgCanvas = this.createElement('canvas', {
23511
- id: this.element.id + '_baseImgCanvas', attrs: { name: 'canvasImage' }
23512
- });
23513
- this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
23514
- this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
23515
- this.lowerContext = this.lowerCanvas.getContext('2d');
23516
- this.baseImg = this.createElement('img', {
23517
- id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
23518
- });
23519
- this.upperContext = this.upperCanvas.getContext('2d');
23520
- this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
23521
- if (dotnetRef) {
23522
- this.dotNetRef = dotnetRef;
23523
- }
23524
- this.prerender();
23525
- this.wireEvent();
23526
- this.lowerContext.filter = this.getDefaultFilter();
23527
- this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
23528
- this.canvasFilter = this.initialAdjustmentValue = this.lowerContext.filter;
23529
- if (this.cssClass) {
23530
- addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
23531
- }
23532
- if (this.element) {
23533
- createSpinner({
23534
- target: this.element
23535
- });
23536
- }
23537
- this.initializeZoomSettings();
23538
- }
23539
- prerender() {
23540
- // pre render code snippets
23541
- this.element.id = this.element.id || getUniqueID('ej2-image-editor');
23542
- if (Browser.isDevice) {
23543
- this.element.classList.add('e-device');
23544
- }
23545
- this.initializeThemeColl();
23546
- }
23547
22623
  initializeZoomSettings() {
23548
22624
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23549
22625
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
@@ -23576,57 +22652,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23576
22652
  Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' }
23577
22653
  };
23578
22654
  }
23579
- /**
23580
- * Get the square point for path.
23581
- *
23582
- * @param { HTMLDivElement } element - Specifies element.
23583
- * @param { string } type - Specifies the type.
23584
- * @param { string } value - Specifies the value.
23585
- * @hidden
23586
- * @private
23587
- * @returns {void}.
23588
- */
23589
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
23590
- updateToolbar(element, type, value) {
23591
- }
23592
- /**
23593
- * Trigger the shapeChanging event for after the shape applied.
23594
- *
23595
- * @param { ShapeChangeEventArgs } shapeChangedArgs - Specifies the shapeChaning event args.
23596
- * @hidden
23597
- * @returns {void}.
23598
- */
23599
- triggerShapeChanged(shapeChangedArgs) {
23600
- if (isBlazor() && this.events && this.events.shapeChanged.hasDelegate === true) {
23601
- const args = { action: shapeChangedArgs.action, shapeSettings: shapeChangedArgs.currentShapeSettings };
23602
- this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', null, args);
23603
- }
23604
- else {
23605
- this.trigger('shapeChange', shapeChangedArgs);
23606
- }
23607
- }
23608
- triggerActionComplete() {
23609
- const frameChangedArgs = this.curFrameObjEvent;
23610
- const finetuneValueChanged = this.curFinetuneObjEvent;
23611
- const imageFiltered = this.curFilterObjEvent;
23612
- if (isBlazor()) {
23613
- if (this.isFrameBtnClick && this.events && this.events.frameChanged.hasDelegate === true) {
23614
- const frameChangeArgs = { frameSettings: frameChangedArgs.currentFrameSetting };
23615
- this.dotNetRef.invokeMethodAsync('OnFrameChangingAsync', 'FrameChanged', null, frameChangeArgs);
23616
- }
23617
- if (this.isFinetuneBtnClick && this.events && this.events.finetuneValueChanged.hasDelegate === true) {
23618
- const finetuneValueChange = { finetune: this.toPascalCase(finetuneValueChanged.finetune),
23619
- value: parseInt(finetuneValueChanged.value.toString()) };
23620
- this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanged', null, finetuneValueChange);
23621
- }
23622
- if (this.isFilterCanvasClick && this.events && this.events.imageFiltered.hasDelegate === true) {
23623
- const imageFilter = { filter: this.toPascalCase(imageFiltered.filter) };
23624
- this.dotNetRef.invokeMethodAsync('OnImageFilterEventAsync', 'ImageFiltered', null, imageFilter);
23625
- }
23626
- }
23627
- else { }
23628
- this.isFilterCanvasClick = this.isFinetuneBtnClick = this.isFrameBtnClick = false;
23629
- }
23630
22655
  };
23631
22656
  __decorate([
23632
22657
  Property('')
@@ -24254,7 +23279,9 @@ class ToolbarModule {
24254
23279
  args.value['obj']['toolbarHeight'] = this.toolbarHeight;
24255
23280
  break;
24256
23281
  case 'setToolbarHeight':
24257
- this.toolbarHeight = args.value['height'];
23282
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') > -1)) {
23283
+ this.toolbarHeight = args.value['height'];
23284
+ }
24258
23285
  break;
24259
23286
  case 'setCurrentToolbar':
24260
23287
  this.currentToolbar = args.value['type'];
@@ -24338,11 +23365,14 @@ class ToolbarModule {
24338
23365
  this.frameToolbarClick();
24339
23366
  break;
24340
23367
  case 'performCropTransformClick':
24341
- this.performCropTransformClick(args.value['shape']);
23368
+ this.performCropTransformClick(args.value['shape'], args.value['isTransform']);
24342
23369
  break;
24343
23370
  case 'duplicateShape':
24344
23371
  this.duplicateShape(args.value['isPreventUndoRedo'], true);
24345
23372
  break;
23373
+ case 'editText':
23374
+ this.editText();
23375
+ break;
24346
23376
  }
24347
23377
  }
24348
23378
  updatePrivateVariables() {
@@ -24454,6 +23484,13 @@ class ToolbarModule {
24454
23484
  const mToolbar = document.getElementById(id + '_toolbar');
24455
23485
  if (toolbar) {
24456
23486
  this.toolbarHeight = mToolbar.clientHeight;
23487
+ if (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1) {
23488
+ let toolabr = getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar');
23489
+ if (toolabr) {
23490
+ toolabr.destroy();
23491
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
23492
+ }
23493
+ }
24457
23494
  }
24458
23495
  }
24459
23496
  else {
@@ -24533,31 +23570,33 @@ class ToolbarModule {
24533
23570
  const args = { toolbarType: 'main', toolbarItems: this.defToolbarItems };
24534
23571
  parent.trigger('toolbarUpdating', args);
24535
23572
  this.defToolbarItems = args.toolbarItems;
24536
- const toolbarObj = new Toolbar({
24537
- width: '100%',
24538
- items: this.defToolbarItems,
24539
- clicked: this.defToolbarClicked.bind(this),
24540
- created: () => {
24541
- if (!isDevice) {
24542
- this.renderAnnotationBtn();
23573
+ if (this.defToolbarItems.length > 0) {
23574
+ const toolbarObj = new Toolbar({
23575
+ width: '100%',
23576
+ items: this.defToolbarItems,
23577
+ clicked: this.defToolbarClicked.bind(this),
23578
+ created: () => {
23579
+ if (!isDevice) {
23580
+ this.renderAnnotationBtn();
23581
+ }
23582
+ this.wireZoomBtnEvents();
23583
+ this.renderSaveBtn();
23584
+ parent.trigger('toolbarCreated', { toolbarType: 'main' });
24543
23585
  }
24544
- this.wireZoomBtnEvents();
24545
- this.renderSaveBtn();
24546
- parent.trigger('toolbarCreated', { toolbarType: 'main' });
23586
+ });
23587
+ if (isDevice && isFrame) {
23588
+ toolbarObj.appendTo('#' + id + '_bottomToolbar');
23589
+ }
23590
+ else {
23591
+ toolbarObj.appendTo('#' + id + '_toolbar');
23592
+ }
23593
+ this.createLeftToolbarControls();
23594
+ this.enableDisableTbrBtn();
23595
+ if (this.isToolbar() && document.getElementById(id + '_toolbar')) {
23596
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23597
+ const toolbar = getComponent(id + '_toolbar', 'toolbar');
23598
+ toolbar.refreshOverflow();
24547
23599
  }
24548
- });
24549
- if (isDevice && isFrame) {
24550
- toolbarObj.appendTo('#' + id + '_bottomToolbar');
24551
- }
24552
- else {
24553
- toolbarObj.appendTo('#' + id + '_toolbar');
24554
- }
24555
- this.createLeftToolbarControls();
24556
- this.enableDisableTbrBtn();
24557
- if (this.isToolbar() && document.getElementById(id + '_toolbar')) {
24558
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
24559
- const toolbar = getComponent(id + '_toolbar', 'toolbar');
24560
- toolbar.refreshOverflow();
24561
23600
  }
24562
23601
  }
24563
23602
  }
@@ -24591,8 +23630,14 @@ class ToolbarModule {
24591
23630
  const id = parent.element.id;
24592
23631
  const toolbarItems = [];
24593
23632
  if (!isOkBtn || isResize) {
24594
- toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
24595
- toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
23633
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Open') > -1)) {
23634
+ toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
23635
+ toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
23636
+ }
23637
+ else if (Browser.isDevice && (parent.toolbar && parent.toolbar.indexOf('Open') === -1)) {
23638
+ toolbarItems.push({ visible: false, id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
23639
+ toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
23640
+ }
24596
23641
  }
24597
23642
  if (parent.allowUndoRedo && !isResize) {
24598
23643
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
@@ -24723,6 +23768,9 @@ class ToolbarModule {
24723
23768
  const id = parent.element.id;
24724
23769
  const toolbarArea = parent.element.querySelector('#' + id + '_toolbarArea');
24725
23770
  const contextualToolbarArea = parent.element.querySelector('#' + id + '_contextualToolbarArea');
23771
+ if (!contextualToolbarArea) {
23772
+ return;
23773
+ }
24726
23774
  contextualToolbarArea.classList.remove('e-hide');
24727
23775
  contextualToolbarArea.style.left = toolbarArea.offsetLeft + 'px';
24728
23776
  if (type === 'filter') {
@@ -24752,15 +23800,13 @@ class ToolbarModule {
24752
23800
  this.renderSlider(cType, isSelect);
24753
23801
  }
24754
23802
  }
24755
- if (!isBlazor()) {
24756
- if (parent.toolbarTemplate) {
24757
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
24758
- }
24759
- else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
24760
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
24761
- }
24762
- parent.toolbarHeight = this.toolbarHeight;
23803
+ if (parent.toolbarTemplate) {
23804
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
23805
+ }
23806
+ else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
23807
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
24763
23808
  }
23809
+ parent.toolbarHeight = this.toolbarHeight;
24764
23810
  if (Browser.isDevice) {
24765
23811
  let cHt = contextualToolbarArea.offsetHeight + 1;
24766
23812
  const cusWrapper = parent.element.querySelector('#' + id + '_customizeWrapper');
@@ -25545,7 +24591,7 @@ class ToolbarModule {
25545
24591
  }
25546
24592
  return toolbarItems;
25547
24593
  }
25548
- initCropTransformToolbar(shape) {
24594
+ initCropTransformToolbar(shape, isTransform) {
25549
24595
  const parent = this.parent;
25550
24596
  const id = parent.element.id;
25551
24597
  const leftItem = this.getLeftToolbarItem();
@@ -25588,7 +24634,7 @@ class ToolbarModule {
25588
24634
  toolbar.refreshOverflow();
25589
24635
  }
25590
24636
  }
25591
- if (document.getElementById(id + '_cropBtn')) {
24637
+ if (document.getElementById(id + '_cropBtn') && isNullOrUndefined(isTransform)) {
25592
24638
  if (!Browser.isDevice) {
25593
24639
  parent.notify('draw', { prop: 'select', onPropertyChange: false,
25594
24640
  value: { type: this.getCropTextContent(document.getElementById(id + '_cropBtn')).toLowerCase(),
@@ -25785,7 +24831,7 @@ class ToolbarModule {
25785
24831
  },
25786
24832
  beforeClose: () => {
25787
24833
  fillDDB.toggle();
25788
- }
24834
+ },
25789
24835
  }, '#' + id + '_shape_fill');
25790
24836
  const fillDDB = new DropDownButton({
25791
24837
  open: (args) => {
@@ -26257,7 +25303,7 @@ class ToolbarModule {
26257
25303
  fontSizeBtn.appendTo('#' + id + '_fontSizeBtn');
26258
25304
  }
26259
25305
  }
26260
- refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType, shape) {
25306
+ refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType, shape, isTransform) {
26261
25307
  const parent = this.parent;
26262
25308
  const id = parent.element.id;
26263
25309
  if (!parent.isImageLoaded || parent.isCropToolbar) {
@@ -26274,10 +25320,18 @@ class ToolbarModule {
26274
25320
  getComponent(cusWrapper, 'toolbar').destroy();
26275
25321
  cusWrapper.innerHTML = '';
26276
25322
  }
26277
- if (toolbarElement && this.defToolbarItems.length > 0) {
25323
+ if (toolbarElement && toolbarElement.classList.contains('e-control') && this.defToolbarItems.length > 0) {
26278
25324
  getComponent(toolbarElement, 'toolbar').destroy();
26279
25325
  toolbarElement.innerHTML = '';
26280
25326
  }
25327
+ if (toolbarElement && (this.defToolbarItems.length > 0 ||
25328
+ parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1)) {
25329
+ let toolbar = getComponent(toolbarElement, 'toolbar');
25330
+ if (!isNullOrUndefined(toolbar)) {
25331
+ toolbar.destroy();
25332
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
25333
+ }
25334
+ }
26281
25335
  if (bottomToolbar && this.defToolbarItems.length > 0) {
26282
25336
  if (bottomToolbar.className.indexOf('e-control') > -1) {
26283
25337
  getComponent(bottomToolbar, 'toolbar').destroy();
@@ -26378,14 +25432,18 @@ class ToolbarModule {
26378
25432
  this.updateContextualToolbar(type, cType);
26379
25433
  break;
26380
25434
  case 'croptransform':
26381
- parent.allowDownScale = false;
26382
- parent.isCropTab = true;
25435
+ if (isNullOrUndefined(isTransform)) {
25436
+ parent.allowDownScale = false;
25437
+ parent.isCropTab = true;
25438
+ }
26383
25439
  if (Browser.isDevice) {
26384
25440
  this.initMainToolbar(false, true, true);
26385
25441
  }
26386
- parent.updateCropTransformItems();
26387
- this.initCropTransformToolbar(shape);
26388
- if (Browser.isDevice) {
25442
+ if (isNullOrUndefined(isTransform)) {
25443
+ parent.updateCropTransformItems();
25444
+ }
25445
+ this.initCropTransformToolbar(shape, isTransform);
25446
+ if (Browser.isDevice && this.isToolbar()) {
26389
25447
  this.updateContextualToolbar('color', 'straighten', true);
26390
25448
  }
26391
25449
  break;
@@ -26411,17 +25469,21 @@ class ToolbarModule {
26411
25469
  this.currToolbar = type;
26412
25470
  this.refreshDropDownBtn(isCropping);
26413
25471
  }
26414
- performCropTransformClick(shape) {
25472
+ performCropTransformClick(shape, isTransform) {
26415
25473
  const parent = this.parent;
26416
- parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
26417
- parent.tempStraighten = parent.transform.straighten;
26418
- if (parent.currObjType.isFiltered) {
26419
- parent.okBtn();
25474
+ if (isNullOrUndefined(isTransform)) {
25475
+ parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
25476
+ parent.tempStraighten = parent.transform.straighten;
25477
+ if (parent.currObjType.isFiltered) {
25478
+ parent.okBtn();
25479
+ }
25480
+ parent.isStraightening = true;
25481
+ }
25482
+ this.refreshToolbar('croptransform', null, null, null, null, shape, isTransform);
25483
+ if (isNullOrUndefined(isTransform)) {
25484
+ parent.notify('draw', { prop: 'setDestForStraighten' });
25485
+ parent.notify('draw', { prop: 'setTempDestForStraighten' });
26420
25486
  }
26421
- parent.isStraightening = true;
26422
- this.refreshToolbar('croptransform', null, null, null, null, shape);
26423
- parent.notify('draw', { prop: 'setDestForStraighten' });
26424
- parent.notify('draw', { prop: 'setTempDestForStraighten' });
26425
25487
  }
26426
25488
  getAdjustmentToolbarItem() {
26427
25489
  const toolbarItems = [];
@@ -27778,33 +26840,7 @@ class ToolbarModule {
27778
26840
  break;
27779
26841
  case 'edittext':
27780
26842
  if (!parent.element.querySelector('#' + id + '_editText').classList.contains('e-disabled')) {
27781
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
27782
- parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
27783
- value: { obj: extend({}, parent.activeObj, {}, true) } });
27784
- parent.notify('selection', { prop: 'setInitialTextEdit', onPropertyChange: false,
27785
- value: { bool: true } });
27786
- parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
27787
- value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
27788
- if (parent.activeObj.rotatedAngle !== 0) {
27789
- const object = { x: points.x, y: points.y };
27790
- parent.notify('shape', { prop: 'getTextBoxPosition', onPropertyChange: false,
27791
- value: { obj: parent.activeObj, object: object } });
27792
- points.x = object['x'];
27793
- points.y = object['y'];
27794
- const object1 = { x: points.x, y: points.y };
27795
- parent.notify('shape', { prop: 'setFlipState', onPropertyChange: false,
27796
- value: { x: points.x, y: points.y, obj: parent.activeObj, object: object1 } });
27797
- points.x = object1['x'];
27798
- points.y = object1['y'];
27799
- }
27800
- parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
27801
- value: { x: points.x, y: points.y, actObj: parent.activeObj } });
27802
- if (isNullOrUndefined(parent.activeObj.currIndex)) {
27803
- parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
27804
- }
27805
- if (document.getElementById(id + '_quickAccessToolbarArea')) {
27806
- document.getElementById(id + '_quickAccessToolbarArea').style.display = 'none';
27807
- }
26843
+ this.editText();
27808
26844
  }
27809
26845
  break;
27810
26846
  case 'rotleft':
@@ -27837,6 +26873,37 @@ class ToolbarModule {
27837
26873
  parent.trigger('quickAccessToolbarItemClick', args);
27838
26874
  }
27839
26875
  }
26876
+ editText() {
26877
+ const parent = this.parent;
26878
+ const points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
26879
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
26880
+ parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
26881
+ value: { obj: extend({}, parent.activeObj, {}, true) } });
26882
+ parent.notify('selection', { prop: 'setInitialTextEdit', onPropertyChange: false,
26883
+ value: { bool: true } });
26884
+ parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
26885
+ value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
26886
+ if (parent.activeObj.rotatedAngle !== 0) {
26887
+ const object = { x: points.x, y: points.y };
26888
+ parent.notify('shape', { prop: 'getTextBoxPosition', onPropertyChange: false,
26889
+ value: { obj: parent.activeObj, object: object } });
26890
+ points.x = object['x'];
26891
+ points.y = object['y'];
26892
+ const object1 = { x: points.x, y: points.y };
26893
+ parent.notify('shape', { prop: 'setFlipState', onPropertyChange: false,
26894
+ value: { x: points.x, y: points.y, obj: parent.activeObj, object: object1 } });
26895
+ points.x = object1['x'];
26896
+ points.y = object1['y'];
26897
+ }
26898
+ parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
26899
+ value: { x: points.x, y: points.y, actObj: parent.activeObj } });
26900
+ if (isNullOrUndefined(parent.activeObj.currIndex)) {
26901
+ parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
26902
+ }
26903
+ if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
26904
+ document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
26905
+ }
26906
+ }
27840
26907
  duplicateShape(isPreventUndoRedo, isPublicMethod) {
27841
26908
  const parent = this.parent;
27842
26909
  const tempObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
@@ -28090,7 +27157,6 @@ class ToolbarModule {
28090
27157
  parseFloat(getComponent(aspectRatioHeight, 'numerictextbox').placeholder);
28091
27158
  parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
28092
27159
  }
28093
- parent.cancelCropSelection = null;
28094
27160
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
28095
27161
  height: parent.img.srcHeight };
28096
27162
  this.refreshToolbar('resize');
@@ -28783,91 +27849,93 @@ class ToolbarModule {
28783
27849
  if (!parent.isImageLoaded) {
28784
27850
  return;
28785
27851
  }
28786
- const selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
28787
- const selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
28788
- const selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
28789
- const selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
28790
- const strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
28791
- const fontFamilyElem = parent.element.querySelector('.e-text-font-family');
28792
- const fontSizeElem = parent.element.querySelector('.e-text-font-size');
28793
- const boldBtn = parent.element.querySelector('#' + id + '_bold');
28794
- const italicBtn = parent.element.querySelector('#' + id + '_italic');
28795
- if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
28796
- if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
28797
- parent.activeObj.strokeSettings.strokeWidth = 2;
28798
- }
28799
- if (selFillElem) {
28800
- const value = parent.activeObj.strokeSettings.fillColor;
28801
- if (parent.activeObj.strokeSettings.fillColor === '') {
28802
- selFillElem.classList.add('e-nocolor-item');
28803
- }
28804
- else {
28805
- selFillElem.classList.remove('e-nocolor-item');
28806
- selFillElem.style.background = value;
28807
- }
28808
- if (document.querySelector('#' + id + '_shape_fill')) {
28809
- getComponent(id + '_shape_fill', 'colorpicker').value = value;
28810
- }
28811
- }
28812
- if (selStrokeElem) {
28813
- const value = parent.activeObj.strokeSettings.strokeColor;
28814
- selStrokeElem.style.background = value;
28815
- if (document.querySelector('#' + id + '_shape_stroke')) {
28816
- getComponent(id + '_shape_stroke', 'colorpicker').value = value;
28817
- }
28818
- }
28819
- if (selTextStrokeElem) {
28820
- const value = parent.activeObj.strokeSettings.strokeColor;
28821
- selTextStrokeElem.style.background = value;
28822
- if (document.querySelector('#' + id + '_text_font')) {
28823
- getComponent(id + '_text_font', 'colorpicker').value = value;
27852
+ if (this.isToolbar()) {
27853
+ const selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
27854
+ const selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
27855
+ const selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
27856
+ const selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
27857
+ const strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
27858
+ const fontFamilyElem = parent.element.querySelector('.e-text-font-family');
27859
+ const fontSizeElem = parent.element.querySelector('.e-text-font-size');
27860
+ const boldBtn = parent.element.querySelector('#' + id + '_bold');
27861
+ const italicBtn = parent.element.querySelector('#' + id + '_italic');
27862
+ if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
27863
+ if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
27864
+ parent.activeObj.strokeSettings.strokeWidth = 2;
27865
+ }
27866
+ if (selFillElem) {
27867
+ const value = parent.activeObj.strokeSettings.fillColor;
27868
+ if (parent.activeObj.strokeSettings.fillColor === '') {
27869
+ selFillElem.classList.add('e-nocolor-item');
27870
+ }
27871
+ else {
27872
+ selFillElem.classList.remove('e-nocolor-item');
27873
+ selFillElem.style.background = value;
27874
+ }
27875
+ if (document.querySelector('#' + id + '_shape_fill')) {
27876
+ getComponent(id + '_shape_fill', 'colorpicker').value = value;
27877
+ }
28824
27878
  }
28825
- }
28826
- if (selPenStrokeElem) {
28827
- const value = parent.activeObj.strokeSettings.strokeColor;
28828
- selPenStrokeElem.style.background = value;
28829
- if (document.querySelector('#' + id + '_pen_stroke')) {
28830
- getComponent(id + '_pen_stroke', 'colorpicker').value = value;
27879
+ if (selStrokeElem) {
27880
+ const value = parent.activeObj.strokeSettings.strokeColor;
27881
+ selStrokeElem.style.background = value;
27882
+ if (document.querySelector('#' + id + '_shape_stroke')) {
27883
+ getComponent(id + '_shape_stroke', 'colorpicker').value = value;
27884
+ }
28831
27885
  }
28832
- const obj = { penOpacity: 1 };
28833
- parent.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
28834
- }
28835
- if (fontFamilyElem) {
28836
- if (Browser.isDevice) {
28837
- fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
27886
+ if (selTextStrokeElem) {
27887
+ const value = parent.activeObj.strokeSettings.strokeColor;
27888
+ selTextStrokeElem.style.background = value;
27889
+ if (document.querySelector('#' + id + '_text_font')) {
27890
+ getComponent(id + '_text_font', 'colorpicker').value = value;
27891
+ }
28838
27892
  }
28839
- else {
28840
- fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
27893
+ if (selPenStrokeElem) {
27894
+ const value = parent.activeObj.strokeSettings.strokeColor;
27895
+ selPenStrokeElem.style.background = value;
27896
+ if (document.querySelector('#' + id + '_pen_stroke')) {
27897
+ getComponent(id + '_pen_stroke', 'colorpicker').value = value;
27898
+ }
27899
+ const obj = { penOpacity: 1 };
27900
+ parent.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
28841
27901
  }
28842
- }
28843
- if (fontSizeElem) {
28844
- for (let i = 0; i < parent.fontSizeColl.length; i++) {
28845
- if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
28846
- fontSizeElem.textContent = (i + 1).toString();
28847
- break;
27902
+ if (fontFamilyElem) {
27903
+ if (Browser.isDevice) {
27904
+ fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
27905
+ }
27906
+ else {
27907
+ fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
28848
27908
  }
28849
27909
  }
28850
- }
28851
- if (boldBtn) {
28852
- if (parent.activeObj.textSettings.bold) {
28853
- boldBtn.classList.add('e-selected-btn');
27910
+ if (fontSizeElem) {
27911
+ for (let i = 0; i < parent.fontSizeColl.length; i++) {
27912
+ if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
27913
+ fontSizeElem.textContent = (i + 1).toString();
27914
+ break;
27915
+ }
27916
+ }
28854
27917
  }
28855
- else {
28856
- boldBtn.classList.remove('e-selected-btn');
27918
+ if (boldBtn) {
27919
+ if (parent.activeObj.textSettings.bold) {
27920
+ boldBtn.classList.add('e-selected-btn');
27921
+ }
27922
+ else {
27923
+ boldBtn.classList.remove('e-selected-btn');
27924
+ }
28857
27925
  }
28858
- }
28859
- if (italicBtn) {
28860
- if (parent.activeObj.textSettings.italic) {
28861
- italicBtn.classList.add('e-selected-btn');
27926
+ if (italicBtn) {
27927
+ if (parent.activeObj.textSettings.italic) {
27928
+ italicBtn.classList.add('e-selected-btn');
27929
+ }
27930
+ else {
27931
+ italicBtn.classList.remove('e-selected-btn');
27932
+ }
28862
27933
  }
28863
- else {
28864
- italicBtn.classList.remove('e-selected-btn');
27934
+ if (strokeWidthElem) {
27935
+ const strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
27936
+ strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
28865
27937
  }
28866
27938
  }
28867
- if (strokeWidthElem) {
28868
- const strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
28869
- strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
28870
- }
28871
27939
  }
28872
27940
  }
28873
27941
  getStrokeWidth(text) {