@syncfusion/ej2-image-editor 29.1.35 → 29.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 29.1.35
3
+ * version : 29.1.37
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-image-editor@*",
3
- "_id": "@syncfusion/ej2-image-editor@29.1.33",
3
+ "_id": "@syncfusion/ej2-image-editor@29.1.35",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-5WvUCaKFmkEfRIVvCkgz8VqxAxwpRZiB7k1V7T9URi/vc/OFELFipce/qPJy4hW3ca5HZRKpuRFA0wRhQGuN8g==",
5
+ "_integrity": "sha512-EAHNeEm8RdgqXmTAGTl6J6NpK4EA/Bg/54sWRy5XKP74Wm/XLDjwWfobxNbqMKPTCgXvgzVVUIIdWfNFIv0iUg==",
6
6
  "_location": "/@syncfusion/ej2-image-editor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-image-editor",
24
24
  "/@syncfusion/ej2-vue-image-editor"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-29.1.33.tgz",
27
- "_shasum": "91ad5ad1e062038a5c7cbbb01b2007c420eeb516",
26
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-29.1.35.tgz",
27
+ "_shasum": "0cbd5f1d03e7ad4011048a4c3132991432347ec9",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_29.1.1/packages/included",
30
30
  "author": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~29.1.35",
35
+ "@syncfusion/ej2-base": "~29.1.36",
36
36
  "@syncfusion/ej2-buttons": "~29.1.34",
37
- "@syncfusion/ej2-dropdowns": "~29.1.33",
37
+ "@syncfusion/ej2-dropdowns": "~29.1.37",
38
38
  "@syncfusion/ej2-inputs": "~29.1.34",
39
- "@syncfusion/ej2-navigations": "~29.1.34",
40
- "@syncfusion/ej2-popups": "~29.1.35",
39
+ "@syncfusion/ej2-navigations": "~29.1.37",
40
+ "@syncfusion/ej2-popups": "~29.1.37",
41
41
  "@syncfusion/ej2-splitbuttons": "~29.1.33"
42
42
  },
43
43
  "deprecated": false,
@@ -68,7 +68,7 @@
68
68
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
69
69
  },
70
70
  "typings": "index.d.ts",
71
- "version": "29.1.35",
71
+ "version": "29.1.37",
72
72
  "sideEffects": false,
73
73
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
74
74
  }
