@syncfusion/ej2-image-editor 24.2.8 → 25.1.37

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 (77) hide show
  1. package/CHANGELOG.md +5 -45
  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 +958 -1922
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +993 -1974
  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 +133 -242
  18. package/src/image-editor/action/transform.d.ts +0 -1
  19. package/src/image-editor/action/transform.js +80 -291
  20. package/src/image-editor/action/undo-redo.d.ts +0 -1
  21. package/src/image-editor/action/undo-redo.js +32 -127
  22. package/src/image-editor/base/image-editor-model.d.ts +1 -1
  23. package/src/image-editor/base/image-editor.d.ts +51 -42
  24. package/src/image-editor/base/image-editor.js +316 -425
  25. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  26. package/src/image-editor/renderer/toolbar.js +228 -207
  27. package/styles/bootstrap-dark.css +0 -12
  28. package/styles/bootstrap.css +0 -12
  29. package/styles/bootstrap4.css +0 -12
  30. package/styles/bootstrap5-dark.css +0 -12
  31. package/styles/bootstrap5.css +0 -12
  32. package/styles/fabric-dark.css +0 -12
  33. package/styles/fabric.css +0 -12
  34. package/styles/fluent-dark.css +0 -12
  35. package/styles/fluent.css +0 -12
  36. package/styles/highcontrast-light.css +0 -12
  37. package/styles/highcontrast.css +0 -12
  38. package/styles/image-editor/_bds-definition.scss +21 -0
  39. package/styles/image-editor/_bootstrap-dark-definition.scss +0 -1
  40. package/styles/image-editor/_bootstrap-definition.scss +0 -1
  41. package/styles/image-editor/_bootstrap4-definition.scss +0 -1
  42. package/styles/image-editor/_bootstrap5-definition.scss +0 -1
  43. package/styles/image-editor/_fabric-dark-definition.scss +0 -1
  44. package/styles/image-editor/_fabric-definition.scss +0 -1
  45. package/styles/image-editor/_fluent-definition.scss +0 -1
  46. package/styles/image-editor/_fusionnew-definition.scss +0 -1
  47. package/styles/image-editor/_highcontrast-definition.scss +0 -1
  48. package/styles/image-editor/_highcontrast-light-definition.scss +0 -1
  49. package/styles/image-editor/_layout.scss +5 -32
  50. package/styles/image-editor/_material-dark-definition.scss +0 -1
  51. package/styles/image-editor/_material-definition.scss +0 -1
  52. package/styles/image-editor/_material3-definition.scss +2 -3
  53. package/styles/image-editor/_tailwind-definition.scss +0 -1
  54. package/styles/image-editor/bootstrap-dark.css +0 -12
  55. package/styles/image-editor/bootstrap.css +0 -12
  56. package/styles/image-editor/bootstrap4.css +0 -12
  57. package/styles/image-editor/bootstrap5-dark.css +0 -12
  58. package/styles/image-editor/bootstrap5.css +0 -12
  59. package/styles/image-editor/fabric-dark.css +0 -12
  60. package/styles/image-editor/fabric.css +0 -12
  61. package/styles/image-editor/fluent-dark.css +0 -12
  62. package/styles/image-editor/fluent.css +0 -12
  63. package/styles/image-editor/highcontrast-light.css +0 -12
  64. package/styles/image-editor/highcontrast.css +0 -12
  65. package/styles/image-editor/icons/_bds.scss +411 -0
  66. package/styles/image-editor/material-dark.css +0 -12
  67. package/styles/image-editor/material.css +0 -12
  68. package/styles/image-editor/material3-dark.css +5 -25
  69. package/styles/image-editor/material3.css +5 -25
  70. package/styles/image-editor/tailwind-dark.css +2 -14
  71. package/styles/image-editor/tailwind.css +2 -14
  72. package/styles/material-dark.css +0 -12
  73. package/styles/material.css +0 -12
  74. package/styles/material3-dark.css +5 -25
  75. package/styles/material3.css +5 -25
  76. package/styles/tailwind-dark.css +2 -14
  77. package/styles/tailwind.css +2 -14
@@ -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;
@@ -14077,6 +13550,8 @@ class Shape {
14077
13550
  endX: parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width,
14078
13551
  endY: parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height,
14079
13552
  width: selectionSettings.width, height: selectionSettings.height };
13553
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
13554
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14080
13555
  }
14081
13556
  updateShapeChangeEventArgs(shapeSettings) {
14082
13557
  const parent = this.parent;
@@ -14107,15 +13582,10 @@ class Shape {
14107
13582
  }
14108
13583
  switch (parent.activeObj.shape) {
14109
13584
  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
- }
13585
+ parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
13586
+ parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
13587
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
13588
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14119
13589
  if (shapeSettings.degree) {
14120
13590
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14121
13591
  }
@@ -14123,15 +13593,13 @@ class Shape {
14123
13593
  case 'line':
14124
13594
  case 'arrow':
14125
13595
  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
- }
13596
+ parent.activeObj.activePoint.endX = shapeSettings.endX;
13597
+ parent.activeObj.activePoint.endY = shapeSettings.endY;
13598
+ parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
13599
+ parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
13600
+ if (parent.activeObj.shape === 'arrow') {
13601
+ parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
13602
+ parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
14135
13603
  }
14136
13604
  break;
14137
13605
  case 'text':
@@ -14142,6 +13610,7 @@ class Shape {
14142
13610
  if (shapeSettings.degree) {
14143
13611
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14144
13612
  }
13613
+ this.updateFontRatio(parent.activeObj);
14145
13614
  break;
14146
13615
  case 'rectangle':
14147
13616
  case 'image':
@@ -14155,6 +13624,9 @@ class Shape {
14155
13624
  break;
14156
13625
  }
14157
13626
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
13627
+ parent.activeObj.textSettings.bold = false;
13628
+ parent.activeObj.textSettings.italic = false;
13629
+ parent.activeObj.textSettings.underline = false;
14158
13630
  for (let i = 0; i < shapeSettings.fontStyle.length; i++) {
14159
13631
  switch (shapeSettings.fontStyle[i]) {
14160
13632
  case 'bold':
@@ -14873,12 +14345,7 @@ class Shape {
14873
14345
  const parent = this.parent;
14874
14346
  const degree = this.getRotDegOfShape(parent.activeObj);
14875
14347
  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
- }
14348
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
14882
14349
  const dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
14883
14350
  const removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
14884
14351
  const editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
@@ -15191,12 +14658,7 @@ class Shape {
15191
14658
  if (parent.objColl[parent.objColl.length - 1]) {
15192
14659
  parent.selectShape(parent.objColl[parent.objColl.length - 1].currIndex);
15193
14660
  }
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
- }
14661
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
15200
14662
  const obj = { shapeSettingsObj: {} };
15201
14663
  parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
15202
14664
  const shapeSettings = obj['shapeSettingsObj'];
@@ -15242,16 +14704,11 @@ class Shape {
15242
14704
  parent.notify('selection', { prop: 'setTouchEndPoint', onPropertyChange: false,
15243
14705
  value: { x: e.touches[0].clientX, y: e.touches[0].clientY } });
15244
14706
  }
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
- }
14707
+ parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: true } });
14708
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
14709
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
14710
+ parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: false } });
14711
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
15255
14712
  if (!isNullOrUndefined(x) && !isNullOrUndefined(y)) {
15256
14713
  const bbox = parent.lowerCanvas.getBoundingClientRect();
15257
14714
  x -= bbox.left;
@@ -15441,11 +14898,9 @@ class Shape {
15441
14898
  const URL = window.URL;
15442
14899
  const url = URL.createObjectURL(e.target.files[0]);
15443
14900
  this.onLoadImgShape(null, null, null, null, url.toString(), true);
15444
- if (!isBlazor()) {
15445
- document.getElementById(this.parent.element.id + '_fileUpload').value = '';
15446
- }
14901
+ document.getElementById(this.parent.element.id + '_fileUpload').value = '';
15447
14902
  }
15448
- onLoadImgShape(x, y, width, height, url, isSelect, degree, isAspectRatio, opacity) {
14903
+ onLoadImgShape(x, y, width, height, url, isSelect, degree, isAspectRatio, opacity, isSelected) {
15449
14904
  // eslint-disable-next-line @typescript-eslint/no-this-alias
15450
14905
  const proxy = this;
15451
14906
  const parent = this.parent;
@@ -15463,10 +14918,10 @@ class Shape {
15463
14918
  this.initShapeProps();
15464
14919
  this.shapeImg.onload = () => {
15465
14920
  proxy.upperContext.drawImage(proxy.shapeImg, 0, 0, proxy.shapeImg.width, proxy.shapeImg.height);
15466
- proxy.updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity);
14921
+ proxy.updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity, isSelected);
15467
14922
  };
15468
14923
  }
15469
- updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity) {
14924
+ updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity, isSelected) {
15470
14925
  const parent = this.parent;
15471
14926
  parent.activeObj.imageElement = this.shapeImg;
15472
14927
  parent.activeObj.imageCanvas = parent.createElement('canvas');
@@ -15515,24 +14970,12 @@ class Shape {
15515
14970
  const shapeSettings = obj['shapeSettingsObj'];
15516
14971
  const shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
15517
14972
  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;
14973
+ parent.trigger('shapeChanging', shapeChangingArgs);
14974
+ this.drawShapeImageEvent(shapeChangingArgs, isSelect);
14975
+ if (parent.isPublicMethod && !isSelected) {
14976
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
15535
14977
  }
14978
+ parent.isPublicMethod = false;
15536
14979
  }
15537
14980
  updateObj(dimObj, x, y) {
15538
14981
  const parent = this.parent;
@@ -15839,7 +15282,7 @@ class Shape {
15839
15282
  }
15840
15283
  const shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
15841
15284
  shapeChangedArgs.currentShapeSettings.fontStyle = [item];
15842
- parent.triggerShapeChanged(shapeChangedArgs);
15285
+ parent.trigger('shapeChange', shapeChangedArgs);
15843
15286
  }
15844
15287
  updateFontStyle(item, objColl, fontWeight, fontStyle) {
15845
15288
  const parent = this.parent;
@@ -16064,12 +15507,7 @@ class Shape {
16064
15507
  parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
16065
15508
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
16066
15509
  }
16067
- if (!isBlazor()) {
16068
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
16069
- }
16070
- else {
16071
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
16072
- }
15510
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
16073
15511
  if (isNullOrUndefined(isMouseDown)) {
16074
15512
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
16075
15513
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
@@ -16235,13 +15673,6 @@ class Shape {
16235
15673
  shapeDetails.height = obj.activePoint.height;
16236
15674
  shapeDetails.opacity = obj.opacity;
16237
15675
  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
15676
  }
16246
15677
  return shapeDetails;
16247
15678
  }
@@ -16259,7 +15690,12 @@ class Shape {
16259
15690
  const parent = this.parent;
16260
15691
  let shapeDetails;
16261
15692
  if (!parent.disabled && parent.isImageLoaded) {
16262
- this.applyActObj();
15693
+ if (parent.textArea.style.display !== 'none') {
15694
+ parent.okBtn();
15695
+ }
15696
+ else {
15697
+ this.applyActObj(true);
15698
+ }
16263
15699
  if (id.split('_')[0] === 'shape') {
16264
15700
  let obj;
16265
15701
  for (let i = 0, len = parent.objColl.length; i < len; i++) {
@@ -16280,7 +15716,12 @@ class Shape {
16280
15716
  const parent = this.parent;
16281
15717
  const shapeDetailsColl = [];
16282
15718
  if (!parent.disabled && parent.isImageLoaded) {
16283
- this.applyActObj();
15719
+ if (parent.textArea.style.display !== 'none') {
15720
+ parent.okBtn();
15721
+ }
15722
+ else {
15723
+ this.applyActObj(true);
15724
+ }
16284
15725
  for (let i = 0, len = parent.objColl.length; i < len; i++) {
16285
15726
  const shapeDetails = this.getObjDetails(parent.objColl[i]);
16286
15727
  shapeDetailsColl.push(shapeDetails);
@@ -16430,31 +15871,20 @@ class Shape {
16430
15871
  this.lowerContext.filter = object['canvasFilter'];
16431
15872
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
16432
15873
  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 } });
15874
+ if (parent.activeObj.shape === 'text') {
15875
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
15876
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
15877
+ }
15878
+ else if (parent.activeObj.shape === 'pen') {
15879
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
15880
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16448
15881
  }
16449
15882
  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
- }
15883
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
15884
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
16457
15885
  }
15886
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
15887
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
16458
15888
  }
16459
15889
  }
16460
15890
  else if (id.split('_')[0] === 'pen') {
@@ -16468,14 +15898,8 @@ class Shape {
16468
15898
  if (obj['isIndex']) {
16469
15899
  isSelected = true;
16470
15900
  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
- }
15901
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
15902
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
16479
15903
  }
16480
15904
  else {
16481
15905
  isSelected = false;
@@ -16487,29 +15911,29 @@ class Shape {
16487
15911
  deleteShape(id) {
16488
15912
  const parent = this.parent;
16489
15913
  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;
15914
+ if (parent.activeObj.currIndex && parent.activeObj.currIndex === id) {
15915
+ parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
15916
+ }
15917
+ else {
15918
+ this.applyActObj();
15919
+ if (id.split('_')[0] === 'shape') {
15920
+ for (let i = 0, len = parent.objColl.length; i < len; i++) {
15921
+ if (parent.objColl[i].currIndex === id) {
15922
+ parent.objColl.splice(i, 1);
15923
+ break;
15924
+ }
16496
15925
  }
16497
15926
  }
16498
- }
16499
- else if (id.split('_')[0] === 'pen') {
16500
- parent.notify('freehand-draw', { prop: 'handle-freehand-draw', value: { id: id } });
15927
+ else if (id.split('_')[0] === 'pen') {
15928
+ parent.notify('freehand-draw', { prop: 'handle-freehand-draw', value: { id: id } });
15929
+ }
16501
15930
  }
16502
15931
  const object = { canvasFilter: null };
16503
15932
  parent.notify('toolbar', { prop: 'getCanvasFilter', onPropertyChange: false, value: { obj: object } });
16504
15933
  this.lowerContext.filter = object['canvasFilter'];
16505
15934
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
16506
15935
  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
- }
15936
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
16513
15937
  }
16514
15938
  }
16515
15939
  getMaxText(isTextBox, text, obj) {
@@ -16960,18 +16384,10 @@ class Transform {
16960
16384
  const parent = this.parent;
16961
16385
  const transitionArgs = { cancel: false, previousDegree: parent.transform.degree,
16962
16386
  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);
16387
+ if (!this.isPreventSelect) {
16388
+ parent.trigger('rotating', transitionArgs);
16974
16389
  }
16390
+ this.rotateEvent(transitionArgs, degree);
16975
16391
  }
16976
16392
  rotateEvent(transitionArgs, degree) {
16977
16393
  const parent = this.parent;
@@ -17033,16 +16449,6 @@ class Transform {
17033
16449
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
17034
16450
  this.prevZoomValue = parent.zoomSettings.zoomFactor;
17035
16451
  }
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
16452
  }
17047
16453
  else {
17048
16454
  parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: parent.prevEventObjPoint } });
@@ -17149,18 +16555,10 @@ class Transform {
17149
16555
  const parent = this.parent;
17150
16556
  const transitionArgs = { direction: direction, cancel: false,
17151
16557
  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);
16558
+ if (!this.isPreventSelect) {
16559
+ parent.trigger('flipping', transitionArgs);
17163
16560
  }
16561
+ this.flipEvent(transitionArgs, direction);
17164
16562
  }
17165
16563
  flipEvent(transitionArgs, direction) {
17166
16564
  const parent = this.parent;
@@ -17306,12 +16704,6 @@ class Transform {
17306
16704
  parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
17307
16705
  this.prevZoomValue = parent.zoomSettings.zoomFactor;
17308
16706
  }
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
16707
  }
17316
16708
  updateFlipState(direction) {
17317
16709
  const degree = this.parent.transform.degree;
@@ -17390,9 +16782,7 @@ class Transform {
17390
16782
  if (isNullOrUndefined(isResize) && (parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor && zoomFactor > 0 ||
17391
16783
  (parent.zoomSettings.zoomFactor > parent.zoomSettings.minZoomFactor && zoomFactor < 0 && this.disableZoomOutBtn(true)) ||
17392
16784
  (parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor && zoomFactor < 0))) {
17393
- if (!isBlazor()) {
17394
- parent.notify('toolbar', { prop: 'zoom-up-handler', onPropertyChange: false });
17395
- }
16785
+ parent.notify('toolbar', { prop: 'zoom-up-handler', onPropertyChange: false });
17396
16786
  return;
17397
16787
  }
17398
16788
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
@@ -17448,31 +16838,10 @@ class Transform {
17448
16838
  const previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
17449
16839
  const zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
17450
16840
  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);
16841
+ if (!parent.isCropToolbar && parent.isZoomBtnClick) {
16842
+ parent.trigger('zooming', zoomEventArgs);
17463
16843
  }
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';
16844
+ this.zoomEvent(zoomEventArgs, zoomFactor, isPreventApply);
17476
16845
  }
17477
16846
  }
17478
16847
  zoomEvent(zoomEventArgs, zoomFact, isPreventApply) {
@@ -17482,13 +16851,7 @@ class Transform {
17482
16851
  parent.isZoomBtnClick = false;
17483
16852
  return;
17484
16853
  }
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
- }
16854
+ parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
17492
16855
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
17493
16856
  value: { x: null, y: null, isMouseDown: true } });
17494
16857
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -17585,25 +16948,14 @@ class Transform {
17585
16948
  }
17586
16949
  parent.isUndoRedo = false;
17587
16950
  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
- }
16951
+ zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
16952
+ if (zoomOut && zoomFactor <= minZoomFactor) {
16953
+ zoomOut.classList.add('e-disabled');
16954
+ zoomOut.parentElement.classList.add('e-overlay');
17598
16955
  }
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
- }
16956
+ else if (zoomOut) {
16957
+ zoomOut.classList.remove('e-disabled');
16958
+ zoomOut.parentElement.classList.remove('e-overlay');
17607
16959
  }
