@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
|
@@ -2284,8 +2284,13 @@ class Draw {
|
|
|
2284
2284
|
const baseRadius = isTempCanvas ? radius * 10 * ((ratio.width + ratio.height) / 2) : radius * 10;
|
|
2285
2285
|
const adjustedRadius = baseRadius + (baseRadius * zoomFactor);
|
|
2286
2286
|
if (radius !== null) {
|
|
2287
|
-
|
|
2288
|
-
|
|
2287
|
+
if (parent.isSafari) {
|
|
2288
|
+
this.drawRoundedRect(canvasDraw, startX, startY, width, height, adjustedRadius);
|
|
2289
|
+
}
|
|
2290
|
+
else {
|
|
2291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2292
|
+
canvasDraw.roundRect(startX, startY, width, height, adjustedRadius);
|
|
2293
|
+
}
|
|
2289
2294
|
}
|
|
2290
2295
|
else {
|
|
2291
2296
|
canvasDraw.rect(startX, startY, width, height);
|
|
@@ -2295,8 +2300,13 @@ class Draw {
|
|
|
2295
2300
|
canvasDraw.fill();
|
|
2296
2301
|
}
|
|
2297
2302
|
if (radius !== null) {
|
|
2298
|
-
|
|
2299
|
-
|
|
2303
|
+
if (parent.isSafari) {
|
|
2304
|
+
this.drawRoundedRect(canvasDraw, startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
|
|
2305
|
+
}
|
|
2306
|
+
else {
|
|
2307
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2308
|
+
canvasDraw.roundRect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth), adjustedRadius);
|
|
2309
|
+
}
|
|
2300
2310
|
}
|
|
2301
2311
|
else {
|
|
2302
2312
|
canvasDraw.rect(startX + strokeWidth, startY + strokeWidth, width - (2 * strokeWidth), height - (2 * strokeWidth));
|
|
@@ -2305,6 +2315,15 @@ class Draw {
|
|
|
2305
2315
|
canvasDraw.fill('evenodd');
|
|
2306
2316
|
canvasDraw.closePath();
|
|
2307
2317
|
}
|
|
2318
|
+
drawRoundedRect(canvasDraw, startX, startY, width, height, radius) {
|
|
2319
|
+
const rectRadius = Math.max(0, Math.min(radius, width / 2, height / 2));
|
|
2320
|
+
canvasDraw.moveTo(startX + rectRadius, startY);
|
|
2321
|
+
canvasDraw.arcTo(startX + width, startY, startX + width, startY + height, rectRadius);
|
|
2322
|
+
canvasDraw.arcTo(startX + width, startY + height, startY, startY + height, rectRadius);
|
|
2323
|
+
canvasDraw.arcTo(startX, startY + height, startX, startY, rectRadius);
|
|
2324
|
+
canvasDraw.arcTo(startX, startY, startX + width, startY, rectRadius);
|
|
2325
|
+
canvasDraw.closePath();
|
|
2326
|
+
}
|
|
2308
2327
|
drawSelection(horLineWidth, verLineHeight) {
|
|
2309
2328
|
const parent = this.parent;
|
|
2310
2329
|
const actObj = parent.activeObj;
|
|
@@ -6032,10 +6051,21 @@ class Draw {
|
|
|
6032
6051
|
y: sinAngle * (p2.x - center.x) + cosAngle * (p2.y - center.y) + center.y };
|
|
6033
6052
|
const newP3 = { x: cosAngle * (p3.x - center.x) - sinAngle * (p3.y - center.y) + center.x,
|
|
6034
6053
|
y: sinAngle * (p3.x - center.x) + cosAngle * (p3.y - center.y) + center.y };
|
|
6054
|
+
const tempWidth = isSaveCtx ? canvasDraw.canvas.width : img.destWidth;
|
|
6055
|
+
const tempHeight = isSaveCtx ? canvasDraw.canvas.height : img.destHeight;
|
|
6056
|
+
const rotatedWidth = Math.abs(tempWidth * Math.cos(radians)) + Math.abs(tempHeight * Math.sin(radians));
|
|
6057
|
+
const rotatedHeight = Math.abs(tempWidth * Math.sin(radians)) + Math.abs(tempHeight * Math.cos(radians));
|
|
6058
|
+
straightenCanvas.width = rotatedWidth;
|
|
6059
|
+
straightenCanvas.height = rotatedHeight;
|
|
6060
|
+
straightenCtx.save();
|
|
6061
|
+
straightenCtx.translate(rotatedWidth / 2, rotatedHeight / 2);
|
|
6062
|
+
straightenCtx.rotate(radians);
|
|
6063
|
+
straightenCtx.drawImage(tempCanvas, -tempCanvas.width / 2, -tempCanvas.height / 2);
|
|
6064
|
+
straightenCtx.restore();
|
|
6035
6065
|
if (this.parent.activeObj.redactType === 'blur') {
|
|
6036
6066
|
offscreenCanvas.width = width;
|
|
6037
6067
|
offscreenCanvas.height = height;
|
|
6038
|
-
offscreenCtx.drawImage(straightenCanvas, newP1.x, newP1.y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, width, height);
|
|
6068
|
+
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);
|
|
6039
6069
|
}
|
|
6040
6070
|
else {
|
|
6041
6071
|
let pixelSize = (obj.redactPixelate / 100) * 20;
|
|
@@ -6044,7 +6074,7 @@ class Draw {
|
|
|
6044
6074
|
}
|
|
6045
6075
|
offscreenCanvas.width = Math.ceil(width / pixelSize);
|
|
6046
6076
|
offscreenCanvas.height = Math.ceil(height / pixelSize);
|
|
6047
|
-
offscreenCtx.drawImage(straightenCanvas, newP1.x, newP1.y, newP2.x - newP1.x, newP3.y - newP2.y, 0, 0, offscreenCanvas.width, offscreenCanvas.height);
|
|
6077
|
+
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);
|
|
6048
6078
|
}
|
|
6049
6079
|
}
|
|
6050
6080
|
if (this.parent.activeObj.redactType === 'blur') {
|
|
@@ -14649,7 +14679,8 @@ class Shape {
|
|
|
14649
14679
|
}
|
|
14650
14680
|
setDimension(width, height) {
|
|
14651
14681
|
const parent = this.parent;
|
|
14652
|
-
|
|
14682
|
+
const shape = parent.activeObj.shape;
|
|
14683
|
+
if ((width && height) || ((shape === 'line' || shape === 'arrow') && (width || height))) {
|
|
14653
14684
|
parent.activeObj.activePoint.width = width;
|
|
14654
14685
|
parent.activeObj.activePoint.height = height;
|
|
14655
14686
|
if (parent.currObjType.shape.toLowerCase() === 'ellipse') {
|
|
@@ -14697,7 +14728,7 @@ class Shape {
|
|
|
14697
14728
|
strokeSettings.strokeWidth = 0;
|
|
14698
14729
|
}
|
|
14699
14730
|
strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
|
|
14700
|
-
strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
|
|
14731
|
+
strokeSettings.fillColor = fillColor || fillColor === '' ? fillColor : strokeSettings.fillColor;
|
|
14701
14732
|
strokeSettings.radius = radius ? radius : strokeSettings.radius;
|
|
14702
14733
|
const tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
|
|
14703
14734
|
const tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
|
|
@@ -22157,7 +22188,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22157
22188
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
22158
22189
|
const supportObj = { key: 'SupportText' };
|
|
22159
22190
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22160
|
-
|
|
22191
|
+
const andObj = { key: 'And' };
|
|
22192
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22193
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, ' + andObj['value'] + ' SVG</b></span>';
|
|
22161
22194
|
}
|
|
22162
22195
|
const dialog = new Dialog({
|
|
22163
22196
|
header: headerObj['value'],
|