@@ -56,6 +56,7 @@ export declare class Draw {
56
56
  private tempStrokeWidth;
57
57
  private allowRedactStraighten;
58
58
  private isNullExtension;
59
+ private isRedactStraighten;
59
60
  constructor(parent: ImageEditor);
60
61
  destroy(): void;
61
62
  private addEventListener;
@@ -74,6 +74,7 @@ var Draw = /** @class */ (function () {
74
74
  this.imageBackgroundColor = '';
75
75
  this.allowRedactStraighten = true;
76
76
  this.isNullExtension = true;
77
+ this.isRedactStraighten = false;
77
78
  this.parent = parent;
78
79
  this.addEventListener();
79
80
  }
@@ -354,6 +355,9 @@ var Draw = /** @class */ (function () {
354
355
  case 'setNullExtension':
355
356
  this.isNullExtension = args.value['extension'];
356
357
  break;
358
+ case 'setRedactStraighten':
359
+ this.isRedactStraighten = args.value['bool'];
360
+ break;
357
361
  }
358
362
  };
359
363
  Draw.prototype.getModuleName = function () {
@@ -407,6 +411,7 @@ var Draw = /** @class */ (function () {
407
411
  this.tempStrokeWidth = null;
408
412
  this.straightenDestPoints = null;
409
413
  this.isCropSelect = this.isDownScale = this.preventStraightening = false;
414
+ this.isRedactStraighten = false;
410
415
  };
411
416
  Draw.prototype.redrawDownScale = function () {
412
417
  var parent = this.parent;
@@ -5194,8 +5199,7 @@ var Draw = /** @class */ (function () {
5194
5199
  var imageWidth = canvas.width;
5195
5200
  var imageHeight = canvas.height;
5196
5201
  var tempRatio = Math.min(imageWidth, imageHeight) / 1000;
5197
- var straighten = this.parent.transform.straighten !== 0 ? this.parent.transform.straighten :
5198
- this.parent.cropObj.straighten;
5202
+ var straighten = Math.round(this.parent.activeObj.rotatedAngle * (180 / Math.PI));
5199
5203
  if (this.allowRedactStraighten && straighten !== 0) {
5200
5204
  var tempCanvas = document.createElement('canvas');
5201
5205
  var tempCtx = tempCanvas.getContext('2d');
@@ -5205,9 +5209,9 @@ var Draw = /** @class */ (function () {
5205
5209
  tempCtx.drawImage(canvas, 0, 0);
5206
5210
  }
5207
5211
  else {
5208
- tempCanvas.width = img.destWidth;
5209
- tempCanvas.height = img.destHeight;
5210
- tempCtx.drawImage(this.lowerContext.canvas, img.destLeft, img.destTop, img.destWidth, img.destHeight, 0, 0, img.destWidth, img.destHeight);
5212
+ tempCanvas.width = img.destWidth > canvas.width ? canvas.width : img.destWidth;
5213
+ tempCanvas.height = img.destHeight > canvas.height ? canvas.height : img.destHeight;
5214
+ tempCtx.drawImage(this.lowerContext.canvas, img.destLeft > 0 ? img.destLeft : 0, img.destTop > 0 ? img.destTop : 0, tempCanvas.width, tempCanvas.height, 0, 0, tempCanvas.width, tempCanvas.height);
5211
5215
  }
5212
5216
  var radians = -straighten * Math.PI / 180;
5213
5217
  var straightenCanvas = document.createElement('canvas');
@@ -5262,10 +5266,14 @@ var Draw = /** @class */ (function () {
5262
5266
  y: sinAngle * (p2.x - center.x) + cosAngle * (p2.y - center.y) + center.y };
5263
5267
  var newP3 = { x: cosAngle * (p3.x - center.x) - sinAngle * (p3.y - center.y) + center.x,
5264
5268
  y: sinAngle * (p3.x - center.x) + cosAngle * (p3.y - center.y) + center.y };
5265
- var tempWidth = isSaveCtx ? canvasDraw.canvas.width : img.destWidth;
5266
- var tempHeight = isSaveCtx ? canvasDraw.canvas.height : img.destHeight;
5269
+ var tempWidth = isSaveCtx ? canvasDraw.canvas.width :
5270
+ (img.destWidth > canvas.width ? canvas.width : img.destWidth);
5271
+ var tempHeight = isSaveCtx ? canvasDraw.canvas.height :
5272
+ (img.destHeight > canvas.height ? canvas.height : img.destHeight);
5267
5273
  var rotatedWidth = Math.abs(tempWidth * Math.cos(radians)) + Math.abs(tempHeight * Math.sin(radians));
5268
5274
  var rotatedHeight = Math.abs(tempWidth * Math.sin(radians)) + Math.abs(tempHeight * Math.cos(radians));
5275
+ var prevWidth = straightenCanvas.width;
5276
+ var prevHeight = straightenCanvas.height;
5269
5277
  straightenCanvas.width = rotatedWidth;
5270
5278
  straightenCanvas.height = rotatedHeight;
5271
5279
  straightenCtx.save();
@@ -5276,7 +5284,13 @@ var Draw = /** @class */ (function () {
5276
5284
  if (this.parent.activeObj.redactType === 'blur') {
5277
5285
  offscreenCanvas.width = width;
5278
5286
  offscreenCanvas.height = height;
5279
- offscreenCtx.drawImage(straightenCanvas, newP1.x + ((rotatedWidth - tempCanvas.width) / 2), newP1.y + ((rotatedHeight - tempCanvas.height) / 2), newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, width, height);
5287
+ var x = newP1.x + ((rotatedWidth - prevWidth) / 2);
5288
+ var y = newP1.y + ((rotatedHeight - prevHeight) / 2);
5289
+ if (this.isRedactStraighten) {
5290
+ x = startX + ((rotatedWidth - prevWidth) / 2);
5291
+ y = startY + ((rotatedHeight - prevHeight) / 2);
5292
+ }
5293
+ offscreenCtx.drawImage(straightenCanvas, x, y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, width, height);
5280
5294
  }
5281
5295
  else {
5282
5296
  var pixelSize = (obj.redactPixelate / 100) * 20;
@@ -5285,7 +5299,13 @@ var Draw = /** @class */ (function () {
5285
5299
  }
5286
5300
  offscreenCanvas.width = Math.ceil(width / pixelSize);
5287
5301
  offscreenCanvas.height = Math.ceil(height / pixelSize);
5288
- offscreenCtx.drawImage(straightenCanvas, newP1.x + ((rotatedWidth - tempCanvas.width) / 2), newP1.y + ((rotatedHeight - tempCanvas.height) / 2), newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, offscreenCanvas.width, offscreenCanvas.height);
5302
+ var x = newP1.x + ((rotatedWidth - prevWidth) / 2);
5303
+ var y = newP1.y + ((rotatedHeight - prevHeight) / 2);
5304
+ if (this.isRedactStraighten) {
5305
+ x = startX + ((rotatedWidth - prevWidth) / 2);
5306
+ y = startY + ((rotatedHeight - prevHeight) / 2);
5307
+ }
5308
+ offscreenCtx.drawImage(straightenCanvas, x, y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, offscreenCanvas.width, offscreenCanvas.height);
5289
5309
  }
5290
5310
  }
5291
5311
  if (this.parent.activeObj.redactType === 'blur') {
@@ -3486,7 +3486,11 @@ var Selection = /** @class */ (function () {
3486
3486
  parent.editCompleteArgs = shapeChangedArgs;
3487
3487
  }
3488
3488
  var isPenDraw = parent.togglePen;
3489
+ var tempCursor_1 = parent.cursor;
3489
3490
  parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
3491
+ if (activeObj.shape === 'redact' && tempCursor_1 !== 'default') {
3492
+ parent.cursor = tempCursor_1;
3493
+ }
3490
3494
  if (isPenDraw) {
3491
3495
  parent.freeHandDraw(true);
3492
3496
  }
@@ -3523,7 +3527,7 @@ var Selection = /** @class */ (function () {
3523
3527
  this.dragElement = '';
3524
3528
  this.dragPoint.startX = this.dragPoint.startY = this.dragPoint.endX = this.dragPoint.endY = 0;
3525
3529
  }
3526
- if (((this.isTouch && tempCursor !== 'crosshair' || parent.cursor !== 'crosshair') &&
3530
+ if (((this.isTouch && tempCursor_1 !== 'crosshair' || parent.cursor !== 'crosshair') &&
3527
3531
  e.type.toLowerCase() === 'touchstart') ||
3528
3532
  (parent.currObjType.isActiveObj && parent.cursor !== 'default' && !parent.togglePen)) {
3529
3533
  parent.notify('draw', { prop: 'updateTempObjColl' });
@@ -836,7 +836,9 @@ var Shape = /** @class */ (function () {
836
836
  parent.pointColl[shapeId].strokeColor = shapeSettings.strokeColor;
837
837
  parent.pointColl[shapeId].strokeWidth = shapeSettings.strokeWidth;
838
838
  parent.pointColl[shapeId].opacity = shapeSettings.opacity;
839
- parent.pointColl[shapeId].order = shapeSettings.index;
839
+ if (shapeSettings.index) {
840
+ parent.pointColl[shapeId].order = shapeSettings.index;
841
+ }
840
842
  }
841
843
  else {
842
844
  parent.activeObj.activePoint.startX = shapeSettings.startX;
@@ -853,7 +855,9 @@ var Shape = /** @class */ (function () {
853
855
  }
854
856
  parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
855
857
  parent.activeObj.opacity = shapeSettings.opacity;
856
- parent.activeObj.order = shapeSettings.index;
858
+ if (shapeSettings.index) {
859
+ parent.activeObj.order = shapeSettings.index;
860
+ }
857
861
  parent.activeObj.preventShapeDragOut = !allowShapeOverflow;
858
862
  if (isNullOrUndefined(shapeSettings.degree)) {
859
863
  shapeSettings.degree = 0;
@@ -2673,16 +2677,16 @@ var Shape = /** @class */ (function () {
2673
2677
  var parent = this.parent;
2674
2678
  var style = parent.textArea.style;
2675
2679
  if (style.display === 'block' || style.display === 'inline-block') {
2676
- if (style.fontWeight === 'normal' && fontWeight === 'bold') {
2680
+ if (fontWeight === 'bold') {
2677
2681
  style.fontWeight = 'bold';
2678
2682
  }
2679
- else if (style.fontWeight === 'bold' && fontWeight === 'bold') {
2683
+ else {
2680
2684
  style.fontWeight = 'normal';
2681
2685
  }
2682
- if (style.fontStyle === 'normal' && fontStyle === 'italic') {
2686
+ if (fontStyle === 'italic') {
2683
2687
  style.fontStyle = 'italic';
2684
2688
  }
2685
- else if (style.fontStyle === 'italic' && fontStyle === 'italic') {
2689
+ else {
2686
2690
  style.fontStyle = 'normal';
2687
2691
  }
2688
2692
  var value = (style.fontWeight === 'normal' && style.fontStyle === 'normal' ? 'default' :
@@ -5249,6 +5249,9 @@ var ToolbarModule = /** @class */ (function () {
5249
5249
  var actionType;
5250
5250
  var actionArgs;
5251
5251
  var isRedactClick = false;
5252
+ var zoomLevel = 0;
5253
+ var actObj;
5254
+ var isRedact = false;
5252
5255
  if (parent.activeObj.shape !== undefined) {
5253
5256
  splitWords = parent.activeObj.shape.split('-');
5254
5257
  }
@@ -5498,7 +5501,36 @@ var ToolbarModule = /** @class */ (function () {
5498
5501
  case 'horizontalflip':
5499
5502
  case 'verticalflip':
5500
5503
  parent.transformSelect(type);
5504
+ for (var i = 0; i < parent.objColl.length; i++) {
5505
+ if (parent.objColl[i].shape === 'redact') {
5506
+ isRedact = true;
5507
+ break;
5508
+ }
5509
+ }
5510
+ if (isRedact) {
5511
+ parent.notify('draw', { prop: 'setRedactStraighten', value: { bool: true } });
5512
+ actObj = extend({}, parent.activeObj, {}, true);
5513
+ while (parent.img.destLeft < 0 || parent.img.destTop < 0) {
5514
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
5515
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
5516
+ value: { zoomFactor: -.125, zoomPoint: null, isResize: false } });
5517
+ zoomLevel += 1;
5518
+ }
5519
+ }
5501
5520
  this.updateRedactObj();
5521
+ if (isRedact) {
5522
+ if (zoomLevel > 0) {
5523
+ parent.isCropTab = true;
5524
+ for (var i = 0; i < zoomLevel; i++) {
5525
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
5526
+ parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
5527
+ value: { zoomFactor: .125, zoomPoint: null, isResize: false } });
5528
+ }
5529
+ parent.activeObj = actObj;
5530
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
5531
+ }
5532
+ parent.notify('draw', { prop: 'setRedactStraighten', value: { bool: false } });
5533
+ }
5502
5534
  if (type === 'rotateleft' || type === 'rotateright') {
5503
5535
  parent.notify('draw', { prop: 'resetStraightenDestPoints' });
5504
5536
  parent.notify('draw', { prop: 'setDestForStraighten' });