@syncfusion/ej2-image-editor 22.1.36 → 22.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +16 -0
  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 +351 -278
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +353 -279
  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 +11 -11
  12. package/src/image-editor/action/crop.d.ts +2 -0
  13. package/src/image-editor/action/crop.js +89 -97
  14. package/src/image-editor/action/draw.js +88 -71
  15. package/src/image-editor/action/export.js +49 -66
  16. package/src/image-editor/action/freehand-draw.js +25 -1
  17. package/src/image-editor/action/selection.d.ts +1 -0
  18. package/src/image-editor/action/selection.js +26 -7
  19. package/src/image-editor/action/shape.d.ts +2 -0
  20. package/src/image-editor/action/shape.js +51 -22
  21. package/src/image-editor/action/transform.js +10 -0
  22. package/src/image-editor/action/undo-redo.js +4 -2
  23. package/src/image-editor/base/image-editor.js +8 -8
  24. package/src/image-editor/base/interface.d.ts +6 -2
  25. package/src/image-editor/renderer/toolbar.js +4 -5
  26. package/styles/bootstrap-dark.css +20 -8
  27. package/styles/bootstrap.css +20 -8
  28. package/styles/bootstrap4.css +20 -8
  29. package/styles/bootstrap5-dark.css +20 -8
  30. package/styles/bootstrap5.css +20 -8
  31. package/styles/fabric-dark.css +20 -8
  32. package/styles/fabric.css +20 -8
  33. package/styles/fluent-dark.css +20 -8
  34. package/styles/fluent.css +20 -8
  35. package/styles/highcontrast-light.css +20 -8
  36. package/styles/highcontrast.css +20 -8
  37. package/styles/image-editor/_layout.scss +20 -2
  38. package/styles/image-editor/bootstrap-dark.css +20 -8
  39. package/styles/image-editor/bootstrap.css +20 -8
  40. package/styles/image-editor/bootstrap4.css +20 -8
  41. package/styles/image-editor/bootstrap5-dark.css +20 -8
  42. package/styles/image-editor/bootstrap5.css +20 -8
  43. package/styles/image-editor/fabric-dark.css +20 -8
  44. package/styles/image-editor/fabric.css +20 -8
  45. package/styles/image-editor/fluent-dark.css +20 -8
  46. package/styles/image-editor/fluent.css +20 -8
  47. package/styles/image-editor/highcontrast-light.css +20 -8
  48. package/styles/image-editor/highcontrast.css +20 -8
  49. package/styles/image-editor/material-dark.css +20 -8
  50. package/styles/image-editor/material.css +20 -8
  51. package/styles/image-editor/material3-dark.css +20 -8
  52. package/styles/image-editor/material3.css +20 -8
  53. package/styles/image-editor/tailwind-dark.css +20 -8
  54. package/styles/image-editor/tailwind.css +20 -8
  55. package/styles/material-dark.css +20 -8
  56. package/styles/material.css +20 -8
  57. package/styles/material3-dark.css +20 -8
  58. package/styles/material3.css +20 -8
  59. package/styles/tailwind-dark.css +20 -8
  60. package/styles/tailwind.css +20 -8
@@ -163,8 +163,19 @@ var Export = /** @class */ (function () {
163
163
  };
164
164
  Export.prototype.exportToCanvas = function (object) {
165
165
  var parent = this.parent;
166
+ var width;
167
+ var height;
168
+ if (parent.currSelectionPoint) {
169
+ width = parent.img.srcWidth;
170
+ height = parent.img.srcHeight;
171
+ }
172
+ else {
173
+ width = parent.baseImg.width;
174
+ height = parent.baseImg.height;
175
+ }
166
176
  var obj = { width: 0, height: 0 };
167
- parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false, value: { obj: obj } });
177
+ parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
178
+ value: { obj: obj, dimension: { width: width, height: height } } });
168
179
  var ratio = obj;
169
180
  var tempContextFilter = this.lowerContext.filter;
170
181
  // Manipulating blur value
