@syncfusion/ej2-image-editor 27.1.52 → 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.
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +42 -9
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +42 -9
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/image-editor/action/draw.d.ts +1 -0
- package/src/image-editor/action/draw.js +36 -6
- package/src/image-editor/action/shape.js +3 -2
- package/src/image-editor/base/image-editor.js +3 -1
|
@@ -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
|
-
|
|
2317
|
-
|
|
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
|
-
|
|
2328
|
-
|
|
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') {
|
|
@@ -14712,7 +14742,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14712
14742
|
};
|
|
14713
14743
|
Shape.prototype.setDimension = function (width, height) {
|
|
14714
14744
|
var parent = this.parent;
|
|
14715
|
-
|
|
14745
|
+
var shape = parent.activeObj.shape;
|
|
14746
|
+
if ((width && height) || ((shape === 'line' || shape === 'arrow') && (width || height))) {
|
|
14716
14747
|
parent.activeObj.activePoint.width = width;
|
|
14717
14748
|
parent.activeObj.activePoint.height = height;
|
|
14718
14749
|
if (parent.currObjType.shape.toLowerCase() === 'ellipse') {
|
|
@@ -14760,7 +14791,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14760
14791
|
strokeSettings.strokeWidth = 0;
|
|
14761
14792
|
}
|
|
14762
14793
|
strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
|
|
14763
|
-
strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
|
|
14794
|
+
strokeSettings.fillColor = fillColor || fillColor === '' ? fillColor : strokeSettings.fillColor;
|
|
14764
14795
|
strokeSettings.radius = radius ? radius : strokeSettings.radius;
|
|
14765
14796
|
var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
|
|
14766
14797
|
var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
|
|
@@ -22263,7 +22294,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22263
22294
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
22264
22295
|
var supportObj = { key: 'SupportText' };
|
|
22265
22296
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22266
|
-
|
|
22297
|
+
var andObj = { key: 'And' };
|
|
22298
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22299
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, ' + andObj['value'] + ' SVG</b></span>';
|
|
22267
22300
|
}
|
|
22268
22301
|
var dialog = new Dialog({
|
|
22269
22302
|
header: headerObj['value'],
|