17608
16960
  this.autoEnablePan();
17609
16961
  if (this.tempActiveObj) {
@@ -17624,26 +16976,13 @@ class Transform {
17624
16976
  parent.objColl.pop();
17625
16977
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
17626
16978
  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');
16979
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
16980
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
17637
16981
  }
16982
+ parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
17638
16983
  parent.notify('selection', { prop: 'setZoomType', onPropertyChange: false, value: { zoomType: 'Toolbar' } });
17639
16984
  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) {
16985
+ if (!parent.isCropToolbar && parent.isZoomBtnClick) {
17647
16986
  parent.isZoomBtnClick = false;
17648
16987
  }
17649
16988
  }
@@ -17655,12 +16994,7 @@ class Transform {
17655
16994
  if (!isNullOrUndefined(isZoomOut)) {
17656
16995
  parent.transform.zoomFactor -= 0.1;
17657
16996
  }
17658
- if (isBlazor()) {
17659
- zoomOut = parent.element.querySelector('#zoomout');
17660
- }
17661
- else {
17662
- zoomOut = parent.element.querySelector('#' + parent.element.id + '_zoomOut');
17663
- }
16997
+ zoomOut = parent.element.querySelector('#' + parent.element.id + '_zoomOut');
17664
16998
  const destPoints = { destLeft: parent.img.destLeft, destTop: parent.img.destTop,
17665
16999
  destWidth: parent.img.destWidth, destHeight: parent.img.destHeight };
17666
17000
  if (parent.activeObj.shape) {
@@ -17672,23 +17006,13 @@ class Transform {
17672
17006
  actPoint.startY || parent.img.destLeft + parent.img.destWidth <
17673
17007
  actPoint.endX || parent.img.destTop + parent.img.destHeight < actPoint.endY
17674
17008
  || 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
- }
17009
+ zoomOut.classList.add('e-disabled');
17010
+ zoomOut.parentElement.classList.add('e-overlay');
17682
17011
  isDisabled = true;
17683
17012
  }
17684
17013
  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
- }
17014
+ zoomOut.classList.remove('e-disabled');
17015
+ zoomOut.parentElement.classList.remove('e-overlay');
17692
17016
  isDisabled = false;
17693
17017
  }
17694
17018
  }
@@ -17700,23 +17024,13 @@ class Transform {
17700
17024
  parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
17701
17025
  if (obj['isIntersect'] ||
17702
17026
  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
- }
17027
+ zoomOut.classList.add('e-disabled');
17028
+ zoomOut.parentElement.classList.add('e-overlay');
17710
17029
  isDisabled = true;
17711
17030
  }
17712
17031
  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
- }
17032
+ zoomOut.classList.remove('e-disabled');
17033
+ zoomOut.parentElement.classList.remove('e-overlay');
17720
17034
  isDisabled = false;
17721
17035
  }
17722
17036
  }
@@ -17954,18 +17268,8 @@ class Transform {
17954
17268
  const obj = { panDown: null };
17955
17269
  parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
17956
17270
  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
- }
17271
+ parent.trigger('panning', panEventArgs);
17272
+ this.panEvent(panEventArgs, xDiff, yDiff);
17969
17273
  }
17970
17274
  panEvent(panEventArgs, xDiff, yDiff) {
17971
17275
  if (panEventArgs.cancel) {
@@ -18416,44 +17720,25 @@ class Transform {
18416
17720
  }
18417
17721
  const frameObj = { bool: null };
18418
17722
  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
17723
  if (!straightenObj['bool'] && ((ctToolbar && !ctToolbar.parentElement.classList.contains('e-hide')) ||
18424
17724
  (hdWrapper && !hdWrapper.parentElement.classList.contains('e-hide')))) {
18425
17725
  ctWrapper.classList.add('e-hide');
18426
17726
  if (!isCropSelection) {
18427
17727
  parent.okBtn();
18428
17728
  }
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
- }
17729
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
17730
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18436
17731
  }
18437
17732
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
18438
17733
  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
- }
17734
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18445
17735
  }
18446
17736
  if (parent.activeObj.shape !== undefined) {
18447
17737
  isActiveObj = true;
18448
17738
  if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
18449
17739
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
18450
17740
  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
- }
17741
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18457
17742
  }
18458
17743
  else {
18459
17744
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
@@ -18473,9 +17758,15 @@ class Transform {
18473
17758
  }
18474
17759
  else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
18475
17760
  toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
17761
+ if (toolbarHeight === 0 && parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1) {
17762
+ const obj = { toolbarHeight: 0 };
17763
+ parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
17764
+ toolbarHeight = obj['toolbarHeight'];
17765
+ }
18476
17766
  }