@@ -175,42 +186,30 @@ var Export = /** @class */ (function () {
175
186
  splitWords[5] = 'blur(' + value + 'px)';
176
187
  this.lowerContext.filter = splitWords.join(' ');
177
188
  }
178
- var maxDimension;
179
189
  var tempCanvas = parent.createElement('canvas', {
180
190
  id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
181
191
  });
182
192
  var tempContext = tempCanvas.getContext('2d');
183
193
  tempContext.filter = this.lowerContext.filter;
184
- if (parent.currSelectionPoint) {
185
- tempCanvas.width = parent.img.destWidth;
186
- tempCanvas.height = parent.img.destHeight;
187
- tempContext.filter = this.lowerContext.filter;
188
- var temp = this.lowerContext.filter;
189
- parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
190
- tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.img.destWidth, parent.img.destHeight);
191
- this.lowerContext.filter = temp;
192
- }
193
- else {
194
- tempCanvas.width = parent.baseImg.width;
195
- tempCanvas.height = parent.baseImg.height;
196
- var obj_2 = { width: 0, height: 0 };
197
- parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
198
- value: { width: parent.baseImg.width, height: parent.baseImg.height, obj: obj_2 } });
199
- maxDimension = obj_2;
200
- tempCanvas.style.maxWidth = maxDimension.width + 'px';
201
- tempCanvas.style.maxHeight = maxDimension.height + 'px';
202
- tempContext.filter = this.lowerContext.filter;
203
- var temp = this.lowerContext.filter;
204
- parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
205
- tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.baseImg.width, parent.baseImg.height);
206
- this.lowerContext.filter = temp;
207
- }
194
+ tempCanvas.width = width;
195
+ tempCanvas.height = height;
196
+ var dimObj = { width: 0, height: 0 };
197
+ parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
198
+ value: { width: width, height: height, obj: dimObj } });
199
+ var maxDimension = dimObj;
200
+ tempCanvas.style.maxWidth = maxDimension.width + 'px';
201
+ tempCanvas.style.maxHeight = maxDimension.height + 'px';
202
+ tempContext.filter = this.lowerContext.filter;
203
+ var temp = this.lowerContext.filter;
204
+ parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
205
+ tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
206
+ this.lowerContext.filter = temp;
208
207
  if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
209
208
  this.updateSaveContext(tempContext);
210
209
  this.exportTransformedImage(tempContext);
211
210
  }
