@syncfusion/ej2-image-editor 27.1.51 → 27.1.53

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 : 27.1.51
3
+ * version : 27.1.53
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. 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@27.1.50",
3
+ "_id": "@syncfusion/ej2-image-editor@27.1.52",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-jbOqBMJzNwFx5r4c2P3xYh1n3aW2br4yKOwC8alxYLnRfDY6d5OTbWY62XEAdW30IqaQHH635RpdhZUkHVtGhg==",
5
+ "_integrity": "sha512-4y4FiADe4A4Y5hu5mauYQwkHPa+rNYrtX5DFVwWITwzAvinOMwQe9sMg1rMjx3qnpwFDH06C9qR7Qm/kdDgd3Q==",
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-27.1.50.tgz",
27
- "_shasum": "f84391b62e7a8c4e10937b6603abaeb16e3a66d1",
26
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-27.1.52.tgz",
27
+ "_shasum": "7cd217a052e3fb179ad0f19d492d7df369c8b183",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
30
30
  "author": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~27.1.50",
36
- "@syncfusion/ej2-buttons": "~27.1.51",
37
- "@syncfusion/ej2-dropdowns": "~27.1.51",
35
+ "@syncfusion/ej2-base": "~27.1.53",
36
+ "@syncfusion/ej2-buttons": "~27.1.53",
37
+ "@syncfusion/ej2-dropdowns": "~27.1.53",
38
38
  "@syncfusion/ej2-inputs": "~27.1.50",
39
- "@syncfusion/ej2-navigations": "~27.1.51",
40
- "@syncfusion/ej2-popups": "~27.1.50",
39
+ "@syncfusion/ej2-navigations": "~27.1.53",
40
+ "@syncfusion/ej2-popups": "~27.1.53",
41
41
  "@syncfusion/ej2-splitbuttons": "~27.1.50"
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": "27.1.51",
71
+ "version": "27.1.53",
72
72
  "sideEffects": false,
73
73
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
74
74
  }
