@syncfusion/ej2-image-editor 24.2.8 → 25.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +3 -51
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +942 -1874
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +974 -1923
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.js +9 -45
  13. package/src/image-editor/action/draw.js +52 -207
  14. package/src/image-editor/action/export.js +6 -35
  15. package/src/image-editor/action/freehand-draw.js +26 -80
  16. package/src/image-editor/action/selection.js +122 -326
  17. package/src/image-editor/action/shape.js +130 -242
  18. package/src/image-editor/action/transform.d.ts +0 -1
  19. package/src/image-editor/action/transform.js +77 -289
  20. package/src/image-editor/action/undo-redo.js +32 -101
  21. package/src/image-editor/base/image-editor-model.d.ts +1 -1
  22. package/src/image-editor/base/image-editor.d.ts +51 -42
  23. package/src/image-editor/base/image-editor.js +302 -423
  24. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  25. package/src/image-editor/renderer/toolbar.js +228 -185
  26. package/styles/bootstrap-dark.css +0 -12
  27. package/styles/bootstrap.css +0 -12
  28. package/styles/bootstrap4.css +0 -12
  29. package/styles/bootstrap5-dark.css +0 -12
  30. package/styles/bootstrap5.css +0 -12
  31. package/styles/fabric-dark.css +0 -12
  32. package/styles/fabric.css +0 -12
  33. package/styles/fluent-dark.css +0 -12
  34. package/styles/fluent.css +0 -12
  35. package/styles/highcontrast-light.css +0 -12
  36. package/styles/highcontrast.css +0 -12
  37. package/styles/image-editor/_bds-definition.scss +21 -0
  38. package/styles/image-editor/_bootstrap-dark-definition.scss +0 -1
  39. package/styles/image-editor/_bootstrap-definition.scss +0 -1
  40. package/styles/image-editor/_bootstrap4-definition.scss +0 -1
  41. package/styles/image-editor/_bootstrap5-definition.scss +0 -1
  42. package/styles/image-editor/_fabric-dark-definition.scss +0 -1
  43. package/styles/image-editor/_fabric-definition.scss +0 -1
  44. package/styles/image-editor/_fluent-definition.scss +0 -1
  45. package/styles/image-editor/_fusionnew-definition.scss +0 -1
  46. package/styles/image-editor/_highcontrast-definition.scss +0 -1
  47. package/styles/image-editor/_highcontrast-light-definition.scss +0 -1
  48. package/styles/image-editor/_layout.scss +2 -32
  49. package/styles/image-editor/_material-dark-definition.scss +0 -1
  50. package/styles/image-editor/_material-definition.scss +0 -1
  51. package/styles/image-editor/_material3-definition.scss +2 -3
  52. package/styles/image-editor/_tailwind-definition.scss +0 -1
  53. package/styles/image-editor/bootstrap-dark.css +0 -12
  54. package/styles/image-editor/bootstrap.css +0 -12
  55. package/styles/image-editor/bootstrap4.css +0 -12
  56. package/styles/image-editor/bootstrap5-dark.css +0 -12
  57. package/styles/image-editor/bootstrap5.css +0 -12
  58. package/styles/image-editor/fabric-dark.css +0 -12
  59. package/styles/image-editor/fabric.css +0 -12
  60. package/styles/image-editor/fluent-dark.css +0 -12
  61. package/styles/image-editor/fluent.css +0 -12
  62. package/styles/image-editor/highcontrast-light.css +0 -12
  63. package/styles/image-editor/highcontrast.css +0 -12
  64. package/styles/image-editor/icons/_bds.scss +411 -0
  65. package/styles/image-editor/material-dark.css +0 -12
  66. package/styles/image-editor/material.css +0 -12
  67. package/styles/image-editor/material3-dark.css +4 -25
  68. package/styles/image-editor/material3.css +4 -25
  69. package/styles/image-editor/tailwind-dark.css +2 -15
  70. package/styles/image-editor/tailwind.css +2 -15
  71. package/styles/material-dark.css +0 -12
  72. package/styles/material.css +0 -12
  73. package/styles/material3-dark.css +4 -25
  74. package/styles/material3.css +4 -25
  75. package/styles/tailwind-dark.css +2 -15
  76. package/styles/tailwind.css +2 -15