18477
- if (Browser.isDevice && straightenObj['bool']) {
18478
- cxtTbarHeight = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea').clientHeight;
17767
+ const ctxTbarArea = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
17768
+ if (Browser.isDevice && straightenObj['bool'] && ctxTbarArea) {
17769
+ cxtTbarHeight = ctxTbarArea.clientHeight;
18479
17770
  }
18480
17771
  parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
18481
17772
  if (Browser.isDevice) {
@@ -18512,10 +17803,8 @@ class Transform {
18512
17803
  if (canvasWrapper) {
18513
17804
  canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
18514
17805
  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
- }
17806
+ const obj = { toolbarHeight: 0 };
17807
+ parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
18519
17808
  if (Browser.isDevice) {
18520
17809
  canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj['toolbarHeight']) - cxtTbarHeight) - 4 + 'px';
18521
17810
  }
@@ -18567,15 +17856,13 @@ class Transform {
18567
17856
  hideSpinner(parent.element);
18568
17857
  parent.element.style.opacity = '1';
18569
17858
  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
- }
17859
+ parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj1 } });
17860
+ if (obj1['defToolbarItems'] && obj1['defToolbarItems'].length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
17861
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
17862
+ const toolbar = getComponent(parent.element.id + '_toolbar', 'toolbar');
17863
+ toolbar.refreshOverflow();
17864
+ if (ctWrapper && !straightenObj['bool']) {
17865
+ ctWrapper.classList.add('e-hide');
18579
17866
  }
18580
17867
  }
18581
17868
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -18600,43 +17887,23 @@ class Transform {
18600
17887
  if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
18601
17888
  parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' ||
18602
17889
  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
- }
17890
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
18609
17891
  }
18610
17892
  }
18611
17893
  }
18612
17894
  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
- }
17895
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
18619
17896
  }
18620
17897
  if (isFrameToolbar) {
18621
- if (isBlazor()) {
18622
- parent.updateToolbar(parent.element, 'frame');
18623
- }
18624
- else {
18625
- parent.notify('toolbar', { prop: 'callFrameToolbar', onPropertyChange: false });
18626
- }
17898
+ parent.notify('toolbar', { prop: 'callFrameToolbar', onPropertyChange: false });
18627
17899
  }
18628
17900
  else if (parent.isResize) {
18629
17901
  parent.aspectWidth = Math.ceil(parent.img.destWidth);
18630
17902
  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
- }
17903
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
17904
+ isApplyBtn: false, isCropping: false } });
17905
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
17906
+ isApplyBtn: false, isCropping: false } });
18640
17907
  }
18641
17908
  if ((parent.transform.degree !== 0 || parent.transform.currFlipState !== '') && parent.transform.defaultZoomFactor > 0) {
18642
17909
  const totalPannedPoint = extend({}, parent.panPoint.totalPannedPoint, null, true);
@@ -18662,24 +17929,14 @@ class Transform {
18662
17929
  else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
18663
17930
  parent.transform.zoomFactor = 0;
18664
17931
  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
- }
17932
+ parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
18671
17933
  }
18672
17934
  }
18673
17935
  }
18674
17936
  calcMaxDimension(width, height, obj, isImgShape) {
18675
17937
  const object = { toolbarHeight: 0 };
18676
17938
  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
- }
17939
+ parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: object } });
18683
17940
  let canvasMaxWidth = isImgShape ? parent.element.clientWidth / 3 :
18684
17941
  parent.element.clientWidth;
18685
17942
  let canvasMaxHeight = isImgShape ? (parent.element.clientHeight - object['toolbarHeight']) / 3 :
@@ -19029,36 +18286,20 @@ class Transform {
19029
18286
  parent.notify('toolbar', { prop: 'init-main-toolbar', value: { isApplyBtn: false, isDevice: true, isOkBtn: true, isResize: true } });
19030
18287
  }
19031
18288
  }
18289
+ const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
18290
+ const aspectHeight = aspectRatioHeight.value === '' ? aspectRatioHeight.placeholder : aspectRatioHeight.value;
19032
18291
  const resizeEventArgs = { cancel: false, previousWidth: Math.ceil(parent.img.destWidth),
19033
18292
  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)),
18293
+ (isAspectRatio ? Math.ceil(parseFloat(aspectHeight)) : Math.ceil(parent.img.destHeight)),
19035
18294
  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) {
18295
+ parent.trigger('resizing', resizeEventArgs);
18296
+ if (!resizeEventArgs.cancel) {
19060
18297
  this.resizeEventHandler(resizeEventArgs);
19061
18298
  }
18299
+ else if (parent.aspectHeight && parent.aspectWidth) {
18300
+ parent.aspectHeight = resizeEventArgs.previousHeight;
18301
+ parent.aspectWidth = resizeEventArgs.previousWidth;
18302
+ }
19062
18303
  }
19063
18304
  resizeEventHandler(args) {
19064
18305
  const parent = this.parent;
@@ -19077,13 +18318,7 @@ class Transform {
19077
18318
  const originalWidth = parent.img.destWidth;
19078
18319
  const originalHeight = parent.img.destHeight;
19079
18320
  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
- }
18321
+ aspectRatioWidthValue = parseFloat(aspectRatioWidth.value === '' ? aspectRatioWidth.placeholder : aspectRatioWidth.value);
19087
18322
  if (aspectRatioHeight) {
19088
18323
  let value = aspectRatioWidthValue / (originalWidth / originalHeight);
19089
18324
  const height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
@@ -19131,28 +18366,17 @@ class Transform {
19131
18366
  parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
19132
18367
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
19133
18368
  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
- }
18369
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
18370
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
18371
+ parent.notify('transform', { prop: 'setPreventDownScale', value: { bool: false } });
18372
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
18373
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19144
18374
  }
19145
18375
  else {
19146
18376
  parent.notify('transform', { prop: 'resizeCrop', value: { width: args.width, height: args.height } });
19147
18377
  }
19148
18378
  }
19149
18379
  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
18380
  }
19157
18381
  straightenImage(degree) {
19158
18382
  const parent = this.parent;
@@ -19160,13 +18384,7 @@ class Transform {
19160
18384
  parent.notify('draw', { prop: 'select', onPropertyChange: false,
19161
18385
  value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
19162
18386
  }
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
- }
18387
+ parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19170
18388
  parent.setStraighten(degree, true);
19171
18389
  parent.okBtn();
19172
18390
  }
@@ -19272,33 +18490,22 @@ class UndoRedo {
19272
18490
  const parent = this.parent;
19273
18491
  refreshToolbar = refreshToolbar ? refreshToolbar : false;
19274
18492
  if (refreshToolbar) {
19275
- if (!isBlazor()) {
19276
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: true } });
19277
- }
18493
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: true } });
19278
18494
  this.tempUndoRedoColl = extend([], this.appliedUndoRedoColl, [], true);
19279
18495
  this.tempUndoRedoStep = this.undoRedoStep;
19280
18496
  }
19281
- else if (!isBlazor()) {
19282
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19283
- }
18497
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19284
18498
  this.undoRedoColl = this.undoRedoColl.slice(0, this.undoRedoStep);
19285
18499
  this.appliedUndoRedoColl = this.appliedUndoRedoColl.slice(0, this.undoRedoStep);
19286
18500
  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
- }
18501
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19293
18502
  }
19294
18503
  updateCurrUrc(type) {
19295
18504
  const parent = this.parent;
19296
18505
  if (parent.isResize || this.isPreventing) {
19297
18506
  return;
19298
18507
  }
19299
- if (!isBlazor()) {
19300
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19301
- }
18508
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19302
18509
  if (type === 'ok') {
19303
18510
  parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: false } });
19304
18511
  const collection = this.tempUndoRedoColl.length > 0 ?
@@ -19358,12 +18565,7 @@ class UndoRedo {
19358
18565
  this.undoRedoColl = extend([], this.appliedUndoRedoColl, [], true);
19359
18566
  if (type === 'ok') {
19360
18567
  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
- }
18568
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19367
18569
  }
19368
18570
  if (parent.transform.zoomFactor > 0) {
19369
18571
  parent.togglePan = true;
@@ -19389,25 +18591,18 @@ class UndoRedo {
19389
18591
  this.undoRedoStep = this.tempUndoRedoStep;
19390
18592
  this.tempUndoRedoColl = [];
19391
18593
  this.tempUndoRedoStep = 0;
19392
- if (!isBlazor()) {
19393
- parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19394
- }
18594
+ parent.notify('toolbar', { prop: 'setEnableDisableUndoRedo', value: { isPrevent: false } });
19395
18595
  }
19396
18596
  }
19397
18597
  refreshToolbarActions() {
19398
18598
  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
- }
18599
+ if (parent.activeObj.shape) {
18600
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
18601
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
18602
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
19408
18603
  }
19409
- else if (isNullOrUndefined(parent.activeObj.shape)) {
19410
- parent.updateToolbar(parent.element, 'imageLoaded');
18604
+ else {
18605
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
19411
18606
  }
19412
18607
  }
19413
18608
  applyCurrentChanges() {
@@ -19417,7 +18612,7 @@ class UndoRedo {
19417
18612
  parent.togglePan = false;
19418
18613
  parent.notify('selection', { prop: 'setDragCanvas', value: { bool: false } });
19419
18614
  }
19420
- if (parent.element.querySelector('.e-contextual-toolbar-wrapper') && !isBlazor()) {
18615
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
19421
18616
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19422
18617
  }
19423
18618
  if (parent.togglePen) {
@@ -19449,14 +18644,9 @@ class UndoRedo {
19449
18644
  }
19450
18645
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
19451
18646
  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');
18647
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
18648
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
18649
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19460
18650
  }
19461
18651
  parent.isUndoRedo = true;
19462
18652
  const obj = this.undoRedoColl[this.undoRedoStep];
@@ -19584,12 +18774,7 @@ class UndoRedo {
19584
18774
  if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
19585
18775
  this.refreshToolbarActions();
19586
18776
  this.undoRedoStep++;
19587
- if (!isBlazor()) {
19588
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19589
- }
19590
- else {
19591
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19592
- }
18777
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19593
18778
  parent.isUndoRedo = true;
19594
18779
  const obj = this.undoRedoColl[this.undoRedoStep - 1];
19595
18780
  if (this.undoRedoColl.length === this.undoRedoStep) {
@@ -19606,7 +18791,7 @@ class UndoRedo {
19606
18791
  parent.cropObj = extend({}, obj.currentCropObj, {}, true);
19607
18792
  parent.afterCropActions = obj.currentObj.afterCropActions;
19608
18793
  this.lowerContext.filter = obj.currentObj.filter;
19609
- if (!isBlazor() && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
18794
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
19610
18795
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
19611
18796
  }
19612
18797
  parent.notify('filter', { prop: 'setAdjustmentLevel', onPropertyChange: false, value: { adjustmentLevel: obj.currentObj.adjustmentLevel } });
@@ -19878,12 +19063,7 @@ class UndoRedo {
19878
19063
  this.upperContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
19879
19064
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
19880
19065
  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
- }
19066
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
19887
19067
  const textArea = parent.textArea;
19888
19068
  textArea.style.display = 'block';
19889
19069
  textArea.style.fontFamily = obj.textSettings.fontFamily;
@@ -19945,66 +19125,24 @@ class UndoRedo {
19945
19125
  parent.notify('selection', { prop: 'setDragCanvas', value: { bool: true } });
19946
19126
  }
19947
19127
  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' });
19128
+ if (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] === 'crop') {
19129
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19130
+ isApplyBtn: true, isCropping: true, isZooming: null, cType: null } });
19957
19131
  }
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');
19132
+ else {
19133
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
19961
19134
  }
19135
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19962
19136
  if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
19963
19137
  document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
19964
19138
  }
