@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.
- 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 +49 -13
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +49 -13
- 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 +12 -12
- package/src/image-editor/action/draw.d.ts +1 -0
- package/src/image-editor/action/draw.js +36 -6
- package/src/image-editor/action/selection.js +7 -4
- 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') {
|
|
@@ -13262,10 +13292,6 @@ class Selection {
|
|
|
13262
13292
|
}
|
|
13263
13293
|
handleScroll(e) {
|
|
13264
13294
|
this.mouseWheel++;
|
|
13265
|
-
if (this.mouseWheel === 2) {
|
|
13266
|
-
this.mouseWheel = 0;
|
|
13267
|
-
return;
|
|
13268
|
-
}
|
|
13269
13295
|
const parent = this.parent;
|
|
13270
13296
|
let x;
|
|
13271
13297
|
let y;
|
|
@@ -13282,6 +13308,13 @@ class Selection {
|
|
|
13282
13308
|
y < parent.img.destTop + parent.img.destHeight) {
|
|
13283
13309
|
isInsideCanvas = true;
|
|
13284
13310
|
}
|
|
13311
|
+
if (this.mouseWheel === 2) {
|
|
13312
|
+
this.mouseWheel = 0;
|
|
13313
|
+
if (e.ctrlKey === true && isInsideCanvas) {
|
|
13314
|
+
e.preventDefault();
|
|
13315
|
+
}
|
|
13316
|
+
return;
|
|
13317
|
+
}
|
|
13285
13318
|
e.stopPropagation();
|
|
13286
13319
|
if (e.ctrlKey === true && isInsideCanvas) {
|
|
13287
13320
|
e.preventDefault();
|
|
@@ -14649,7 +14682,8 @@ class Shape {
|
|
|
14649
14682
|
}
|
|
14650
14683
|
setDimension(width, height) {
|
|
14651
14684
|
const parent = this.parent;
|
|
14652
|
-
|
|
14685
|
+
const shape = parent.activeObj.shape;
|
|
14686
|
+
if ((width && height) || ((shape === 'line' || shape === 'arrow') && (width || height))) {
|
|
14653
14687
|
parent.activeObj.activePoint.width = width;
|
|
14654
14688
|
parent.activeObj.activePoint.height = height;
|
|
14655
14689
|
if (parent.currObjType.shape.toLowerCase() === 'ellipse') {
|
|
@@ -14697,7 +14731,7 @@ class Shape {
|
|
|
14697
14731
|
strokeSettings.strokeWidth = 0;
|
|
14698
14732
|
}
|
|
14699
14733
|
strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
|
|
14700
|
-
strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
|
|
14734
|
+
strokeSettings.fillColor = fillColor || fillColor === '' ? fillColor : strokeSettings.fillColor;
|
|
14701
14735
|
strokeSettings.radius = radius ? radius : strokeSettings.radius;
|
|
14702
14736
|
const tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
|
|
14703
14737
|
const tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
|
|
@@ -22157,7 +22191,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22157
22191
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
22158
22192
|
const supportObj = { key: 'SupportText' };
|
|
22159
22193
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22160
|
-
|
|
22194
|
+
const andObj = { key: 'And' };
|
|
22195
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22196
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, ' + andObj['value'] + ' SVG</b></span>';
|
|
22161
22197
|
}
|
|
22162
22198
|
const dialog = new Dialog({
|
|
22163
22199
|
header: headerObj['value'],
|