@@ -1,4 +1,4 @@
1
- import { EventHandler, extend, isBlazor, isNullOrUndefined } from '@syncfusion/ej2-base';
1
+ import { EventHandler, extend, isNullOrUndefined } from '@syncfusion/ej2-base';
2
2
  import { ShapeType } from '../index';
3
3
  var Shape = /** @class */ (function () {
4
4
  function Shape(parent) {
@@ -28,22 +28,22 @@ var Shape = /** @class */ (function () {
28
28
  var uploader;
29
29
  switch (args.prop) {
30
30
  case 'drawEllipse':
31
- 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']);
31
+ 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']);
32
32
  break;
33
33
  case 'drawLine':
34
- this.drawLine(args.value['startX'], args.value['startY'], args.value['endX'], args.value['endY'], args.value['strokeWidth'], args.value['strokeColor']);
34
+ this.drawLine(args.value['startX'], args.value['startY'], args.value['endX'], args.value['endY'], args.value['strokeWidth'], args.value['strokeColor'], args.value['isSelected']);
35
35
  break;
36
36
  case 'drawArrow':
37
- 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']);
37
+ 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']);
38
38
  break;
39
39
  case 'drawPath':
40
- this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
40
+ this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor'], args.value['isSelected']);
41
41
  break;
42
42
  case 'drawRectangle':
43
- 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']);
43
+ 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']);
44
44
  break;
45
45
  case 'drawText':
46
- 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']);
46
+ 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']);
47
47
  break;
48
48
  case 'redrawActObj':
49
49
  this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
@@ -217,7 +217,7 @@ var Shape = /** @class */ (function () {
217
217
  this.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
218
218
  break;
219
219
  case 'drawImage':
220
- 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']);
220
+ 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']);
221
221
  break;
222
222
  case 'reset':
223
223
  this.reset();
@@ -279,26 +279,26 @@ var Shape = /** @class */ (function () {
279
279
  { text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
280
280
  this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
281
281
  };
282
- Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
282
+ Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
283
283
  this.initializeShape('ellipse');
284
284
  var start = x && y ? { x: x, y: y } : null;
285
- this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
285
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree, null, isSelected);
286
286
  };
287
- Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
287
+ Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
288
288
  this.initializeShape('line');
289
289
  var start = startX && startY ? { x: startX, y: startY } : null;
290
290
  var width = endX - startX;
291
291
  var height = endY - startY;
292
- this.drawShape('line', strokeWidth, strokeColor, null, start, width, height);
292
+ this.drawShape('line', strokeWidth, strokeColor, null, start, width, height, null, null, null, null, null, isSelected);
293
293
  };
294
- Shape.prototype.drawPath = function (pointColl, strokeWidth, strokeColor) {
294
+ Shape.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, isSelected) {
295
295
  var parent = this.parent;
296
296
  this.initializeShape('path');
297
297
  if (pointColl) {
298
- this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl);
298
+ this.drawShape('path', strokeWidth, strokeColor, null, null, null, null, pointColl, null, null, null, null, isSelected);
299
299
  }
300
300
  else {
301
- this.drawShape('line', strokeWidth, strokeColor);
301
+ this.drawShape('line', strokeWidth, strokeColor, null, null, null, null, null, null, null, null, null, isSelected);
302
302
  var obj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
303
303
  obj.shape = 'path';
304
304
  obj.lineDraw = null;
@@ -307,20 +307,20 @@ var Shape = /** @class */ (function () {
307
307
  parent.objColl[parent.objColl.length - 1] = obj;
308
308
  }
309
309
  };
310
- Shape.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
310
+ Shape.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
311
311
  this.initializeShape('arrow');
312
312
  var start = startX && startY ? { x: startX, y: startY } : null;
313
313
  var width = endX - startX;
314
314
  var height = endY - startY;
315
- this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
315
+ this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd, null, null, isSelected);
316
316
  };
317
- Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
317
+ Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
318
318
  this.initializeShape('rectangle');
319
319
  var start = x && y ? { x: x, y: y } : null;
320
- this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
320
+ this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree, null, isSelected);
321
321
  };
322
- Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
323
- this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
322
+ Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
323
+ this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected);
324
324
  };
325
325
  Shape.prototype.initializeShape = function (type) {
326
326
  var parent = this.parent;
@@ -358,13 +358,12 @@ var Shape = /** @class */ (function () {
358
358
  }
359
359
  return arrowType;
360
360
  };
361
- Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree, opacity) {
362
- var _this = this;
361
+ Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree, opacity, isSelected) {
363
362
  var parent = this.parent;
364
363
  if (!parent.disabled && parent.isImageLoaded) {
365
364
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
366
365
  this.redrawActObj();
367
- var objColl_1 = extend([], parent.objColl, [], true);
366
+ var objColl = extend([], parent.objColl, [], true);
368
367
  parent.togglePen = false;
369
368
  this.keyHistory = '';
370
369
  parent.upperCanvas.style.display = 'block';
@@ -375,11 +374,9 @@ var Shape = /** @class */ (function () {
375
374
  parent.activeObj.pointColl = [];
376
375
  parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
377
376
  parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: 'path' } });
378
- if (!isBlazor()) {
379
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
380
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
381
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
382
- }
377
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
378
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
379
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
383
380
  }
384
381
  else {
385
382
  if (type !== 'freehanddraw' && type !== '') {
@@ -437,50 +434,24 @@ var Shape = /** @class */ (function () {
437
434
  var shapeSettings = obj['shapeSettingsObj'];
438
435
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
439
436
  currentShapeSettings: shapeSettings };
440
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
441
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
442
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then(function (shapeChangingArgs) {
443
- _this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
444
- _this.setDimension(width, height);
445
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
446
- if (degree) {
447
- parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
448
- parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
449
- }
450
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
451
- parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
452
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
453
- if (parent.isPublicMethod) {
454
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
455
- }
456
- parent.isPublicMethod = false;
457
- });
437
+ parent.trigger('shapeChanging', shapeChangingArgs);
438
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
439
+ this.setDimension(width, height);
440
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
441
+ if (degree) {
442
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
443
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
458
444
  }
459
- else {
460
- parent.trigger('shapeChanging', shapeChangingArgs);
461
- this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
462
- this.setDimension(width, height);
463
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
464
- if (degree) {
465
- parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
466
- parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
467
- }
468
- if (!isBlazor()) {
469
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
470
- }
471
- else {
472
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
473
- }
474
- parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
475
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
476
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
477
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
478
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
479
- if (parent.isPublicMethod) {
480
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
481
- }
482
- parent.isPublicMethod = false;
445
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
446
+ parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
447
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
448
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
449
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
450
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
451
+ if (parent.isPublicMethod && !isSelected) {
452
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
483
453
  }
454
+ parent.isPublicMethod = false;
484
455
  }
485
456
  }
486
457
  }
@@ -521,8 +492,7 @@ var Shape = /** @class */ (function () {
521
492
  value: { obj: selPointCollObj } });
522
493
  this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
523
494
  };
524
- Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
525
- var _this = this;
495
+ Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected) {
526
496
  var parent = this.parent;
527
497
  if (!parent.disabled && parent.isImageLoaded) {
528
498
  if (parent.currObjType.shape === 'freehanddraw') {
@@ -570,24 +540,12 @@ var Shape = /** @class */ (function () {
570
540
  var shapeSettings = obj['shapeSettingsObj'];
571
541
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
572
542
  currentShapeSettings: shapeSettings };
573
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
574
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
575
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then(function (shapeChangingArgs) {
576
- _this.drawShapeTextEvent(shapeChangingArgs);
577
- if (parent.isPublicMethod) {
578
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
579
- }
580
- parent.isPublicMethod = false;
581
- });
582
- }
583
- else {
584
- parent.trigger('shapeChanging', shapeChangingArgs);
585
- this.drawShapeTextEvent(shapeChangingArgs);
586
- if (parent.isPublicMethod) {
587
- parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
588
- }
589
- parent.isPublicMethod = false;
543
+ parent.trigger('shapeChanging', shapeChangingArgs);
544
+ this.drawShapeTextEvent(shapeChangingArgs);
545
+ if (parent.isPublicMethod && !isSelected) {
546
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
590
547
  }
548
+ parent.isPublicMethod = false;
591
549
  }
592
550
  };
593
551
  Shape.prototype.drawShapeImageEvent = function (shapeChangingArgs, isSelect) {
@@ -603,16 +561,10 @@ var Shape = /** @class */ (function () {
603
561
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
604
562
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
605
563
  if (isSelect) {
606
- if (!isBlazor()) {
607
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
608
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
609
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
610
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
611
- }
612
- else {
613
- parent.updateToolbar(parent.element, parent.activeObj.shape);
614
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
615
- }
564
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
565
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
566
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
567
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
616
568
  }
617
569
  else {
618
570
  parent.okBtn();
@@ -633,22 +585,11 @@ var Shape = /** @class */ (function () {
633
585
  previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
634
586
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
635
587
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
636
- if (isBlazor()) {
637
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'text');
638
- }
639
- else {
640
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
641
- }
588
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
642
589
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
643
- if (isBlazor()) {
644
- parent.updateToolbar(parent.element, 'text');
645
- parent.getFontSizes();
646
- }
647
- else {
648
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
649
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
650
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
651
- }
590
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
591
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
592
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
652
593
  };
653
594
  Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor) {
654
595
  var parent = this.parent;
@@ -667,9 +608,9 @@ var Shape = /** @class */ (function () {
667
608
  parent.activeObj.textSettings.bold = bold || parent.activeObj.textSettings.bold;
668
609
  parent.activeObj.textSettings.italic = italic || parent.activeObj.textSettings.italic;
669
610
  };
670
- Shape.prototype.drawImage = function (x, y, width, height, src, degree, isAspectRatio, opacity) {
611
+ Shape.prototype.drawImage = function (x, y, width, height, src, degree, isAspectRatio, opacity, isSelected) {
671
612
  this.initializeShape('image');
672
- this.onLoadImgShape(x, y, width, height, src, null, degree, isAspectRatio, opacity);
613
+ this.onLoadImgShape(x, y, width, height, src, null, degree, isAspectRatio, opacity, isSelected);
673
614
  };
674
615
  Shape.prototype.redrawActObj = function (x, y, isMouseDown) {
675
616
  var splitWords;
@@ -800,15 +741,10 @@ var Shape = /** @class */ (function () {
800
741
  }
801
742
  switch (parent.activeObj.shape) {
802
743
  case 'ellipse':
803
- if (isBlazor()) {
804
- parent.activeObj.activePoint.width = shapeSettings.radius;
805
- }
806
- else {
807
- parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
808
- parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
809
- parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
810
- parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
811
- }
744
+ parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
745
+ parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
746
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
747
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
812
748
  if (shapeSettings.degree) {
813
749
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
814
750
  }
@@ -816,15 +752,13 @@ var Shape = /** @class */ (function () {
816
752
  case 'line':
817
753
  case 'arrow':
818
754
  parent.activeObj.activePoint.width = shapeSettings.length;
819
- if (!isBlazor()) {
820
- parent.activeObj.activePoint.endX = shapeSettings.endX;
821
- parent.activeObj.activePoint.endY = shapeSettings.endY;
822
- parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
823
- parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
824
- if (parent.activeObj.shape === 'arrow') {
825
- parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
826
- parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
827
- }
755
+ parent.activeObj.activePoint.endX = shapeSettings.endX;
756
+ parent.activeObj.activePoint.endY = shapeSettings.endY;
757
+ parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
758
+ parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
759
+ if (parent.activeObj.shape === 'arrow') {
760
+ parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
761
+ parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
828
762
  }
829
763
  break;
830
764
  case 'text':
@@ -848,6 +782,9 @@ var Shape = /** @class */ (function () {
848
782
  break;
849
783
  }
850
784
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
785
+ parent.activeObj.textSettings.bold = false;
786
+ parent.activeObj.textSettings.italic = false;
787
+ parent.activeObj.textSettings.underline = false;
851
788
  for (var i = 0; i < shapeSettings.fontStyle.length; i++) {
852
789
  switch (shapeSettings.fontStyle[i]) {
853
790
  case 'bold':
@@ -1566,12 +1503,7 @@ var Shape = /** @class */ (function () {
1566
1503
  var parent = this.parent;
1567
1504
  var degree = this.getRotDegOfShape(parent.activeObj);
1568
1505
  this.transformTextArea();
1569
- if (isBlazor()) {
1570
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
1571
- }
1572
- else {
1573
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
1574
- }
1506
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
1575
1507
  var dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
1576
1508
  var removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
1577
1509
  var editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
@@ -1884,12 +1816,7 @@ var Shape = /** @class */ (function () {
1884
1816
  if (parent.objColl[parent.objColl.length - 1]) {
1885
1817
  parent.selectShape(parent.objColl[parent.objColl.length - 1].currIndex);
1886
1818
  }
1887
- if (!isBlazor()) {
1888
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
1889
- }
1890
- else {
1891
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
1892
- }
1819
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
1893
1820
  var obj_1 = { shapeSettingsObj: {} };
1894
1821
  parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj_1 } });
1895
1822
  var shapeSettings = obj_1['shapeSettingsObj'];
@@ -1935,16 +1862,11 @@ var Shape = /** @class */ (function () {
1935
1862
  parent.notify('selection', { prop: 'setTouchEndPoint', onPropertyChange: false,
1936
1863
  value: { x: e.touches[0].clientX, y: e.touches[0].clientY } });
1937
1864
  }
1938
- if (!isBlazor()) {
1939
- parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: true } });
1940
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
1941
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
1942
- parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: false } });
1943
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
1944
- }
1945
- else {
1946
- parent.updateToolbar(parent.element, 'enableDisableToolbarBtn', 'textAreaClicked');
1947
- }
1865
+ parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: true } });
1866
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
1867
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
1868
+ parent.notify('toolbar', { prop: 'setPreventZoomBtn', onPropertyChange: false, value: { isPrevent: false } });
1869
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
1948
1870
  if (!isNullOrUndefined(x) && !isNullOrUndefined(y)) {
1949
1871
  var bbox = parent.lowerCanvas.getBoundingClientRect();
1950
1872
  x -= bbox.left;
@@ -2134,11 +2056,9 @@ var Shape = /** @class */ (function () {
2134
2056
  var URL = window.URL;
2135
2057
  var url = URL.createObjectURL(e.target.files[0]);
2136
2058
  this.onLoadImgShape(null, null, null, null, url.toString(), true);
2137
- if (!isBlazor()) {
2138
- document.getElementById(this.parent.element.id + '_fileUpload').value = '';
2139
- }
2059
+ document.getElementById(this.parent.element.id + '_fileUpload').value = '';
2140
2060
  };
2141
- Shape.prototype.onLoadImgShape = function (x, y, width, height, url, isSelect, degree, isAspectRatio, opacity) {
2061
+ Shape.prototype.onLoadImgShape = function (x, y, width, height, url, isSelect, degree, isAspectRatio, opacity, isSelected) {
2142
2062
  // eslint-disable-next-line @typescript-eslint/no-this-alias
2143
2063
  var proxy = this;
2144
2064
  var parent = this.parent;
@@ -2156,11 +2076,10 @@ var Shape = /** @class */ (function () {
2156
2076
  this.initShapeProps();
2157
2077
  this.shapeImg.onload = function () {
2158
2078
  proxy.upperContext.drawImage(proxy.shapeImg, 0, 0, proxy.shapeImg.width, proxy.shapeImg.height);
2159
- proxy.updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity);
2079
+ proxy.updateImgCanvas(isSelect, x, y, width, height, degree, isAspectRatio, opacity, isSelected);
2160
2080
  };
2161
2081
  };
2162
- Shape.prototype.updateImgCanvas = function (isSelect, x, y, width, height, degree, isAspectRatio, opacity) {
2163
- var _this = this;
2082
+ Shape.prototype.updateImgCanvas = function (isSelect, x, y, width, height, degree, isAspectRatio, opacity, isSelected) {
2164
2083
  var parent = this.parent;
2165
2084
  parent.activeObj.imageElement = this.shapeImg;
2166
2085
  parent.activeObj.imageCanvas = parent.createElement('canvas');
@@ -2209,24 +2128,12 @@ var Shape = /** @class */ (function () {
2209
2128
  var shapeSettings = obj['shapeSettingsObj'];
2210
2129
  var shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
2211
2130
  currentShapeSettings: shapeSettings };
2212
- if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
2213
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2214
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then(function (shapeChangingArgs) {
2215
- _this.drawShapeImageEvent(shapeChangingArgs, isSelect);
2216
- if (parent.isPublicMethod) {
2217
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
2218
- }
2219
- parent.isPublicMethod = false;
2220
- });
2221
- }
2222
- else {
2223
- parent.trigger('shapeChanging', shapeChangingArgs);
2224
- this.drawShapeImageEvent(shapeChangingArgs, isSelect);
2225
- if (parent.isPublicMethod) {
2226
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
2227
- }
2228
- parent.isPublicMethod = false;
2131
+ parent.trigger('shapeChanging', shapeChangingArgs);
2132
+ this.drawShapeImageEvent(shapeChangingArgs, isSelect);
2133
+ if (parent.isPublicMethod && !isSelected) {
2134
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
2229
2135
  }
2136
+ parent.isPublicMethod = false;
2230
2137
  };
2231
2138
  Shape.prototype.updateObj = function (dimObj, x, y) {
2232
2139
  var parent = this.parent;
@@ -2533,7 +2440,7 @@ var Shape = /** @class */ (function () {
2533
2440
  }
2534
2441
  var shapeChangedArgs = { action: 'font-style', currentShapeSettings: extend({}, shapeSettings, {}, true) };
2535
2442
  shapeChangedArgs.currentShapeSettings.fontStyle = [item];
2536
- parent.triggerShapeChanged(shapeChangedArgs);
2443
+ parent.trigger('shapeChange', shapeChangedArgs);
2537
2444
  };
2538
2445
  Shape.prototype.updateFontStyle = function (item, objColl, fontWeight, fontStyle) {
2539
2446
  var parent = this.parent;
@@ -2760,12 +2667,7 @@ var Shape = /** @class */ (function () {
2760
2667
  parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
2761
2668
  value: { context: this.lowerContext, isSave: null, isFlip: null } });
2762
2669
  }
2763
- if (!isBlazor()) {
2764
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
2765
- }
2766
- else {
2767
- parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
2768
- }
2670
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
2769
2671
  if (isNullOrUndefined(isMouseDown)) {
2770
2672
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
2771
2673
  parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
@@ -2931,13 +2833,6 @@ var Shape = /** @class */ (function () {
2931
2833
  shapeDetails.height = obj.activePoint.height;
2932
2834
  shapeDetails.opacity = obj.opacity;
2933
2835
  break;
2934
- case 'image':
2935
- shapeDetails.imageData = obj.imageCanvas.toDataURL();
2936
- shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
2937
- shapeDetails.width = obj.activePoint.width;
2938
- shapeDetails.height = obj.activePoint.height;
2939
- shapeDetails.opacity = obj.opacity;
2940
- break;
2941
2836
  }
2942
2837
  return shapeDetails;
2943
2838
  };
@@ -2955,7 +2850,12 @@ var Shape = /** @class */ (function () {
2955
2850
  var parent = this.parent;
2956
2851
  var shapeDetails;
2957
2852
  if (!parent.disabled && parent.isImageLoaded) {
2958
- this.applyActObj();
2853
+ if (parent.textArea.style.display !== 'none') {
2854
+ parent.okBtn();
2855
+ }
2856
+ else {
2857
+ this.applyActObj(true);
2858
+ }
2959
2859
  if (id.split('_')[0] === 'shape') {
2960
2860
  var obj_4;
2961
2861
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
@@ -2976,7 +2876,12 @@ var Shape = /** @class */ (function () {
2976
2876
  var parent = this.parent;
2977
2877
  var shapeDetailsColl = [];
2978
2878
  if (!parent.disabled && parent.isImageLoaded) {
2979
- this.applyActObj();
2879
+ if (parent.textArea.style.display !== 'none') {
2880
+ parent.okBtn();
2881
+ }
2882
+ else {
2883
+ this.applyActObj(true);
2884
+ }
2980
2885
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
2981
2886
  var shapeDetails = this.getObjDetails(parent.objColl[i]);
2982
2887
  shapeDetailsColl.push(shapeDetails);
@@ -3126,31 +3031,20 @@ var Shape = /** @class */ (function () {
3126
3031
  this.lowerContext.filter = object['canvasFilter'];
3127
3032
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
3128
3033
  value: { obj: parent.activeObj } });
3129
- if (!isBlazor()) {
3130
- if (parent.activeObj.shape === 'text') {
3131
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
3132
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3133
- }
3134
- else if (parent.activeObj.shape === 'pen') {
3135
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
3136
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3137
- }
3138
- else {
3139
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
3140
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3141
- }
3142
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
3143
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
3034
+ if (parent.activeObj.shape === 'text') {
3035
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
3036
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3037
+ }
3038
+ else if (parent.activeObj.shape === 'pen') {
3039
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
3040
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3144
3041
  }
3145
3042
  else {
3146
- parent.updateToolbar(parent.element, parent.activeObj.shape);
3147
- if (parent.activeObj.shape === 'path') {
3148
- parent.updateToolbar(parent.element, 'path', 'pathQuickAccessToolbar');
3149
- }
3150
- else {
3151
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
3152
- }
3043
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
3044
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
3153
3045
  }
3046
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
3047
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
3154
3048
  }
3155
3049
  }
3156
3050
  else if (id.split('_')[0] === 'pen') {
@@ -3164,14 +3058,8 @@ var Shape = /** @class */ (function () {
3164
3058
  if (obj_6['isIndex']) {
3165
3059
  isSelected = true;
3166
3060
  parent.notify('freehand-draw', { prop: 'selectFhd', value: { id: id } });
3167
- if (isBlazor()) {
3168
- parent.updateToolbar(parent.element, 'pen');
3169
- parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
3170
- }
3171
- else {
3172
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
3173
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
3174
- }
3061
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
3062
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
3175
3063
  }
3176
3064
  else {
3177
3065
  isSelected = false;
@@ -3183,29 +3071,29 @@ var Shape = /** @class */ (function () {
3183
3071
  Shape.prototype.deleteShape = function (id) {
3184
3072
  var parent = this.parent;
3185
3073
  if (!parent.disabled && parent.isImageLoaded) {
3186
- this.applyActObj();
3187
- if (id.split('_')[0] === 'shape') {
3188
- for (var i = 0, len = parent.objColl.length; i < len; i++) {
3189
- if (parent.objColl[i].currIndex === id) {
3190
- parent.objColl.splice(i, 1);
3191
- break;
3074
+ if (parent.activeObj.currIndex && parent.activeObj.currIndex === id) {
3075
+ parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
3076
+ }
3077
+ else {
3078
+ this.applyActObj();
3079
+ if (id.split('_')[0] === 'shape') {
3080
+ for (var i = 0, len = parent.objColl.length; i < len; i++) {
3081
+ if (parent.objColl[i].currIndex === id) {
3082
+ parent.objColl.splice(i, 1);
3083
+ break;
3084
+ }
3192
3085
  }
3193
3086
  }
3194
- }
3195
- else if (id.split('_')[0] === 'pen') {
3196
- parent.notify('freehand-draw', { prop: 'handle-freehand-draw', value: { id: id } });
3087
+ else if (id.split('_')[0] === 'pen') {
3088
+ parent.notify('freehand-draw', { prop: 'handle-freehand-draw', value: { id: id } });
3089
+ }
3197
3090
  }
3198
3091
  var object = { canvasFilter: null };
3199
3092
  parent.notify('toolbar', { prop: 'getCanvasFilter', onPropertyChange: false, value: { obj: object } });
3200
3093
  this.lowerContext.filter = object['canvasFilter'];
3201
3094
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
3202
3095
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
3203
- if (!isBlazor()) {
3204
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
3205
- }
3206
- else {
3207
- parent.updateToolbar(parent.element, 'imageLoaded');
3208
- }
3096
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
3209
3097
  }
3210
3098
  };
3211
3099
  Shape.prototype.getMaxText = function (isTextBox, text, obj) {