19965
- if (!isBlazor()) {
19966
- parent.notify('toolbar', { prop: 'enable-disable-btns' });
19967
- }
19968
- else {
19969
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
19970
- }
19139
+ parent.notify('toolbar', { prop: 'enable-disable-btns' });
19971
19140
  if (parent.transform.degree !== 0) {
19972
19141
  parent.notify('transform', { prop: 'drawPannedImage', onPropertyChange: false,
19973
19142
  value: { xDiff: 0, yDiff: 0 } });
19974
19143
  }
19975
19144
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
19976
19145
  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
- }
19983
- getImageAction(operation) {
19984
- if (['brightness', 'contrast', 'saturation', 'opacity', 'blur', 'hue'].indexOf(operation) !== -1) {
19985
- return 'FinetuneApplied';
19986
- }
19987
- else if (['chrome', 'cold', 'warm', 'grayscale', 'blackandwhite', 'sepia', 'invert'].indexOf(operation) !== -1) {
19988
- return 'FilterApplied';
19989
- }
19990
- else if (operation === 'frame') {
19991
- return 'FrameApplied';
19992
- }
19993
- else if (operation === 'resize') {
19994
- return 'ImageResized';
19995
- }
19996
- else if (['deleteFreehandDrawing', 'deleteObj'].indexOf(operation) !== -1) {
19997
- return 'ShapeDeleted';
19998
- }
19999
- else if (operation === 'crop') {
20000
- return 'Cropped';
20001
- }
20002
- else if (['shapeInsert', 'freehanddraw', 'freehand-draw'].indexOf(operation) !== -1) {
20003
- return 'ShapeInserted';
20004
- }
20005
- else {
20006
- return 'ShapeCustomized';
20007
- }
20008
19146
  }
20009
19147
  updateUrc(operation, previousObj, previousObjColl, previousPointColl, previousSelPointColl, previousCropObj, previousText, currentText, previousFilter, isCircleCrop) {
20010
19148
  const parent = this.parent;
@@ -20059,17 +19197,7 @@ class UndoRedo {
20059
19197
  previousSelPointColl: previousSelPointColl, currentSelPointColl: currentObj.selPointColl,
20060
19198
  previousCropObj: previousCropObj, currentCropObj: extend({}, parent.cropObj, {}, true),
20061
19199
  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
- }
19200
+ parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
20073
19201
  }
20074
19202
  }
20075
19203
  updateUrObj(objColl, operation) {
@@ -20125,15 +19253,10 @@ class UndoRedo {
20125
19253
  parent.objColl.pop();
20126
19254
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
20127
19255
  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
- }
19256
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
19257
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
19258
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19259
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20137
19260
  }
20138
19261
  getZeroZoomObjPointValue(obj, point) {
20139
19262
  const parent = this.parent;
@@ -20459,26 +19582,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20459
19582
  this.isFrameBtnClick = false;
20460
19583
  /** @hidden */
20461
19584
  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
- }
19585
+ ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
19586
+ ImageEditor_1.Inject(UndoRedo);
19587
+ ImageEditor_1.Inject(Filter);
19588
+ ImageEditor_1.Inject(Shape);
19589
+ ImageEditor_1.Inject(FreehandDrawing);
19590
+ if (element) {
19591
+ this.appendTo(element);
20482
19592
  }
20483
19593
  }
20484
19594
  /**
@@ -20587,13 +19697,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20587
19697
  }
20588
19698
  this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
20589
19699
  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
- }
19700
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19701
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20597
19702
  }
20598
19703
  break;
20599
19704
  case 'finetuneSettings':
@@ -20605,13 +19710,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20605
19710
  case 'locale':
20606
19711
  if (newProperties.locale) {
20607
19712
  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
- }
19713
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19714
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20615
19715
  }
20616
19716
  break;
20617
19717
  case 'allowUndoRedo':
@@ -20621,47 +19721,25 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20621
19721
  else {
20622
19722
  this.allowUndoRedo = false;
20623
19723
  }
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
- }
19724
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19725
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20631
19726
  break;
20632
19727
  case 'showQuickAccessToolbar':
20633
19728
  if (newProperties.showQuickAccessToolbar) {
20634
19729
  this.showQuickAccessToolbar = true;
20635
- if (!isBlazor()) {
20636
- this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
20637
- }
19730
+ this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
20638
19731
  indexObj = { freehandSelectedIndex: null };
20639
19732
  this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
20640
19733
  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
- }
19734
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
20647
19735
  }
20648
19736
  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
- }
19737
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
20655
19738
  }
20656
19739
  }
20657
19740
  else {
20658
19741
  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
- }
19742
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
20665
19743
  }
20666
19744
  break;
20667
19745
  case 'zoomSettings':
@@ -20671,22 +19749,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20671
19749
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
20672
19750
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
20673
19751
  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
- }
19752
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19753
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20681
19754
  }
20682
19755
  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
- }
19756
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19757
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20690
19758
  }
20691
19759
  break;
20692
19760
  case 'selectionSettings':
@@ -20701,33 +19769,24 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20701
19769
  case 'toolbar':
20702
19770
  if (newProperties.toolbar) {
20703
19771
  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
- }
19772
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
19773
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
20711
19774
  }
20712
19775
  break;
20713
19776
  case 'toolbarTemplate':
20714
19777
  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
- }
19778
+ this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
19779
+ this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
19780
+ this.element.appendChild(this.createElement('div', {
19781
+ id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
19782
+ }));
19783
+ this.toolbarTemplateFn();
20723
19784
  }
20724
19785
  break;
20725
19786
  case 'quickAccessToolbarTemplate':
20726
19787
  if (newProperties.quickAccessToolbarTemplate) {
20727
- if (!isBlazor()) {
20728
- this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
20729
- this.quickAccessToolbarTemplateFn();
20730
- }
19788
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
19789
+ this.quickAccessToolbarTemplateFn();
20731
19790
  }
20732
19791
  break;
20733
19792
  }
@@ -20743,14 +19802,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20743
19802
  if (!this.element.getAttribute('class')) {
20744
19803
  this.element.removeAttribute('class');
20745
19804
  }
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
- }
19805
+ this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
19806
+ this.notify('destroyed', null);
19807
+ super.destroy();
20754
19808
  this.unwireEvent();
20755
19809
  this.element.innerHTML = '';
20756
19810
  }
@@ -20811,7 +19865,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20811
19865
  }
20812
19866
  createDropUploader() {
20813
19867
  const uploadObj = new Uploader({
20814
- dropArea: document.getElementsByClassName('e-canvas-wrapper')[0],
19868
+ dropArea: this.element.getElementsByClassName('e-canvas-wrapper')[0],
20815
19869
  allowedExtensions: '.jpg, .jpeg, .png,.svg',
20816
19870
  multiple: false,
20817
19871
  selected: (args) => {
@@ -20939,7 +19993,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20939
19993
  this.element.style.boxSizing = 'border-box';
20940
19994
  const obj = { toolbarHeight: 0 };
20941
19995
  this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
20942
- const height = obj['toolbarHeight'];
19996
+ let height = obj['toolbarHeight'];
19997
+ if (this.toolbar && this.toolbar.length > 0 && this.toolbar.indexOf('Open') === -1) {
19998
+ height = 0;
19999
+ }
20943
20000
  this.element.style.width = this.width;
20944
20001
  this.element.style.height = this.height;
20945
20002
  const canvasWrapper = this.element.appendChild(this.createElement('div', { id: this.element.id + '_canvasWrapper',
@@ -21094,7 +20151,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21094
20151
  notifyResetForAllModules() {
21095
20152
  const modules = this.requiredModules();
21096
20153
  for (let i = 0; i < modules.length; i++) {
21097
- this.notify(modules[i].member, { prop: 'reset', onPropertyChange: false });
20154
+ const module = modules[i].member;
20155
+ this.notify(module === 'toolbar-module' ? 'toolbar' : module, { prop: 'reset', onPropertyChange: false });
21098
20156
  }
21099
20157
  }
21100
20158
  allowShape(x, y) {
@@ -21107,10 +20165,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21107
20165
  /**
21108
20166
  * Clears the current selection performed in the image editor.
21109
20167
  *
20168
+ * @param { boolean } resetCrop - Specifies to reset last cropped image.
20169
+ *
21110
20170
  * @returns {void}.
21111
20171
  */
21112
- clearSelection() {
21113
- this.notify('selection', { prop: 'clearSelection', onPropertyChange: false });
20172
+ clearSelection(resetCrop) {
20173
+ this.notify('selection', { prop: 'clearSelection', onPropertyChange: false, value: { resetCrop: resetCrop } });
21114
20174
  }
21115
20175
  /**
21116
20176
  * Crops an image based on the selection done in the image editor.
@@ -21158,7 +20218,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21158
20218
  */
21159
20219
  getImageData() {
21160
20220
  const obj = { canvas: null };
21161
- if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
20221
+ const dummyObj = { bool: false };
20222
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: dummyObj } });
20223
+ if (dummyObj['bool'] || this.togglePen || this.activeObj.shape) {
21162
20224
  this.okBtn();
21163
20225
  }
21164
20226
  this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
@@ -21197,13 +20259,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21197
20259
  this.clearContext(this.lowerContext);
21198
20260
  this.clearContext(this.upperContext);
21199
20261
  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
- }
20262
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
20263
+ isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
20264
+ if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
20265
+ getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
20266
+ this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
21207
20267
  }
21208
20268
  const isImageLoaded = this.isImageLoaded;
21209
20269
  this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
@@ -21268,36 +20328,28 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21268
20328
  }
21269
20329
  this.notifyResetForAllModules();
21270
20330
  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 } });
20331
+ if (this.toolbarTemplate) {
20332
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
21279
20333
  }
20334
+ else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
20335
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
20336
+ }
20337
+ this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
21280
20338
  this.isImageLoaded = isImageLoaded;
21281
20339
  this.straightenBaseImageCanvas();
21282
20340
  this.isImageLoaded = false;
21283
20341
  this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
21284
20342
  this.isImageLoaded = isImageLoaded;
21285
20343
  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
- }
20344
+ const ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
20345
+ if (ctWrapper) {
20346
+ ctWrapper.classList.add('e-hide');
21297
20347
  }
21298
- else {
21299
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
21300
- this.activeObj.textSettings.fontFamily = this.defaultFontFamily;
20348
+ this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
20349
+ this.notify('toolbar', { prop: 'enable-disable-btns' });
20350
+ const straightenObj = { bool: this.isStraightening };
20351
+ if (Browser.isDevice && straightenObj['bool']) {
20352
+ this.notify('crop', { prop: 'resizeWrapper' });
21301
20353
  }
21302
20354
  }
21303
20355
  }
@@ -21317,9 +20369,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21317
20369
  */
21318
20370
  rotate(degree) {
21319
20371
  const obj = { isRotate: false };
20372
+ if (degree === 90 || degree === -90) {
20373
+ this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
20374
+ }
21320
20375
  this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
21321
20376
  this.notify('draw', { prop: 'redrawDownScale' });
21322
- this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
21323
20377
  return obj['isRotate'];
21324
20378
  }
21325
20379
  /**
@@ -21357,8 +20411,20 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21357
20411
  this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
21358
20412
  this.notify('draw', { prop: 'select', onPropertyChange: false,
21359
20413
  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 } });
20414
+ if ((startX && startY) || (width && height)) {
20415
+ this.notify('draw', { prop: 'select', onPropertyChange: false,
20416
+ value: { type: type, startX: startX, startY: startY, width: width, height: height } });
20417
+ }
20418
+ else {
20419
+ this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
20420
+ totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
20421
+ rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
20422
+ destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
20423
+ srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
20424
+ aspectWidth: null, aspectHeight: null, straightenZoom: 0,
20425
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
20426
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
20427
+ }
21362
20428
  }
21363
20429
  /**
21364
20430
  * Enable or disable a freehand drawing option in an Image Editor.
@@ -21430,16 +20496,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21430
20496
  * @param {string} strokeColor - Specifies the stroke color of ellipse.
21431
20497
  * @param {string} fillColor - Specifies the fill color of the ellipse.
21432
20498
  * @param {number} degree - Specifies the degree to rotate the ellipse.
20499
+ * @param {boolean} isSelected - Specifies to show the ellipse in the selected state.
21433
20500
  * @returns {boolean}.
21434
20501
  *
21435
20502
  */