212
211
  if (parent.objColl.length > 0) {
213
- var temp = tempContext.filter;
212
+ var temp_1 = tempContext.filter;
214
213
  tempContext.filter = 'none';
215
214
  var tempObjColl = extend([], parent.objColl, [], true);
216
215
  for (var i = 0, len = parent.objColl.length; i < len; i++) {
@@ -223,22 +222,20 @@ var Export = /** @class */ (function () {
223
222
  activePoint.width = activePoint.endX - activePoint.startX;
224
223
  activePoint.height = activePoint.endY - activePoint.startY;
225
224
  // Manipulating points
226
- if (isNullOrUndefined(parent.currSelectionPoint)) {
227
- activePoint.startX *= ratio.width;
228
- activePoint.startY *= ratio.height;
229
- activePoint.endX *= ratio.width;
230
- activePoint.endY *= ratio.height;
231
- activePoint.width = activePoint.endX - activePoint.startX;
232
- activePoint.height = activePoint.endY - activePoint.startY;
233
- parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
234
- if (parent.objColl[i].shape === 'text') {
235
- parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
236
- }
225
+ activePoint.startX *= ratio.width;
226
+ activePoint.startY *= ratio.height;
227
+ activePoint.endX *= ratio.width;
228
+ activePoint.endY *= ratio.height;
229
+ activePoint.width = activePoint.endX - activePoint.startX;
230
+ activePoint.height = activePoint.endY - activePoint.startY;
231
+ parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
232
+ if (parent.objColl[i].shape === 'text') {
233
+ parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
237
234
  }
238
235
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
239
236
  points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
240
237
  }
241
- tempContext.filter = temp;
238
+ tempContext.filter = temp_1;
242
239
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
243
240
  parent.objColl = tempObjColl;
244
241
  }
@@ -249,18 +246,10 @@ var Export = /** @class */ (function () {
249
246
  parent.points = extend([], parent.pointColl[n].points, []);
250
247
  parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
251
248
  var len = parent.points.length;
252
- if (parent.currSelectionPoint) {
253
- for (var l = 0; l < len; l++) {
254
- parent.points[l].x -= parent.img.destLeft;
255
- parent.points[l].y -= parent.img.destTop;
256
- }
257
- }
258
- else {
259
- parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
260
- for (var l = 0; l < len; l++) {
261
- parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
262
- parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
263
- }
249
+ parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
250
+ for (var l = 0; l < len; l++) {
251
+ parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
252
+ parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
264
253
  }
265
254
  }
266
255
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
@@ -272,6 +261,7 @@ var Export = /** @class */ (function () {
272
261
  value: { context: tempContext, isSave: true, isFlip: null } });
273
262
  }
274
263
  this.lowerContext.filter = tempContextFilter;
264
+ parent.canvasFilter = tempContextFilter;
275
265
  if (object) {
276
266
  object['canvas'] = tempCanvas;
277
267
  }
@@ -306,17 +296,10 @@ var Export = /** @class */ (function () {
306
296
  };
307
297
  Export.prototype.exportRotate = function (tempContext, degree) {
308
298
  var parent = this.parent;
309
- if (isNullOrUndefined(parent.currSelectionPoint)) {
310
- this.setMaxDim(parent.transform.degree, tempContext.canvas);
311
- tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
312
- tempContext.rotate(Math.PI / 180 * degree);
313
- tempContext.drawImage(parent.inMemoryCanvas, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
314
- }
315
- else {
316
- tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
317
- tempContext.rotate(Math.PI / 180 * degree);
318
- tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
319
- }
299
+ this.setMaxDim(parent.transform.degree, tempContext.canvas);
300
+ tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
301
+ tempContext.rotate(Math.PI / 180 * degree);
302
+ tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
320
303
  this.updateSaveContext(tempContext);
321
304
  };
322
305
  Export.prototype.exportFlip = function (tempContext, flipHorizontal, flipVertical) {
@@ -343,12 +326,12 @@ var Export = /** @class */ (function () {
343
326
  var newWidth;
344
327
  var newHeight;
345
328
  if (degree % 90 === 0 && degree % 180 !== 0) {
346
- newWidth = this.parent.baseImg.height;
347
- newHeight = this.parent.baseImg.width;
329
+ newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
330
+ newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
348
331
  }
349
332
  else if (degree % 180 === 0 || degree === 0) {
350
- newWidth = this.parent.baseImg.width;
351
- newHeight = this.parent.baseImg.height;
333
+ newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
334
+ newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
352
335
  }
353
336
  tempCanvas.width = newWidth;
354
337
  tempCanvas.height = newHeight;
@@ -1,4 +1,5 @@
1
1
  import { EventHandler, extend, isBlazor, isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ import { ShapeType } from '../index';
2
3
  var FreehandDrawing = /** @class */ (function () {
3
4
  function FreehandDrawing(parent) {
4
5
  this.fhdObj = { lastWidth: 0, lastVelocity: 0, time: 0, pointX: 0, pointY: 0 };
@@ -604,6 +605,7 @@ var FreehandDrawing = /** @class */ (function () {
604
605
  }
605
606
  };
606
607
  FreehandDrawing.prototype.selectFhd = function (index) {
608
+ var _this = this;
607
609
  var parent = this.parent;
608
610
  parent.notify('selection', { prop: 'setFreehandDrawEditing', onPropertyChange: false, value: { bool: true } });
609
611
  if (index || index === 0) {
@@ -628,7 +630,29 @@ var FreehandDrawing = /** @class */ (function () {
628
630
  var obj = { bool: false };
629
631
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
630
632
  if (obj['bool']) {
631
- if (!isBlazor()) {
633
+ var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
634
+ startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
635
+ strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
636
+ points: parent.pointColl[this.fhdSelIdx].points };
637
+ var shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
638
+ currentShapeSettings: shapeSettings };
639
+ if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
640
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
641
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
642
+ parent.pointColl[_this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
643
+ parent.pointColl[_this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
644
+ parent.pointColl[_this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
645
+ _this.freehandRedraw(_this.upperContext);
646
+ parent.updateToolbar(parent.element, 'imageLoaded');
647
+ parent.updateToolbar(parent.element, 'pen');
648
+ });
649
+ }
650
+ else {
651
+ parent.trigger('shapeChanging', shapeChangingArgs);
652
+ parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
653
+ parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
654
+ parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
655
+ this.freehandRedraw(this.upperContext);
632
656
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
633
657
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
634
658
  }
@@ -109,6 +109,7 @@ export declare class Selection {
109
109
  private canvasMouseMoveHandler;
110
110
  private canvasMouseUpHandler;
111
111
  private touchStartHandler;
112
+ private unwireEvent;
112
113
  private keyDownEventHandler;
113
114
  private isKeyBoardCrop;
114
115
  private beforeSaveEvent;
@@ -237,6 +237,12 @@ var Selection = /** @class */ (function () {
237
237
  case 'reset':
238
238
  this.reset();
239
239
  break;
240
+ case 'unWireEvent':
241
+ this.unwireEvent();
242
+ break;
243
+ case 'updPtCollForShpRot':
244
+ this.updPtCollForShpRot(args.value['obj']);
245
+ break;
240
246
  }
241
247
  };
242
248
  Selection.prototype.getModuleName = function () {
@@ -3098,6 +3104,9 @@ var Selection = /** @class */ (function () {
3098
3104
  if (!this.isFhdEditing) {
3099
3105
  this.applyCurrActObj(x, y);
3100
3106
  parent.currObjType.isResize = false;
3107
+ if (!isBlazor()) {
3108
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3109
+ }
3101
3110
  }
3102
3111
  }
3103
3112
  if (parent.activeObj) {
@@ -3580,6 +3589,12 @@ var Selection = /** @class */ (function () {
3580
3589
  EventHandler.add(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler, this);
3581
3590
  EventHandler.add(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler, this);
3582
3591
  };
3592
+ Selection.prototype.unwireEvent = function () {
3593
+ EventHandler.remove(this.parent.lowerCanvas, 'touchend', this.mouseUpEventHandler);
3594
+ EventHandler.remove(this.parent.lowerCanvas, 'touchmove', this.mouseMoveEventHandler);
3595
+ EventHandler.remove(this.parent.upperCanvas, 'touchend', this.mouseUpEventHandler);
3596
+ EventHandler.remove(this.parent.upperCanvas, 'touchmove', this.mouseMoveEventHandler);
3597
+ };
3583
3598
  Selection.prototype.keyDownEventHandler = function (e) {
3584
3599
  var _this = this;
3585
3600
  var parent = this.parent;
@@ -4415,8 +4430,10 @@ var Selection = /** @class */ (function () {
4415
4430
  fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
4416
4431
  radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
4417
4432
  length: parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ? parent.activeObj.activePoint.width : null,
4418
- text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory : null) : null,
4433
+ text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
4434
+ (parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
4419
4435
  fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
4436
+ fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
4420
4437
  fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
4421
4438
  color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
4422
4439
  };
@@ -4460,12 +4477,14 @@ var Selection = /** @class */ (function () {
4460
4477
  if (degree < 0) {
4461
4478
  degree = 360 + degree;
4462
4479
  }
4463
- for (var i = 0; i < obj.flipObjColl.length; i++) {
4464
- if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
4465
- isHorizontalflip = true;
4466
- }
4467
- else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
4468
- isVerticalflip = true;
4480
+ if (obj.flipObjColl) {
4481
+ for (var i = 0; i < obj.flipObjColl.length; i++) {
4482
+ if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
4483
+ isHorizontalflip = true;
4484
+ }
4485
+ else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
4486
+ isVerticalflip = true;
4487
+ }
4469
4488
  }
4470
4489
  }
4471
4490
  if (degree === 0 || degree === 360) {
@@ -26,7 +26,9 @@ export declare class Shape {
26
26
  private setDimension;
27
27
  private getArrowType;
28
28
  private drawShape;
29
+ private initShapeProps;
29
30
  private setPointCollForLineAndArrow;
31
+ private prevObjColl;
30
32
  private drawShapeText;
31
33
  private drawShapeTextEvent;
32
34
  private initializeTextShape;
@@ -38,7 +38,7 @@ var Shape = /** @class */ (function () {
38
38
  this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
39
39
  break;
40
40
  case 'drawRectangle':
41
- this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidt'], args.value['strokeColor'], args.value['fillColor']);
41
+ this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
42
42
  break;
43
43
  case 'drawText':
44
44
  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']);
@@ -229,10 +229,10 @@ var Shape = /** @class */ (function () {
229
229
  { text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
230
230
  this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
231
231
  };
232
- Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
232
+ Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
233
233
  this.initializeShape('ellipse');
234
234
  var start = x && y ? { x: x, y: y } : null;
235
- this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
235
+ this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
236
236
  };
237
237
  Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
238
238
  this.initializeShape('line');
@@ -263,10 +263,10 @@ var Shape = /** @class */ (function () {
263
263
  var height = endY - startY;
264
264
  this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
265
265
  };
266
- Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
266
+ Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
267
267
  this.initializeShape('rectangle');
268
268
  var start = x && y ? { x: x, y: y } : null;
269
- this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
269
+ this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
270
270
  };
271
271
  Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
272
272
  this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
@@ -305,7 +305,7 @@ var Shape = /** @class */ (function () {
305
305
  }
306
306
  return arrowType;
307
307
  };
308
- Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
308
+ Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
309
309
  var _this = this;
310
310
  var parent = this.parent;
311
311
  if (!parent.disabled && parent.isImageLoaded) {
@@ -374,10 +374,7 @@ var Shape = /** @class */ (function () {
374
374
  parent.activeObj.triangleDirection = 'right';
375
375
  }
376
376
  parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
377
- parent.activeObj.shapeDegree = parent.transform.degree;
378
- parent.activeObj.shapeFlip = parent.transform.currFlipState;
379
- parent.activeObj.textFlip = parent.transform.currFlipState;
380
- parent.activeObj.flipObjColl = [];
377
+ this.initShapeProps();
381
378
  var obj = { shapeSettingsObj: {} };
382
379
  parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
383
380
  var shapeSettings = obj['shapeSettingsObj'];
@@ -389,6 +386,10 @@ var Shape = /** @class */ (function () {
389
386
  _this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
390
387
  _this.setDimension(width, height);
391
388
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
389
+ if (degree) {
390
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
391
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
392
+ }
392
393
  parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
393
394
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
394
395
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
@@ -403,6 +404,10 @@ var Shape = /** @class */ (function () {
403
404
  this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
404
405
  this.setDimension(width, height);
405
406
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
407
+ if (degree) {
408
+ parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
409
+ parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
410
+ }
406
411
  if (!isBlazor()) {
407
412
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
408
413
  }
@@ -423,6 +428,13 @@ var Shape = /** @class */ (function () {
423
428
  }
424
429
  }
425
430
  };
431
+ Shape.prototype.initShapeProps = function () {
432
+ var parent = this.parent;
433
+ parent.activeObj.shapeDegree = parent.transform.degree;
434
+ parent.activeObj.shapeFlip = parent.transform.currFlipState;
435
+ parent.activeObj.textFlip = parent.transform.currFlipState;
436
+ parent.activeObj.flipObjColl = [];
437
+ };
426
438
  Shape.prototype.setPointCollForLineAndArrow = function () {
427
439
  var parent = this.parent;
428
440
  if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
@@ -437,6 +449,19 @@ var Shape = /** @class */ (function () {
437
449
  }
438
450
  }
439
451
  };
452
+ Shape.prototype.prevObjColl = function () {
453
+ var parent = this.parent;
454
+ var object = { currObj: {} };
455
+ parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
456
+ this.prevObj = object['currObj'];
457
+ this.prevObj.objColl = extend([], parent.objColl, [], true);
458
+ this.prevObj.pointColl = extend([], parent.pointColl, [], true);
459
+ this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
460
+ var selPointCollObj = { selPointColl: null };
461
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
462
+ value: { obj: selPointCollObj } });
463
+ this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
464
+ };
440
465
  Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
441
466
  var _this = this;
442
467
  var parent = this.parent;
@@ -449,16 +474,7 @@ var Shape = /** @class */ (function () {
449
474
  parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
450
475
  parent.togglePen = false;
451
476
  this.redrawActObj();
452
- var object = { currObj: {} };
453
- parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
454
- this.prevObj = object['currObj'];
455
- this.prevObj.objColl = extend([], parent.objColl, [], true);
456
- this.prevObj.pointColl = extend([], parent.pointColl, [], true);
457
- this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
458
- var selPointCollObj = { selPointColl: null };
459
- parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
460
- value: { obj: selPointCollObj } });
461
- this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
477
+ this.prevObjColl();
462
478
  this.refreshActiveObj();
463
479
  parent.activeObj.shape = parent.currObjType.shape = 'text';
464
480
  parent.currObjType.isCustomCrop = false;
@@ -697,9 +713,12 @@ var Shape = /** @class */ (function () {
697
713
  parent.activeObj.activePoint.width = shapeSettings.length;
698
714
  break;
699
715
  case 'text':
700
- parent.activeObj.keyHistory = shapeSettings.text;
716
+ parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
701
717
  parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
702
718
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
719
+ parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
720
+ break;
721
+ case 'rectangle':
703
722
  break;
704
723
  }
705
724
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
@@ -1565,6 +1584,7 @@ var Shape = /** @class */ (function () {
1565
1584
  if (actObj.flipObjColl.length === 4) {
1566
1585
  actObj.flipObjColl = [];
1567
1586
  flip = '';
1587
+ actObj.shapeFlip = '';
1568
1588
  }
1569
1589
  if (flip === '' && actObj.flipObjColl.length > 1) {
1570
1590
  flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
@@ -2216,6 +2236,10 @@ var Shape = /** @class */ (function () {
2216
2236
  shapeDetails.fontStyle.push('italic');
2217
2237
  }
2218
2238
  break;
2239
+ case 'path':
2240
+ shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
2241
+ shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
2242
+ break;
2219
2243
  }
2220
2244
  return shapeDetails;
2221
2245
  };
@@ -2486,7 +2510,12 @@ var Shape = /** @class */ (function () {
2486
2510
  this.lowerContext.filter = object['canvasFilter'];
2487
2511
  this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
2488
2512
  parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
2489
- parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
2513
+ if (!isBlazor()) {
2514
+ parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
2515
+ }
2516
+ else {
2517
+ parent.updateToolbar(parent.element, 'imageLoaded');
2518
+ }
2490
2519
  }
2491
2520
  };
2492
2521
  Shape.prototype.getMaxText = function (isTextBox, text, obj) {
@@ -144,6 +144,12 @@ var Transform = /** @class */ (function () {
144
144
  this.cropDimension.width = args.value['width'];
145
145
  this.cropDimension.height = args.value['height'];
146
146
  break;
147
+ case 'getPreventSelect':
148
+ args.value['obj']['bool'] = this.isPreventSelect;
149
+ break;
150
+ case 'setPreventSelect':
151
+ this.isPreventSelect = args.value['bool'];
152
+ break;
147
153
  case 'reset':
148
154
  this.reset();
149
155
  break;
@@ -1268,6 +1274,9 @@ var Transform = /** @class */ (function () {
1268
1274
  parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
1269
1275
  value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
1270
1276
  parent.objColl[i].flipObjColl = flipObjColl['collection'];
1277
+ if (parent.objColl[i].flipObjColl.length === 0) {
1278
+ parent.objColl[i].shapeFlip = '';
1279
+ }
1271
1280
  }
1272
1281
  }
1273
1282
  if (tempZoomFactor !== 0) {
@@ -1633,6 +1642,7 @@ var Transform = /** @class */ (function () {
1633
1642
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
1634
1643
  this.lowerContext.filter = tempFilter;
1635
1644
  parent.initialAdjustmentValue = tempFilter;
1645
+ parent.canvasFilter = this.lowerContext.filter;
1636
1646
  if (parent.isImageLoaded) {
1637
1647
  showSpinner(parent.element);
1638
1648
  parent.element.style.opacity = '0.5';
@@ -254,7 +254,9 @@ var UndoRedo = /** @class */ (function () {
254
254
  this.undoRedoStep--;
255
255
  if (!isBlazor()) {
256
256
  parent.notify('toolbar', { prop: 'enable-disable-btns' });
257
- parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
257
+ if (parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
258
+ parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
259
+ }
258
260
  }
259
261
  else {
260
262
  parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
@@ -357,7 +359,7 @@ var UndoRedo = /** @class */ (function () {
357
359
  parent.cropObj = extend({}, obj.currentCropObj, {}, true);
358
360
  parent.afterCropActions = obj.currentObj.afterCropActions;
359
361
  this.lowerContext.filter = obj.currentObj.filter;
360
- if (!isBlazor()) {
362
+ if (!isBlazor() && parent.element.querySelector('.e-contextual-toolbar-wrapper')) {
361
363
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
362
364
  }
363
365
  parent.canvasFilter = this.lowerContext.filter;
@@ -439,7 +439,7 @@ var ImageEditor = /** @class */ (function (_super) {
439
439
  this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
440
440
  this.lowerContext.filter = this.getDefaultFilter();
441
441
  this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
442
- this.notify('toolbar', { prop: 'setCanvasFilter', onPropertyChange: false, value: { filter: this.lowerContext.filter } });
442
+ this.canvasFilter = this.lowerContext.filter;
443
443
  this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
444
444
  if (this.cssClass) {
445
445
  addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
@@ -504,6 +504,7 @@ var ImageEditor = /** @class */ (function (_super) {
504
504
  screen.orientation.removeEventListener('change', this.screenOrientation.bind(this));
505
505
  }
506
506
  this.notify('shape', { prop: 'unWireEvent', onPropertyChange: false });
507
+ this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
507
508
  };
508
509
  ImageEditor.prototype.createCanvas = function () {
509
510
  this.element.style.boxSizing = 'border-box';
@@ -1440,8 +1441,10 @@ var ImageEditor = /** @class */ (function (_super) {
1440
1441
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
1441
1442
  var data = this.getImageData();
1442
1443
  if (!isBlazor()) {
1443
- this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
1444
- isApplyBtn: true, isCropping: false } });
1444
+ if (!Browser.isDevice) {
1445
+ this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
1446
+ isApplyBtn: true, isCropping: false } });
1447
+ }
1445
1448
  this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
1446
1449
  }
1447
1450
  this.objColl = objColl;
@@ -2056,8 +2059,8 @@ var ImageEditor = /** @class */ (function (_super) {
2056
2059
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2057
2060
  this.element = element;
2058
2061
  var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
2059
- if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
2060
- this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
2062
+ if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
2063
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
2061
2064
  }
2062
2065
  else {
2063
2066
  this.toolbarHeight = 0;
@@ -2074,9 +2077,6 @@ var ImageEditor = /** @class */ (function (_super) {
2074
2077
  });
2075
2078
  this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
2076
2079
  this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
2077
- this.baseImg = this.createElement('img', {
2078
- id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
2079
- });
2080
2080
  this.lowerContext = this.lowerCanvas.getContext('2d');
2081
2081
  this.baseImg = this.createElement('img', {
2082
2082
  id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
@@ -110,8 +110,8 @@ export interface CropEventArgs {
110
110
  */
111
111
  endPoint: Point;
112
112
  /**
113
- * Specifies whether to prevent scale-based cropping in the image editor.
114
- */
113
+ * Specifies whether to prevent scale-based cropping in the image editor.
114
+ */
115
115
  preventScaling: boolean;
116
116
  /**
117
117
  * Defines whether to cancel the cropping action of image editor.
@@ -373,6 +373,10 @@ export interface ShapeSettings {
373
373
  * Returns the font size of the text.
374
374
  */
375
375
  fontSize?: number;
376
+ /**
377
+ * Returns the font family of the text.
378
+ */
379
+ fontFamily?: string;
376
380
  /**
377
381
  * Returns the font style of the text.
378
382
  */