@@ -82,6 +82,7 @@ export declare class Draw {
82
82
  private drawCenterCircles;
83
83
  private drawRotationArcLine;
84
84
  private drawSquareLines;
85
+ private drawRoundedRect;
85
86
  private drawSelection;
86
87
  private shapeCircle;
87
88
  private shapeLine;
@@ -1386,8 +1386,13 @@ var Draw = /** @class */ (function () {
1386
1386
  var baseRadius = isTempCanvas ? radius * 10 * ((ratio.width + ratio.height) / 2) : radius * 10;
1387
1387
  var adjustedRadius = baseRadius + (baseRadius * zoomFactor);
1388
1388
  if (radius !== null) {
1389
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1390
- canvasDraw.roundRect(startX, startY, width, height, adjustedRadius);
1389
+ if (parent.isSafari) {
1390
+ this.drawRoundedRect(canvasDraw, startX, startY, width, height, adjustedRadius);
1391
+ }
1392
+ else {
1393
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1394
+ canvasDraw.roundRect(startX, startY, width, height, adjustedRadius);
1395
+ }
1391
1396
  }
1392
1397
  else {
1393
1398
  canvasDraw.rect(startX, startY, width, height);
@@ -1397,8 +1402,13 @@ var Draw = /** @class */ (function () {
1397
1402
  canvasDraw.fill();
1398
1403
  }
1399
1404
  if (radius !== null) {
1400
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1401
- canvasDraw.roundRect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
1405
+ if (parent.isSafari) {
1406
+ this.drawRoundedRect(canvasDraw, startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
1407
+ }
1408
+ else {
1409
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1410
+ canvasDraw.roundRect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
1411
+ }
1402
1412
  }
1403
1413
  else {
1404
1414
  canvasDraw.rect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth));
@@ -1407,6 +1417,15 @@ var Draw = /** @class */ (function () {
1407
1417
  canvasDraw.fill('evenodd');
1408
1418
  canvasDraw.closePath();
1409
1419
  };
1420
+ Draw.prototype.drawRoundedRect = function (canvasDraw, startX, startY, width, height, radius) {
1421
+ var rectRadius = Math.max(0, Math.min(radius, width / 2, height / 2));
1422
+ canvasDraw.moveTo(startX + rectRadius, startY);
1423
+ canvasDraw.arcTo(startX + width, startY, startX + width, startY + height, rectRadius);
1424
+ canvasDraw.arcTo(startX + width, startY + height, startY, startY + height, rectRadius);
1425
+ canvasDraw.arcTo(startX, startY + height, startX, startY, rectRadius);
1426
+ canvasDraw.arcTo(startX, startY, startX + width, startY, rectRadius);
1427
+ canvasDraw.closePath();
1428
+ };
1410
1429
  Draw.prototype.drawSelection = function (horLineWidth, verLineHeight) {
1411
1430
  var parent = this.parent;
1412
1431
  var actObj = parent.activeObj;
@@ -2108,12 +2127,7 @@ var Draw = /** @class */ (function () {
2108
2127
  var coll = actObj.rotateFlipColl[i];
2109
2128
  tempColl.push(coll);
2110
2129
  if (typeof (coll) === 'number') {
2111
- if (actObj.shapeDegree === 0) {
2112
- tempDegree = coll;
2113
- }
2114
- else {
2115
- tempDegree = coll - actObj.shapeDegree;
2116
- }
2130
+ tempDegree = coll;
2117
2131
  if (tempDegree === -450) {
2118
2132
  tempDegree = -90;
2119
2133
  }
@@ -2213,12 +2227,7 @@ var Draw = /** @class */ (function () {
2213
2227
  var coll = actObj.rotateFlipColl[i];
2214
2228
  tempColl.push(coll);
2215
2229
  if (typeof (coll) === 'number') {
2216
- if (actObj.shapeDegree === 0) {
2217
- tempDegree = coll;
2218
- }
2219
- else {
2220
- tempDegree = coll - actObj.shapeDegree;
2221
- }
2230
+ tempDegree = coll;
2222
2231
  if (tempDegree === -450) {
2223
2232
  tempDegree = -90;
2224
2233
  }
@@ -5165,10 +5174,21 @@ var Draw = /** @class */ (function () {
5165
5174
  y: sinAngle * (p2.x - center.x) + cosAngle * (p2.y - center.y) + center.y };
5166
5175
  var newP3 = { x: cosAngle * (p3.x - center.x) - sinAngle * (p3.y - center.y) + center.x,
5167
5176
  y: sinAngle * (p3.x - center.x) + cosAngle * (p3.y - center.y) + center.y };
5177
+ var tempWidth = isSaveCtx ? canvasDraw.canvas.width : img.destWidth;
5178
+ var tempHeight = isSaveCtx ? canvasDraw.canvas.height : img.destHeight;
5179
+ var rotatedWidth = Math.abs(tempWidth * Math.cos(radians)) + Math.abs(tempHeight * Math.sin(radians));
5180
+ var rotatedHeight = Math.abs(tempWidth * Math.sin(radians)) + Math.abs(tempHeight * Math.cos(radians));
5181
+ straightenCanvas.width = rotatedWidth;
5182
+ straightenCanvas.height = rotatedHeight;
5183
+ straightenCtx.save();
5184
+ straightenCtx.translate(rotatedWidth / 2, rotatedHeight / 2);
5185
+ straightenCtx.rotate(radians);
5186
+ straightenCtx.drawImage(tempCanvas, -tempCanvas.width / 2, -tempCanvas.height / 2);
5187
+ straightenCtx.restore();
5168
5188
  if (this.parent.activeObj.redactType === 'blur') {
5169
5189
  offscreenCanvas.width = width;
5170
5190
  offscreenCanvas.height = height;
5171
- offscreenCtx.drawImage(straightenCanvas, newP1.x, newP1.y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, width, height);
5191
+ 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);
5172
5192
  }
5173
5193
  else {
5174
5194
  var pixelSize = (obj.redactPixelate / 100) * 20;
@@ -5177,7 +5197,7 @@ var Draw = /** @class */ (function () {
5177
5197
  }
5178
5198
  offscreenCanvas.width = Math.ceil(width / pixelSize);
5179
5199
  offscreenCanvas.height = Math.ceil(height / pixelSize);
5180
- offscreenCtx.drawImage(straightenCanvas, newP1.x, newP1.y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, offscreenCanvas.width, offscreenCanvas.height);
5200
+ 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);
5181
5201
  }
5182
5202
  }
5183
5203
  if (this.parent.activeObj.redactType === 'blur') {
@@ -657,7 +657,7 @@ var Filter = /** @class */ (function () {
657
657
  Filter.prototype.parseFilterString = function (filterString) {
658
658
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
659
659
  var filterArray = [];
660
- if (filterString !== 'none') {
660
+ if (filterString && filterString !== 'none') {
661
661
  filterArray = filterString.split(' ').map(function (filter) {
662
662
  var _a = filter.match(/([a-z-]+)\(([^)]+)\)/).slice(1, 3), name = _a[0], value = _a[1];
663
663
  return { filter: name, value: value };
@@ -3265,6 +3265,7 @@ var Selection = /** @class */ (function () {
3265
3265
  this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
3266
3266
  parent.activeObj.activePoint = activePoint;
3267
3267
  parent.isShapeDrawing = true;
3268
+ this.tempActiveObj = extend({}, parent.activeObj, {}, true);
3268
3269
  return;
3269
3270
  }
3270
3271
  parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
@@ -361,7 +361,8 @@ var Shape = /** @class */ (function () {
361
361
  };
362
362
  Shape.prototype.setDimension = function (width, height) {
363
363
  var parent = this.parent;
364
- if (width && height) {
364
+ var shape = parent.activeObj.shape;
365
+ if ((width && height) || ((shape === 'line' || shape === 'arrow') && (width || height))) {
365
366
  parent.activeObj.activePoint.width = width;
366
367
  parent.activeObj.activePoint.height = height;
367
368
  if (parent.currObjType.shape.toLowerCase() === 'ellipse') {
@@ -409,7 +410,7 @@ var Shape = /** @class */ (function () {
409
410
  strokeSettings.strokeWidth = 0;
410
411
  }
411
412
  strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
412
- strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
413
+ strokeSettings.fillColor = fillColor || fillColor === '' ? fillColor : strokeSettings.fillColor;
413
414
  strokeSettings.radius = radius ? radius : strokeSettings.radius;
414
415
  var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
415
416
  var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
@@ -641,7 +641,9 @@ var ImageEditor = /** @class */ (function (_super) {
641
641
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
642
642
  var supportObj = { key: 'SupportText' };
643
643
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
644
- content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, and SVG</b></span>';
644
+ var andObj = { key: 'And' };
645
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
646
+ content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, ' + andObj['value'] + ' SVG</b></span>';
645
647
  }
646
648
  var dialog = new Dialog({
647
649
  header: headerObj['value'],
@@ -1625,7 +1625,7 @@ var ToolbarModule = /** @class */ (function () {
1625
1625
  qualityOptionDiv.appendChild(parent.createElement('button', { id: id + '_qualitybuttonIcon', className: 'e-ie-img-icon-button', attrs: { type: 'button' } }));
1626
1626
  qualityNameDiv.appendChild(qualityOptionDiv);
1627
1627
  if (Browser.isDevice) {
1628
- qualityNameDiv.appendChild(parent.createElement('span', {
1628
+ dialogRightContent.appendChild(parent.createElement('span', {
1629
1629
  id: id + '_qualitySize', className: 'e-ie-img-quality-size'
1630
1630
  }));
1631
1631
  }
@@ -1885,48 +1885,44 @@ var ToolbarModule = /** @class */ (function () {
1885
1885
  }).bind(this), 'image/jpeg', quality);
1886
1886
  }
1887
1887
  else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
1888
- if (Browser.isDevice) {
1889
- canvas.style.display = 'none';
1888
+ ctx.drawImage(tempCanvas, 0, 0);
1889
+ tempCanvas.toBlob((function (blob) {
1890
+ fileSize = Math.floor(blob.size / 1024);
1891
+ if (fileSize > 1000) {
1892
+ var megabytes = fileSize / 1024;
1893
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
1894
+ fileSize = +megabytes.toFixed(2);
1895
+ }
1896
+ else {
1897
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
1898
+ fileSize = +fileSize.toFixed(2);
1899
+ }
1900
+ if (Browser.isDevice) {
1901
+ canvas.style.display = 'none';
1902
+ }
1903
+ this.fileSize = fileSize;
1904
+ }).bind(this), 'image/png', 1);
1905
+ }
1906
+ else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
1907
+ ctx.drawImage(tempCanvas, 0, 0);
1908
+ var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
1909
+ var base64Data = svgDataUrl.split(',')[1];
1910
+ var binaryStringLength = base64Data.length;
1911
+ var rawByteSize = binaryStringLength;
1912
+ var fileSize_1 = Math.floor(rawByteSize / 1024); // KB
1913
+ if (fileSize_1 > 1000) {
1914
+ var megabytes = fileSize_1 / 1024; // Convert to MB
1915
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
1916
+ fileSize_1 = +megabytes.toFixed(2);
1890
1917
  }
1891
1918
  else {
1892
- ctx.drawImage(tempCanvas, 0, 0);
1893
- tempCanvas.toBlob((function (blob) {
1894
- fileSize = Math.floor(blob.size / 1024);
1895
- if (fileSize > 1000) {
1896
- var megabytes = fileSize / 1024;
1897
- imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
1898
- fileSize = +megabytes.toFixed(2);
1899
- }
1900
- else {
1901
- imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
1902
- fileSize = +fileSize.toFixed(2);
1903
- }
1904
- this.fileSize = fileSize;
1905
- }).bind(this), 'image/png', 1);
1919
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize_1.toFixed(2) + ' KB';
1920
+ fileSize_1 = +fileSize_1.toFixed(2);
1906
1921
  }
1907
- }
1908
- else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
1909
1922
  if (Browser.isDevice) {
1910
1923
  canvas.style.display = 'none';
1911
1924
  }
1912
- else {
1913
- ctx.drawImage(tempCanvas, 0, 0);
1914
- var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
1915
- var base64Data = svgDataUrl.split(',')[1];
1916
- var binaryStringLength = base64Data.length;
1917
- var rawByteSize = binaryStringLength;
1918
- var fileSize_1 = Math.floor(rawByteSize / 1024); // KB
1919
- if (fileSize_1 > 1000) {
1920
- var megabytes = fileSize_1 / 1024; // Convert to MB
1921
- imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
1922
- fileSize_1 = +megabytes.toFixed(2);
1923
- }
1924
- else {
1925
- imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize_1.toFixed(2) + ' KB';
1926
- fileSize_1 = +fileSize_1.toFixed(2);
1927
- }
1928
- }
1929
- this.fileSize = fileSize;
1925
+ this.fileSize = fileSize_1;
1930
1926
  }
1931
1927
  else {
1932
1928
  if (Browser.isDevice) {