21436
- drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
20503
+ drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
21437
20504
  let isEllipse = false;
21438
20505
  const isPointsInRange = this.allowShape(x, y);
21439
20506
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21440
20507
  isEllipse = true;
21441
20508
  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 } });
20509
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
21443
20510
  this.notify('draw', { prop: 'redrawDownScale' });
21444
20511
  }
21445
20512
  return isEllipse;
@@ -21453,15 +20520,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21453
20520
  * @param {number} endY - Specifies end point y-coordinates of the line.
21454
20521
  * @param {number} strokeWidth - Specifies the stroke width of line.
21455
20522
  * @param {string} strokeColor - Specifies the stroke color of line.
20523
+ * @param {boolean} isSelected - Specifies to show the line in the selected state.
21456
20524
  * @returns {boolean}.
21457
20525
  */
21458
- drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
20526
+ drawLine(startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
21459
20527
  let isLine = false;
21460
20528
  const isPointsInRange = this.allowShape(startX, startY);
21461
20529
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
21462
20530
  isLine = true;
21463
20531
  this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
21464
- endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
20532
+ endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
21465
20533
  this.notify('draw', { prop: 'redrawDownScale' });
21466
20534
  }
21467
20535
  return isLine;
@@ -21477,15 +20545,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21477
20545
  * @param {string} strokeColor - Specifies the stroke color of arrow.
21478
20546
  * @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
21479
20547
  * @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
20548
+ * @param {boolean} isSelected - Specifies to show the arrow in the selected state.
21480
20549
  * @returns {boolean}.
21481
20550
  */
21482
- drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
20551
+ drawArrow(startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
21483
20552
  let isArrow = false;
21484
20553
  const isPointsInRange = this.allowShape(startX, startY);
21485
20554
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
21486
20555
  isArrow = true;
21487
20556
  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 } });
20557
+ endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
20558
+ isSelected: isSelected } });
21489
20559
  this.notify('draw', { prop: 'redrawDownScale' });
21490
20560
  }
21491
20561
  return isArrow;
@@ -21496,9 +20566,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21496
20566
  * @param {Point[]} pointColl – Specifies collection of start and end x, y-coordinates of path.
21497
20567
  * @param {number} strokeWidth - Specifies the stroke width of path.
21498
20568
  * @param {string} strokeColor - Specifies the stroke color of path.
20569
+ * @param {boolean} isSelected - Specifies to show the path in the selected state.
21499
20570
  * @returns {boolean}.
21500
20571
  */
21501
- drawPath(pointColl, strokeWidth, strokeColor, opacity) {
20572
+ drawPath(pointColl, strokeWidth, strokeColor, isSelected) {
21502
20573
  this.isPublicMethod = true;
21503
20574
  const obj = { inRange: false };
21504
20575
  let isPath = false;
@@ -21514,7 +20585,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21514
20585
  if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
21515
20586
  isPath = true;
21516
20587
  this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
21517
- strokeWidth: strokeWidth, strokeColor: strokeColor } });
20588
+ strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
21518
20589
  this.notify('draw', { prop: 'redrawDownScale' });
21519
20590
  }
21520
20591
  return isPath;
@@ -21530,15 +20601,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21530
20601
  * @param {string} strokeColor - Specifies the stroke color of rectangle.
21531
20602
  * @param {string} fillColor - Specifies the fill color of the rectangle.
21532
20603
  * @param {number} degree - Specifies the degree to rotate the rectangle.
20604
+ * @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
21533
20605
  * @returns {boolean}.
21534
20606
  */
21535
- drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
20607
+ drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
21536
20608
  let isRectangle = false;
21537
20609
  const isPointsInRange = this.allowShape(x, y);
21538
20610
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21539
20611
  isRectangle = true;
21540
20612
  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 } });
20613
+ strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
21542
20614
  this.notify('draw', { prop: 'redrawDownScale' });
21543
20615
  }
21544
20616
  return isRectangle;
@@ -21556,16 +20628,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21556
20628
  * @param {boolean} bold - Specifies whether the text is bold or not.
21557
20629
  * @param {boolean} italic - Specifies whether the text is italic or not.
21558
20630
  * @param {string} color - Specifies font color of the text.
20631
+ * @param {boolean} isSelected - Specifies to show the text in the selected state.
21559
20632
  * @returns {boolean}.
21560
20633
  *
21561
20634
  */
21562
- drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
20635
+ drawText(x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
21563
20636
  let isText = false;
21564
20637
  const isPointsInRange = this.allowShape(x, y);
21565
20638
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21566
20639
  isText = true;
21567
20640
  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 } });
20641
+ fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected } });
21569
20642
  this.notify('draw', { prop: 'redrawDownScale' });
21570
20643
  }
21571
20644
  return isText;
@@ -21582,16 +20655,17 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21582
20655
  * @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
21583
20656
  * @param {number} degree - Specifies the degree to rotate the image.
21584
20657
  * @param {number} opacity - Specifies the value for the image.
20658
+ * @param {boolean} isSelected - Specifies to show the image in the selected state.
21585
20659
  * @returns {boolean}.
21586
20660
  *
21587
20661
  */
21588
- drawImage(data, x, y, width, height, isAspectRatio, degree, opacity) {
20662
+ drawImage(data, x, y, width, height, isAspectRatio, degree, opacity, isSelected) {
21589
20663
  let isImage = false;
21590
20664
  const isPointsInRange = this.allowShape(x, y);
21591
20665
  if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
21592
20666
  const length = this.objColl.length;
21593
20667
  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 } });
20668
+ src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
21595
20669
  this.notify('draw', { prop: 'redrawDownScale' });
21596
20670
  if (this.objColl.length > length) {
21597
20671
  isImage = true;
@@ -21639,10 +20713,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21639
20713
  *
21640
20714
  */
21641
20715
  getShapeSetting(id) {
21642
- const shapeDetails = {};
20716
+ const obj = { shapeDetails: null };
21643
20717
  this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
21644
- value: { id: id, obj: shapeDetails } });
20718
+ value: { id: id, obj: obj } });
21645
20719
  this.notify('draw', { prop: 'redrawDownScale' });
20720
+ const shapeDetails = obj['shapeDetails'] ? obj['shapeDetails'] : {};
21646
20721
  return shapeDetails;
21647
20722
  }
21648
20723
  /**
@@ -21746,28 +20821,23 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21746
20821
  if ((width.toString()).length <= 4 && (height.toString()).length <= 4) {
21747
20822
  const destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
21748
20823
  height: this.img.destHeight };
21749
- if (isBlazor()) {
21750
- this.updateToolbar(this.element, 'resize');
20824
+ if (isAspectRatio) {
20825
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
20826
+ isApplyBtn: false, isCropping: false } });
20827
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
20828
+ isApplyBtn: false, isCropping: false } });
21751
20829
  }
21752
20830
  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
- }
20831
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
20832
+ isApplyBtn: false, isCropping: false } });
20833
+ }
20834
+ const aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
20835
+ const aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
20836
+ if (aspectRatioWidth && aspectRatioHeight) {
20837
+ getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
20838
+ aspectRatioWidth.value = Math.floor(width).toString() + ' px';
20839
+ getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
20840
+ aspectRatioHeight.value = Math.floor(height).toString() + ' px';
21771
20841
  }
21772
20842
  this.notify('transform', { prop: 'resize', value: { width: width, height: height, isAspectRatio: isAspectRatio } });
21773
20843
  if (destPoints.startX !== this.img.destLeft || destPoints.startY !== this.img.destTop ||
@@ -21815,13 +20885,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21815
20885
  extend(this.tempFrameObj, this.frameObj);
21816
20886
  this.tempFrameZoomLevel = this.transform.zoomFactor;
21817
20887
  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
- }
20888
+ this.notify('toolbar', { prop: 'frameToolbarClick' });
21825
20889
  this.frameObj.type = frameType.toLowerCase();
21826
20890
  this.frameObj.color = color;
21827
20891
  this.frameObj.gradientColor = gradientColor;
@@ -21876,22 +20940,76 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21876
20940
  * {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
21877
20941
  *
21878
20942
  * @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
20943
+ * @param {boolean} isSelected - Specifies to show the shape in the selected state.
21879
20944
  * @returns {boolean}.
21880
20945
  *
21881
20946
  */
21882
- updateShape(setting) {
20947
+ updateShape(setting, isSelected) {
21883
20948
  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' });
20949
+ let isTextArea = false;
20950
+ const freehandObj = { bool: false };
20951
+ if (isNullOrUndefined(setting.id)) {
20952
+ if (setting.strokeColor) {
20953
+ this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
20954
+ }
20955
+ if (setting.fillColor) {
20956
+ this.activeObj.strokeSettings.fillColor = setting.fillColor;
20957
+ }
20958
+ if (setting.strokeWidth) {
20959
+ this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
20960
+ }
20961
+ if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
20962
+ this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
20963
+ }
20964
+ }
20965
+ else {
20966
+ if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
20967
+ this.textArea.style.display === 'inline-block')) {
20968
+ this.okBtn();
20969
+ isTextArea = true;
20970
+ }
20971
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
20972
+ this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
20973
+ if (obj['isSelected']) {
20974
+ const tempFontSize = this.activeObj.textSettings.fontSize;
20975
+ this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
20976
+ value: { shapeSettings: setting } });
20977
+ if (this.activeObj.shape === 'text' && tempFontSize) {
20978
+ const diff = this.activeObj.textSettings.fontSize - tempFontSize;
20979
+ if (diff !== 0) {
20980
+ this.activeObj.activePoint.height += diff;
20981
+ this.activeObj.activePoint.startY -= (diff / 2);
20982
+ this.activeObj.activePoint.endY += (diff / 2);
20983
+ this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: this.activeObj.activePoint, obj: this.activeObj,
20984
+ isMouseMove: null, x: null, y: null } });
20985
+ }
20986
+ }
20987
+ const activeObj = extend({}, this.activeObj, {}, true);
20988
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
20989
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
20990
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
20991
+ if (activeObj.shape) {
20992
+ this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
20993
+ }
20994
+ if (this.activeObj.shape === 'text') {
20995
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
20996
+ }
20997
+ if (freehandObj['bool']) {
20998
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
20999
+ }
21000
+ this.okBtn(isSelected);
21001
+ if (freehandObj['bool']) {
21002
+ this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
21003
+ }
21004
+ this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
21005
+ this.notify('draw', { prop: 'redrawDownScale' });
21006
+ if (isTextArea) {
21007
+ this.enableTextEditing();
21008
+ }
21009
+ if (isSelected) {
21010
+ this.selectShape(setting.id);
21011
+ }
21012
+ }
21895
21013
  }
21896
21014
  return obj['isSelected'];
21897
21015
  }
@@ -21903,23 +21021,84 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21903
21021
  * @returns {boolean}.
21904
21022
  *
