@syncfusion/ej2-image-editor 27.1.52 → 27.1.57

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.
@@ -2313,8 +2313,13 @@ var Draw = /** @__PURE__ @class */ (function () {
2313
2313
  var baseRadius = isTempCanvas ? radius * 10 * ((ratio.width + ratio.height) / 2) : radius * 10;
2314
2314
  var adjustedRadius = baseRadius + (baseRadius * zoomFactor);
2315
2315
  if (radius !== null) {
2316
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2317
- canvasDraw.roundRect(startX, startY, width, height, adjustedRadius);
2316
+ if (parent.isSafari) {
2317
+ this.drawRoundedRect(canvasDraw, startX, startY, width, height, adjustedRadius);
2318
+ }
2319
+ else {
2320
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2321
+ canvasDraw.roundRect(startX, startY, width, height, adjustedRadius);
2322
+ }
2318
2323
  }
2319
2324
  else {
2320
2325
  canvasDraw.rect(startX, startY, width, height);
@@ -2324,8 +2329,13 @@ var Draw = /** @__PURE__ @class */ (function () {
2324
2329
  canvasDraw.fill();
2325
2330
  }
2326
2331
  if (radius !== null) {
2327
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2328
- canvasDraw.roundRect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
2332
+ if (parent.isSafari) {
2333
+ this.drawRoundedRect(canvasDraw, startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
2334
+ }
2335
+ else {
2336
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2337
+ canvasDraw.roundRect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
2338
+ }
2329
2339
  }
2330
2340
  else {
2331
2341
  canvasDraw.rect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth));
@@ -2334,6 +2344,15 @@ var Draw = /** @__PURE__ @class */ (function () {
2334
2344
  canvasDraw.fill('evenodd');
2335
2345
  canvasDraw.closePath();
2336
2346
  };
2347
+ Draw.prototype.drawRoundedRect = function (canvasDraw, startX, startY, width, height, radius) {
2348
+ var rectRadius = Math.max(0, Math.min(radius, width / 2, height / 2));
2349
+ canvasDraw.moveTo(startX + rectRadius, startY);
2350
+ canvasDraw.arcTo(startX + width, startY, startX + width, startY + height, rectRadius);
2351
+ canvasDraw.arcTo(startX + width, startY + height, startY, startY + height, rectRadius);
2352
+ canvasDraw.arcTo(startX, startY + height, startX, startY, rectRadius);
2353
+ canvasDraw.arcTo(startX, startY, startX + width, startY, rectRadius);
2354
+ canvasDraw.closePath();
2355
+ };
2337
2356
  Draw.prototype.drawSelection = function (horLineWidth, verLineHeight) {
2338
2357
  var parent = this.parent;
2339
2358
  var actObj = parent.activeObj;
@@ -6078,10 +6097,21 @@ var Draw = /** @__PURE__ @class */ (function () {
6078
6097
  y: sinAngle * (p2.x - center.x) + cosAngle * (p2.y - center.y) + center.y };
6079
6098
  var newP3 = { x: cosAngle * (p3.x - center.x) - sinAngle * (p3.y - center.y) + center.x,
6080
6099
  y: sinAngle * (p3.x - center.x) + cosAngle * (p3.y - center.y) + center.y };
6100
+ var tempWidth = isSaveCtx ? canvasDraw.canvas.width : img.destWidth;
6101
+ var tempHeight = isSaveCtx ? canvasDraw.canvas.height : img.destHeight;
6102
+ var rotatedWidth = Math.abs(tempWidth * Math.cos(radians)) + Math.abs(tempHeight * Math.sin(radians));
6103
+ var rotatedHeight = Math.abs(tempWidth * Math.sin(radians)) + Math.abs(tempHeight * Math.cos(radians));
6104
+ straightenCanvas.width = rotatedWidth;
6105
+ straightenCanvas.height = rotatedHeight;
6106
+ straightenCtx.save();
6107
+ straightenCtx.translate(rotatedWidth / 2, rotatedHeight / 2);
6108
+ straightenCtx.rotate(radians);
6109
+ straightenCtx.drawImage(tempCanvas, -tempCanvas.width / 2, -tempCanvas.height / 2);
6110
+ straightenCtx.restore();
6081
6111
  if (this.parent.activeObj.redactType === 'blur') {
6082
6112
  offscreenCanvas.width = width;
6083
6113
  offscreenCanvas.height = height;
6084
- offscreenCtx.drawImage(straightenCanvas, newP1.x, newP1.y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, width, height);
6114
+ 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);
6085
6115
  }
6086
6116
  else {
6087
6117
  var pixelSize = (obj.redactPixelate / 100) * 20;
@@ -6090,7 +6120,7 @@ var Draw = /** @__PURE__ @class */ (function () {
6090
6120
  }
6091
6121
  offscreenCanvas.width = Math.ceil(width / pixelSize);
6092
6122
  offscreenCanvas.height = Math.ceil(height / pixelSize);
6093
- offscreenCtx.drawImage(straightenCanvas, newP1.x, newP1.y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, offscreenCanvas.width, offscreenCanvas.height);
6123
+ 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);
6094
6124
  }
6095
6125
  }
6096
6126
  if (this.parent.activeObj.redactType === 'blur') {
@@ -13324,10 +13354,6 @@ var Selection = /** @__PURE__ @class */ (function () {
13324
13354
  };
13325
13355
  Selection.prototype.handleScroll = function (e) {
13326
13356
  this.mouseWheel++;
13327
- if (this.mouseWheel === 2) {
13328
- this.mouseWheel = 0;
13329
- return;
13330
- }
13331
13357
  var parent = this.parent;
13332
13358
  var x;
13333
13359
  var y;
@@ -13344,6 +13370,13 @@ var Selection = /** @__PURE__ @class */ (function () {
13344
13370
  y < parent.img.destTop + parent.img.destHeight) {
13345
13371
  isInsideCanvas = true;
13346
13372
  }
13373
+ if (this.mouseWheel === 2) {
13374
+ this.mouseWheel = 0;
13375
+ if (e.ctrlKey === true && isInsideCanvas) {
13376
+ e.preventDefault();
13377
+ }
13378
+ return;
13379
+ }
13347
13380
  e.stopPropagation();
13348
13381
  if (e.ctrlKey === true && isInsideCanvas) {
13349
13382
  e.preventDefault();
@@ -14712,7 +14745,8 @@ var Shape = /** @__PURE__ @class */ (function () {
14712
14745
  };
14713
14746
  Shape.prototype.setDimension = function (width, height) {
14714
14747
  var parent = this.parent;
14715
- if (width && height) {
14748
+ var shape = parent.activeObj.shape;
14749
+ if ((width && height) || ((shape === 'line' || shape === 'arrow') && (width || height))) {
14716
14750
  parent.activeObj.activePoint.width = width;
14717
14751
  parent.activeObj.activePoint.height = height;
14718
14752
  if (parent.currObjType.shape.toLowerCase() === 'ellipse') {
@@ -14760,7 +14794,7 @@ var Shape = /** @__PURE__ @class */ (function () {
14760
14794
  strokeSettings.strokeWidth = 0;
14761
14795
  }
14762
14796
  strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
14763
- strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
14797
+ strokeSettings.fillColor = fillColor || fillColor === '' ? fillColor : strokeSettings.fillColor;
14764
14798
  strokeSettings.radius = radius ? radius : strokeSettings.radius;
14765
14799
  var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
14766
14800
  var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
@@ -22263,7 +22297,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22263
22297
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
22264
22298
  var supportObj = { key: 'SupportText' };
22265
22299
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
22266
- content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, and SVG</b></span>';
22300
+ var andObj = { key: 'And' };
22301
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
22302
+ content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, ' + andObj['value'] + ' SVG</b></span>';
22267
22303
  }
22268
22304
  var dialog = new Dialog({
22269
22305
  header: headerObj['value'],