21905
21023
  */
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
- }
21024
+ cloneShape(shapeId) {
21025
+ const obj = { isSelected: false };
21026
+ if (shapeId.split('_')[0] === 'shape') {
21027
+ this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
21028
+ if (obj['isSelected']) {
21029
+ this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
21030
+ this.okBtn();
21031
+ this.notify('draw', { prop: 'redrawDownScale' });
21032
+ }
21033
+ }
21034
+ return obj['isSelected'];
21035
+ }
21036
+ /**
21037
+ * Update filter to the canvas in the ImageEditor.
21038
+ *
21039
+ * @param {ImageFilterOption } filterOption - Specifies the filter options to the image.
21040
+ *
21041
+ * @returns {string}.
21042
+ *
21043
+ */
21044
+ getImageFilter(filterOption) {
21045
+ const canvas = this.createElement('canvas');
21046
+ const ctx = canvas.getContext('2d');
21047
+ this.notify('filter', { prop: 'updateAdj', value: { type: filterOption.toLowerCase(), value: null, isPreview: true, ctx: ctx } });
21048
+ return ctx.filter;
21049
+ }
21050
+ /**
21051
+ * Enable text area editing in the ImageEditor.
21052
+ *
21053
+ * @returns {void}.
21054
+ *
21055
+ */
21056
+ enableTextEditing() {
21057
+ const activeObj = extend({}, this.activeObj, {}, true);
21058
+ this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
21059
+ this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: false } });
21060
+ this.activeObj = activeObj;
21061
+ this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
21062
+ }
21063
+ /**
21064
+ * Specifies if it's possible to undo the last recent action made in an Image Editor.
21065
+ *
21066
+ * @returns {boolean}.
21067
+ *
21068
+ */
21069
+ canUndo() {
21070
+ let canUndo = false;
21071
+ const object = this.getUndoRedoColl();
21072
+ const undoRedoIndex = object['index'];
21073
+ if (undoRedoIndex > 0) {
21074
+ canUndo = true;
21075
+ }
21076
+ return canUndo;
21077
+ }
21078
+ /**
21079
+ * Specifies if it's possible to redo the last recent action made in an Image Editor.
21080
+ *
21081
+ * @returns {boolean}.
21082
+ *
21083
+ */
21084
+ canRedo() {
21085
+ let canRedo = false;
21086
+ const object = this.getUndoRedoColl();
21087
+ const undoRedoColl = object['undoRedoColl'];
21088
+ const undoRedoIndex = object['index'];
21089
+ if (undoRedoColl && undoRedoColl.length > 0 && undoRedoIndex < undoRedoColl.length - 1) {
21090
+ canRedo = true;
21921
21091
  }
21922
- return obj['isSelected'];
21092
+ if (undoRedoIndex === undoRedoColl.length) {
21093
+ canRedo = false;
21094
+ }
21095
+ else if (undoRedoIndex === 0 && undoRedoColl.length > 0) {
21096
+ canRedo = true;
21097
+ }
21098
+ else if (undoRedoIndex > 0) {
21099
+ canRedo = true;
21100
+ }
21101
+ return canRedo;
21923
21102
  }
21924
21103
  // Toolbar related codes
21925
21104
  toolbarTemplateFn() {
@@ -22004,6 +21183,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22004
21183
  this.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
22005
21184
  this.notify('freehand-draw', { prop: 'color-change', value: { color: obj['tempFreeHandDrawEditingStyles'].strokeColor } });
22006
21185
  }
21186
+ getUndoRedoColl() {
21187
+ const obj = { undoRedoColl: null, index: null };
21188
+ const undoRedoObj = { undoRedoStep: null };
21189
+ const object = { appliedUndoRedoColl: [] };
21190
+ this.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
21191
+ this.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
21192
+ obj['undoRedoColl'] = object['appliedUndoRedoColl'];
21193
+ obj['index'] = undoRedoObj['undoRedoStep'];
21194
+ return obj;
21195
+ }
22007
21196
  updateImageTransformColl(type) {
22008
21197
  let value;
22009
21198
  if (type === 'rotateleft') {
@@ -22147,10 +21336,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22147
21336
  shapeSettings.type = ShapeType.FreehandDraw;
22148
21337
  }
22149
21338
  const shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22150
- this.triggerShapeChanged(shapeChangedArgs);
21339
+ this.trigger('shapeChange', shapeChangedArgs);
22151
21340
  }
22152
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
22153
- if (aspectIcon || nonAspectIcon || (isBlazor() && this.currentToolbar === 'resize-toolbar')) {
21341
+ if (aspectIcon || nonAspectIcon) {
22154
21342
  const obj = { width: null, height: null };
22155
21343
  this.notify('selection', { prop: 'getNumTextValue', onPropertyChange: false, value: { obj: obj } });
22156
21344
  const point = { x: obj['width'], y: obj['height'] };
@@ -22184,7 +21372,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22184
21372
  isCircleCrop: null } });
22185
21373
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
22186
21374
  const obj = this.cancelCropSelection;
22187
- if ((!isBlazor() && obj && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon)) || (isBlazor() && obj && blrNAspRatElem && blrNAspRatElem.classList.contains('e-hidden'))) {
21375
+ if ((obj && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon))) {
22188
21376
  obj.previousObj.aspectWidth = obj.currentObj.aspectWidth = this.aspectWidth;
22189
21377
  obj.previousObj.aspectHeight = obj.currentObj.aspectHeight = this.aspectHeight;
22190
21378
  obj.previousCropObj = extend({}, this.cropObj, {}, true);
@@ -22238,9 +21426,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22238
21426
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
22239
21427
  this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
22240
21428
  }
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) {
21429
+ else if (document.querySelector('#' + this.element.id + '_sliderWrapper') || this.currObjType.isFiltered) {
22244
21430
  this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
22245
21431
  this.currObjType.isFiltered = false;
22246
21432
  const obj = { value: null };
@@ -22256,12 +21442,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22256
21442
  else if (obj['bool']) {
22257
21443
  this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
22258
21444
  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
- }
21445
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
22265
21446
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
22266
21447
  }
22267
21448
  else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
@@ -22287,20 +21468,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22287
21468
  }
22288
21469
  this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
22289
21470
  }
22290
- if (!isBlazor() && !obj['isCropToolbar']) {
21471
+ if (!obj['isCropToolbar']) {
22291
21472
  this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
22292
21473
  isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
22293
21474
  }
22294
- else if (isBlazor() && !obj['isCropToolbar'] && (this.currentToolbar == 'resize-toolbar' || this.currentToolbar == 'frame-toolbar')) {
22295
- this.updateToolbar(this.element, 'imageLoaded');
22296
- }
22297
21475
  this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
22298
21476
  this.transform.zoomFactor = this.transform.defaultZoomFactor;
22299
21477
  this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
22300
21478
  this.isResizeOkBtn = false;
22301
21479
  this.notify('draw', { prop: 'redrawDownScale' });
22302
21480
  this.isChangesSaved = false;
22303
- this.triggerActionComplete();
22304
21481
  }
22305
21482
  /**
22306
21483
  * Set the temporary filter properties.
@@ -22359,18 +21536,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22359
21536
  const data = this.getImageData();
22360
21537
  if (ctWrapper) {
22361
21538
  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
21539
  }
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');
21540
+ if (!Browser.isDevice) {
21541
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
21542
+ isApplyBtn: true, isCropping: false } });
22373
21543
  }
21544
+ this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
22374
21545
  this.objColl = objColl;
22375
21546
  this.pointColl = pointColl;
22376
21547
  this.freehandCounter = pointColl.length;
@@ -22388,25 +21559,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22388
21559
  * @returns {void}.
22389
21560
  */
22390
21561
  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 } });
21562
+ const finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
21563
+ this.trigger('finetuneValueChanging', finetuneValueChanging);
21564
+ if (finetuneValueChanging.cancel) {
21565
+ return;
22409
21566
  }
21567
+ this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
22410
21568
  }
22411
21569
  /**
22412
21570
  * Get the square point for path.
@@ -22500,24 +21658,22 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22500
21658
  currentText: null, previousFilter: null, isCircleCrop: null } });
22501
21659
  }
22502
21660
  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
- }
21661
+ if (Browser.isDevice) {
21662
+ if (document.getElementById(this.element.id + '_bottomToolbar')) {
21663
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
21664
+ const toolbar = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
21665
+ toolbar.refreshOverflow();
22510
21666
  }
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
- }
21667
+ }
21668
+ else {
21669
+ if (document.getElementById(this.element.id + '_toolbar')) {
21670
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
21671
+ const toolbar = getComponent(this.element.id + '_toolbar', 'toolbar');
21672
+ toolbar.refreshOverflow();
22517
21673
  }
22518
21674
  }
22519
21675
  const shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
22520
- this.triggerShapeChanged(shapeChangedArgs);
21676
+ this.trigger('shapeChange', shapeChangedArgs);
22521
21677
  }
22522
21678
  /**
22523
21679
  * Apply Font style for text.
@@ -22588,7 +21744,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22588
21744
  }
22589
21745
  const shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22590
21746
  shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
22591
- this.triggerShapeChanged(shapeChangedArgs);
21747
+ this.trigger('shapeChange', shapeChangedArgs);
22592
21748
  }
22593
21749
  /**
22594
21750
  * Apply Font size for text.
@@ -22690,7 +21846,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22690
21846
  }
22691
21847
  const shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22692
21848
  shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
22693
- this.triggerShapeChanged(shapeChangedArgs);
21849
+ this.trigger('shapeChange', shapeChangedArgs);
22694
21850
  }
22695
21851
  /**
22696
21852
  * Apply Font color for text.
@@ -22761,7 +21917,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22761
21917
  }
22762
21918
  const shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22763
21919
  shapeChangedArgs.currentShapeSettings.fillColor = value;
22764
- this.triggerShapeChanged(shapeChangedArgs);
21920
+ this.trigger('shapeChange', shapeChangedArgs);
22765
21921
  }
22766
21922
  /**
22767
21923
  * Apply Pen stroke width.
@@ -22816,7 +21972,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22816
21972
  shapeSettings.type = ShapeType.FreehandDraw;
22817
21973
  const shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22818
21974
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
22819
- this.triggerShapeChanged(shapeChangedArgs);
21975
+ this.trigger('shapeChange', shapeChangedArgs);
22820
21976
  }
22821
21977
  /**
22822
21978
  * Apply Pen stroke color.
@@ -22886,7 +22042,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22886
22042
  shapeSettings.type = ShapeType.FreehandDraw;
22887
22043
  const shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22888
22044
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
22889
- this.triggerShapeChanged(shapeChangedArgs);
22045
+ this.trigger('shapeChange', shapeChangedArgs);
22890
22046
  }
22891
22047
  /**
22892
22048
  * Apply Shape stroke width.
@@ -22932,7 +22088,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22932
22088
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
22933
22089
  const shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22934
22090
  shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
22935
- this.triggerShapeChanged(shapeChangedArgs);
22091
+ this.trigger('shapeChange', shapeChangedArgs);
22936
22092
  }
22937
22093
  else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
22938
22094
  this.activeObj.pointColl.length === 0)) {
@@ -22989,7 +22145,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22989
22145
  }
22990
22146
  const shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
22991
22147
  shapeChangedArgs.currentShapeSettings.strokeColor = value;
22992
- this.triggerShapeChanged(shapeChangedArgs);
22148
+ this.trigger('shapeChange', shapeChangedArgs);
22993
22149
  }
22994
22150
  /**
22995
22151
  * Apply Shape fill color.
@@ -23029,7 +22185,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23029
22185
  }
23030
22186
  this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
23031
22187
  const shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
23032
- this.triggerShapeChanged(shapeChangedArgs);
22188
+ this.trigger('shapeChange', shapeChangedArgs);
23033
22189
  }
23034
22190
  /**
23035
22191
  * Apply horizontal flip.
@@ -23060,9 +22216,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23060
22216
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23061
22217
  this.objColl.pop();
23062
22218
  }
23063
- if (!isBlazor()) {
23064
- this.notify('toolbar', { prop: 'refreshSlider' });
23065
- }
22219
+ this.notify('toolbar', { prop: 'refreshSlider' });
23066
22220
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
23067
22221
  const activePoint = this.duplicateImage();
23068
22222
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
@@ -23108,9 +22262,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23108
22262
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23109
22263
  this.objColl.pop();
23110
22264
  }
23111
- if (!isBlazor()) {
23112
- this.notify('toolbar', { prop: 'refreshSlider' });
23113
- }
22265
+ this.notify('toolbar', { prop: 'refreshSlider' });
23114
22266
  ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
23115
22267
  const activePoint = this.duplicateImage();
23116
22268
  this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
@@ -23154,9 +22306,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23154
22306
  value: { obj: selPointCollObj } });
23155
22307
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23156
22308
  this.objColl.pop();
23157
- if (!isBlazor()) {
23158
- this.notify('toolbar', { prop: 'refreshSlider' });
23159
- }
22309
+ this.notify('toolbar', { prop: 'refreshSlider' });
23160
22310
  if (rotate === 'rotleft') {
23161
22311
  this.activeObj.rotatedAngle -= (90 * (Math.PI / 180));
23162
22312
  }
@@ -23173,14 +22323,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23173
22323
  previousCropObj: prevCropObj, previousText: null,
23174
22324
  currentText: null, previousFilter: null, isCircleCrop: null } });
23175
22325
  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
- }
22326
+ this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
22327
+ this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
23184
22328
  }
23185
22329
  /**
23186
22330
  * Get pascalToSplitWords from string.
@@ -23239,6 +22383,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23239
22383
  * @returns {void}.
23240
22384
  */
23241
22385
  transformSelect(type) {
22386
+ if (this.transform.straighten === 0 && (type === 'rotateleft' || type === 'rotateright') &&
22387
+ 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',
22388
+ 'crop-9:16', 'crop-16:9'].indexOf(this.activeObj.shape) !== -1) {
22389
+ this.activeObj.shape = 'crop-' + this.activeObj.shape.split('-')[1].split(':')[1] + ':' + this.activeObj.shape.split('-')[1].split(':')[0];
22390
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: this.activeObj.shape, isTransform: true } });
22391
+ }
23242
22392
  this.isCropToolbar = true;
23243
22393
  this.allowDownScale = false;
23244
22394
  const straighten = this.transform.straighten;
@@ -23335,12 +22485,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23335
22485
  */
23336
22486
  setStraighten(value, isMethod) {
23337
22487
  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
- }
22488
+ this.trigger('rotating', straightenEventArgs);
23344
22489
  if (!straightenEventArgs.cancel) {
23345
22490
  this.performStraighten(straightenEventArgs);
23346
22491
  }
@@ -23465,85 +22610,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23465
22610
  }
23466
22611
  return flipState;
23467
22612
  }
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
22613
  initializeZoomSettings() {
23548
22614
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23549
22615
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
@@ -23576,57 +22642,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23576
22642
  Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' }
23577
22643
  };
23578
22644
  }
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
22645
  };
23631
22646
  __decorate([
23632
22647
  Property('')
@@ -24254,7 +23269,9 @@ class ToolbarModule {
24254
23269
  args.value['obj']['toolbarHeight'] = this.toolbarHeight;
24255
23270
  break;
24256
23271
  case 'setToolbarHeight':
24257
- this.toolbarHeight = args.value['height'];
23272
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') > -1)) {
23273
+ this.toolbarHeight = args.value['height'];
23274
+ }
24258
23275
  break;
24259
23276
  case 'setCurrentToolbar':
24260
23277
  this.currentToolbar = args.value['type'];
@@ -24262,12 +23279,6 @@ class ToolbarModule {
24262
23279
  case 'setSelectedFreehandColor':
24263
23280
  this.selFhdColor = args.value['color'];
24264
23281
  break;
24265
- case 'getCurrentFilter':
24266
- args.value['obj']['currentFilter'] = parent.currentFilter;
24267
- break;
24268
- case 'setCurrentFilter':
24269
- parent.currentFilter = args.value['filter'];
24270
- break;
24271
23282
  case 'setInitialAdjustmentValue':
24272
23283
  parent.initialAdjustmentValue = args.value['value'];
24273
23284
  break;
@@ -24289,9 +23300,6 @@ class ToolbarModule {
24289
23300
  case 'refreshSlider':
24290
23301
  this.refreshSlider();
24291
23302
  break;
24292
- case 'renderSlider':
24293
- this.renderSlider(args.value['type']);
24294
- break;
24295
23303
  case 'getCurrAdjustmentValue':
24296
23304
  parent.getCurrAdjustmentValue(args.value['type']);
24297
23305
  break;
@@ -24301,18 +23309,6 @@ class ToolbarModule {
24301
23309
  case 'refreshShapeDrawing':
24302
23310
  this.refreshShapeDrawing();
24303
23311
  break;
24304
- case 'getCropToolbar':
24305
- args.value['obj']['isCropToolbar'] = parent.isCropToolbar;
24306
- break;
24307
- case 'getPrevCurrSelectionPoint':
24308
- args.value['obj']['prevCurrSelectionPoint'] = parent.prevCurrSelectionPoint;
24309
- break;
24310
- case 'setPrevCurrSelectionPoint':
24311
- parent.prevCurrSelectionPoint = args.value['point'];
24312
- break;
24313
- case 'updateCropTransformItems':
24314
- parent.updateCropTransformItems();
24315
- break;
24316
23312
  case 'setEnableDisableUndoRedo':
24317
23313
  this.preventEnableDisableUr = args.value['isPrevent'];
24318
23314
  break;
@@ -24338,11 +23334,14 @@ class ToolbarModule {
24338
23334
  this.frameToolbarClick();
24339
23335
  break;
24340
23336
  case 'performCropTransformClick':
24341
- this.performCropTransformClick(args.value['shape']);
23337
+ this.performCropTransformClick(args.value['shape'], args.value['isTransform']);
24342
23338
  break;
24343
23339
  case 'duplicateShape':
24344
23340
  this.duplicateShape(args.value['isPreventUndoRedo'], true);
24345
23341
  break;
23342
+ case 'editText':
23343
+ this.editText();
23344
+ break;
24346
23345
  }
24347
23346
  }
24348
23347
  updatePrivateVariables() {
@@ -24360,7 +23359,6 @@ class ToolbarModule {
24360
23359
  }
24361
23360
  reset() {
24362
23361
  const parent = this.parent;
24363
- this.defToolbarItems = [];
24364
23362
  this.toolbarHeight = 46;
24365
23363
  parent.prevCurrSelectionPoint = null;
24366
23364
  this.zoomBtnHold = null;
@@ -24454,6 +23452,13 @@ class ToolbarModule {
24454
23452
  const mToolbar = document.getElementById(id + '_toolbar');
24455
23453
  if (toolbar) {
24456
23454
  this.toolbarHeight = mToolbar.clientHeight;
23455
+ if (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1) {
23456
+ let toolabr = getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar');
23457
+ if (toolabr) {
23458
+ toolabr.destroy();
23459
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
23460
+ }
23461
+ }
24457
23462
  }
24458
23463
  }
24459
23464
  else {
@@ -24533,31 +23538,33 @@ class ToolbarModule {
24533
23538
  const args = { toolbarType: 'main', toolbarItems: this.defToolbarItems };
24534
23539
  parent.trigger('toolbarUpdating', args);
24535
23540
  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();
23541
+ if (this.defToolbarItems.length > 0) {
23542
+ const toolbarObj = new Toolbar({
23543
+ width: '100%',
23544
+ items: this.defToolbarItems,
23545
+ clicked: this.defToolbarClicked.bind(this),
23546
+ created: () => {
23547
+ if (!isDevice) {
23548
+ this.renderAnnotationBtn();
23549
+ }
23550
+ this.wireZoomBtnEvents();
23551
+ this.renderSaveBtn();
23552
+ parent.trigger('toolbarCreated', { toolbarType: 'main' });
24543
23553
  }
24544
- this.wireZoomBtnEvents();
24545
- this.renderSaveBtn();
24546
- parent.trigger('toolbarCreated', { toolbarType: 'main' });
23554
+ });
23555
+ if (isDevice && isFrame) {
23556
+ toolbarObj.appendTo('#' + id + '_bottomToolbar');
23557
+ }
23558
+ else {
23559
+ toolbarObj.appendTo('#' + id + '_toolbar');
23560
+ }
23561
+ this.createLeftToolbarControls();
23562
+ this.enableDisableTbrBtn();
23563
+ if (this.isToolbar() && document.getElementById(id + '_toolbar')) {
23564
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23565
+ const toolbar = getComponent(id + '_toolbar', 'toolbar');
23566
+ toolbar.refreshOverflow();
24547
23567
  }
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
23568
  }
24562
23569
  }
24563
23570
  }
@@ -24591,8 +23598,14 @@ class ToolbarModule {
24591
23598
  const id = parent.element.id;
24592
23599
  const toolbarItems = [];
24593
23600
  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' });
23601
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Open') > -1)) {
23602
+ 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 }) });
23603
+ toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
23604
+ }
23605
+ else if (Browser.isDevice && (parent.toolbar && parent.toolbar.indexOf('Open') === -1)) {
23606
+ 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 }) });
23607
+ toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
23608
+ }
24596
23609
  }
24597
23610
  if (parent.allowUndoRedo && !isResize) {
24598
23611
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
@@ -24723,6 +23736,9 @@ class ToolbarModule {
24723
23736
  const id = parent.element.id;
24724
23737
  const toolbarArea = parent.element.querySelector('#' + id + '_toolbarArea');
24725
23738
  const contextualToolbarArea = parent.element.querySelector('#' + id + '_contextualToolbarArea');
23739
+ if (!contextualToolbarArea) {
23740
+ return;
23741
+ }
24726
23742
  contextualToolbarArea.classList.remove('e-hide');
24727
23743
  contextualToolbarArea.style.left = toolbarArea.offsetLeft + 'px';
24728
23744
  if (type === 'filter') {
@@ -24752,15 +23768,13 @@ class ToolbarModule {
24752
23768
  this.renderSlider(cType, isSelect);
24753
23769
  }
24754
23770
  }
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;
23771
+ if (parent.toolbarTemplate) {
23772
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
24763
23773
  }
23774
+ else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
23775
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
23776
+ }
23777
+ parent.toolbarHeight = this.toolbarHeight;
24764
23778
  if (Browser.isDevice) {
24765
23779
  let cHt = contextualToolbarArea.offsetHeight + 1;
24766
23780
  const cusWrapper = parent.element.querySelector('#' + id + '_customizeWrapper');
@@ -25545,7 +24559,7 @@ class ToolbarModule {
25545
24559
  }
25546
24560
  return toolbarItems;
25547
24561
  }
25548
- initCropTransformToolbar(shape) {
24562
+ initCropTransformToolbar(shape, isTransform) {
25549
24563
  const parent = this.parent;
25550
24564
  const id = parent.element.id;
25551
24565
  const leftItem = this.getLeftToolbarItem();
@@ -25588,7 +24602,7 @@ class ToolbarModule {
25588
24602
  toolbar.refreshOverflow();
25589
24603
  }
25590
24604
  }
25591
- if (document.getElementById(id + '_cropBtn')) {
24605
+ if (document.getElementById(id + '_cropBtn') && isNullOrUndefined(isTransform)) {
25592
24606
  if (!Browser.isDevice) {
25593
24607
  parent.notify('draw', { prop: 'select', onPropertyChange: false,
25594
24608
  value: { type: this.getCropTextContent(document.getElementById(id + '_cropBtn')).toLowerCase(),
@@ -25785,7 +24799,7 @@ class ToolbarModule {
25785
24799
  },
25786
24800
  beforeClose: () => {
25787
24801
  fillDDB.toggle();
25788
- }
24802
+ },
25789
24803
  }, '#' + id + '_shape_fill');
25790
24804
  const fillDDB = new DropDownButton({
25791
24805
  open: (args) => {
@@ -26257,7 +25271,7 @@ class ToolbarModule {
26257
25271
  fontSizeBtn.appendTo('#' + id + '_fontSizeBtn');
26258
25272
  }
26259
25273
  }
26260
- refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType, shape) {
25274
+ refreshToolbar(type, isApplyBtn, isCropping, isZooming, cType, shape, isTransform) {
26261
25275
  const parent = this.parent;
26262
25276
  const id = parent.element.id;
26263
25277
  if (!parent.isImageLoaded || parent.isCropToolbar) {
@@ -26274,10 +25288,18 @@ class ToolbarModule {
26274
25288
  getComponent(cusWrapper, 'toolbar').destroy();
26275
25289
  cusWrapper.innerHTML = '';
26276
25290
  }
26277
- if (toolbarElement && this.defToolbarItems.length > 0) {
25291
+ if (toolbarElement && toolbarElement.classList.contains('e-control') && this.defToolbarItems.length > 0) {
26278
25292
  getComponent(toolbarElement, 'toolbar').destroy();
26279
25293
  toolbarElement.innerHTML = '';
26280
25294
  }
25295
+ if (toolbarElement && (this.defToolbarItems.length > 0 ||
25296
+ parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1)) {
25297
+ let toolbar = getComponent(toolbarElement, 'toolbar');
25298
+ if (!isNullOrUndefined(toolbar)) {
25299
+ toolbar.destroy();
25300
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
25301
+ }
25302
+ }
26281
25303
  if (bottomToolbar && this.defToolbarItems.length > 0) {
26282
25304
  if (bottomToolbar.className.indexOf('e-control') > -1) {
26283
25305
  getComponent(bottomToolbar, 'toolbar').destroy();
@@ -26378,14 +25400,18 @@ class ToolbarModule {
26378
25400
  this.updateContextualToolbar(type, cType);
26379
25401
  break;
26380
25402
  case 'croptransform':
26381
- parent.allowDownScale = false;
26382
- parent.isCropTab = true;
25403
+ if (isNullOrUndefined(isTransform)) {
25404
+ parent.allowDownScale = false;
25405
+ parent.isCropTab = true;
25406
+ }
26383
25407
  if (Browser.isDevice) {
26384
25408
  this.initMainToolbar(false, true, true);
26385
25409
  }
26386
- parent.updateCropTransformItems();
26387
- this.initCropTransformToolbar(shape);
26388
- if (Browser.isDevice) {
25410
+ if (isNullOrUndefined(isTransform)) {
25411
+ parent.updateCropTransformItems();
25412
+ }
25413
+ this.initCropTransformToolbar(shape, isTransform);
25414
+ if (Browser.isDevice && this.isToolbar()) {
26389
25415
  this.updateContextualToolbar('color', 'straighten', true);
26390
25416
  }
26391
25417
  break;
@@ -26411,17 +25437,21 @@ class ToolbarModule {
26411
25437
  this.currToolbar = type;
26412
25438
  this.refreshDropDownBtn(isCropping);
26413
25439
  }
26414
- performCropTransformClick(shape) {
25440
+ performCropTransformClick(shape, isTransform) {
26415
25441
  const parent = this.parent;
26416
- parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
26417
- parent.tempStraighten = parent.transform.straighten;
26418
- if (parent.currObjType.isFiltered) {
26419
- parent.okBtn();
25442
+ if (isNullOrUndefined(isTransform)) {
25443
+ parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
25444
+ parent.tempStraighten = parent.transform.straighten;
25445
+ if (parent.currObjType.isFiltered) {
25446
+ parent.okBtn();
25447
+ }
25448
+ parent.isStraightening = true;
25449
+ }
25450
+ this.refreshToolbar('croptransform', null, null, null, null, shape, isTransform);
25451
+ if (isNullOrUndefined(isTransform)) {
25452
+ parent.notify('draw', { prop: 'setDestForStraighten' });
25453
+ parent.notify('draw', { prop: 'setTempDestForStraighten' });
26420
25454
  }
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
25455
  }
26426
25456
  getAdjustmentToolbarItem() {
26427
25457
  const toolbarItems = [];
@@ -27778,33 +26808,7 @@ class ToolbarModule {
27778
26808
  break;
27779
26809
  case 'edittext':
27780
26810
  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
- }
26811
+ this.editText();
27808
26812
  }
27809
26813
  break;
27810
26814
  case 'rotleft':
@@ -27837,6 +26841,37 @@ class ToolbarModule {
27837
26841
  parent.trigger('quickAccessToolbarItemClick', args);
27838
26842
  }
27839
26843
  }
26844
+ editText() {
26845
+ const parent = this.parent;
26846
+ const points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
26847
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
26848
+ parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
26849
+ value: { obj: extend({}, parent.activeObj, {}, true) } });
26850
+ parent.notify('selection', { prop: 'setInitialTextEdit', onPropertyChange: false,
26851
+ value: { bool: true } });
26852
+ parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
26853
+ value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
26854
+ if (parent.activeObj.rotatedAngle !== 0) {
26855
+ const object = { x: points.x, y: points.y };
26856
+ parent.notify('shape', { prop: 'getTextBoxPosition', onPropertyChange: false,
26857
+ value: { obj: parent.activeObj, object: object } });
26858
+ points.x = object['x'];
26859
+ points.y = object['y'];
26860
+ const object1 = { x: points.x, y: points.y };
26861
+ parent.notify('shape', { prop: 'setFlipState', onPropertyChange: false,
26862
+ value: { x: points.x, y: points.y, obj: parent.activeObj, object: object1 } });
26863
+ points.x = object1['x'];
26864
+ points.y = object1['y'];
26865
+ }
26866
+ parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
26867
+ value: { x: points.x, y: points.y, actObj: parent.activeObj } });
26868
+ if (isNullOrUndefined(parent.activeObj.currIndex)) {
26869
+ parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
26870
+ }
26871
+ if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
26872
+ document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
26873
+ }
26874
+ }
27840
26875
  duplicateShape(isPreventUndoRedo, isPublicMethod) {
27841
26876
  const parent = this.parent;
27842
26877
  const tempObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
@@ -28090,7 +27125,6 @@ class ToolbarModule {
28090
27125
  parseFloat(getComponent(aspectRatioHeight, 'numerictextbox').placeholder);
28091
27126
  parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
28092
27127
  }
28093
- parent.cancelCropSelection = null;
28094
27128
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
28095
27129
  height: parent.img.srcHeight };
28096
27130
  this.refreshToolbar('resize');
@@ -28783,91 +27817,93 @@ class ToolbarModule {
28783
27817
  if (!parent.isImageLoaded) {
28784
27818
  return;
28785
27819
  }
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;
27820
+ if (this.isToolbar()) {
27821
+ const selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
27822
+ const selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
27823
+ const selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
27824
+ const selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
27825
+ const strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
27826
+ const fontFamilyElem = parent.element.querySelector('.e-text-font-family');
27827
+ const fontSizeElem = parent.element.querySelector('.e-text-font-size');
27828
+ const boldBtn = parent.element.querySelector('#' + id + '_bold');
27829
+ const italicBtn = parent.element.querySelector('#' + id + '_italic');
27830
+ if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
27831
+ if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
27832
+ parent.activeObj.strokeSettings.strokeWidth = 2;
27833
+ }
27834
+ if (selFillElem) {
27835
+ const value = parent.activeObj.strokeSettings.fillColor;
27836
+ if (parent.activeObj.strokeSettings.fillColor === '') {
27837
+ selFillElem.classList.add('e-nocolor-item');
27838
+ }
27839
+ else {
27840
+ selFillElem.classList.remove('e-nocolor-item');
27841
+ selFillElem.style.background = value;
27842
+ }
27843
+ if (document.querySelector('#' + id + '_shape_fill')) {
27844
+ getComponent(id + '_shape_fill', 'colorpicker').value = value;
27845
+ }
28824
27846
  }
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;
27847
+ if (selStrokeElem) {
27848
+ const value = parent.activeObj.strokeSettings.strokeColor;
27849
+ selStrokeElem.style.background = value;
27850
+ if (document.querySelector('#' + id + '_shape_stroke')) {
27851
+ getComponent(id + '_shape_stroke', 'colorpicker').value = value;
27852
+ }
28831
27853
  }
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());
27854
+ if (selTextStrokeElem) {
27855
+ const value = parent.activeObj.strokeSettings.strokeColor;
27856
+ selTextStrokeElem.style.background = value;
27857
+ if (document.querySelector('#' + id + '_text_font')) {
27858
+ getComponent(id + '_text_font', 'colorpicker').value = value;
27859
+ }
28838
27860
  }
28839
- else {
28840
- fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
27861
+ if (selPenStrokeElem) {
27862
+ const value = parent.activeObj.strokeSettings.strokeColor;
27863
+ selPenStrokeElem.style.background = value;
27864
+ if (document.querySelector('#' + id + '_pen_stroke')) {
27865
+ getComponent(id + '_pen_stroke', 'colorpicker').value = value;
27866
+ }
27867
+ const obj = { penOpacity: 1 };
27868
+ parent.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
28841
27869
  }
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;
27870
+ if (fontFamilyElem) {
27871
+ if (Browser.isDevice) {
27872
+ fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
27873
+ }
27874
+ else {
27875
+ fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
28848
27876
  }
28849
27877
  }
28850
- }
28851
- if (boldBtn) {
28852
- if (parent.activeObj.textSettings.bold) {
28853
- boldBtn.classList.add('e-selected-btn');
27878
+ if (fontSizeElem) {
27879
+ for (let i = 0; i < parent.fontSizeColl.length; i++) {
27880
+ if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
27881
+ fontSizeElem.textContent = (i + 1).toString();
27882
+ break;
27883
+ }
27884
+ }
28854
27885
  }
28855
- else {
28856
- boldBtn.classList.remove('e-selected-btn');
27886
+ if (boldBtn) {
27887
+ if (parent.activeObj.textSettings.bold) {
27888
+ boldBtn.classList.add('e-selected-btn');
27889
+ }
27890
+ else {
27891
+ boldBtn.classList.remove('e-selected-btn');
27892
+ }
28857
27893
  }
28858
- }
28859
- if (italicBtn) {
28860
- if (parent.activeObj.textSettings.italic) {
28861
- italicBtn.classList.add('e-selected-btn');
27894
+ if (italicBtn) {
27895
+ if (parent.activeObj.textSettings.italic) {
27896
+ italicBtn.classList.add('e-selected-btn');
27897
+ }
27898
+ else {
27899
+ italicBtn.classList.remove('e-selected-btn');
27900
+ }
28862
27901
  }
28863
- else {
28864
- italicBtn.classList.remove('e-selected-btn');
27902
+ if (strokeWidthElem) {
27903
+ const strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
27904
+ strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
28865
27905
  }
28866
27906
  }
28867
- if (strokeWidthElem) {
28868
- const strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
28869
- strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
28870
- }
28871
27907
  }
28872
27908
  }
28873
27909
  getStrokeWidth(text) {