@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.
- 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 +75 -55
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +79 -59
- 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 +38 -18
- package/src/image-editor/action/filter.js +1 -1
- package/src/image-editor/action/selection.js +1 -0
- package/src/image-editor/action/shape.js +3 -2
- package/src/image-editor/base/image-editor.js +3 -1
- package/src/image-editor/renderer/toolbar.js +33 -37
|
@@ -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;
|
|
@@ -3033,12 +3052,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3033
3052
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3034
3053
|
var coll = actObj.rotateFlipColl[i];
|
|
3035
3054
|
if (typeof (coll) === 'number') {
|
|
3036
|
-
|
|
3037
|
-
tempDegree = coll;
|
|
3038
|
-
}
|
|
3039
|
-
else {
|
|
3040
|
-
tempDegree = coll - actObj.shapeDegree;
|
|
3041
|
-
}
|
|
3055
|
+
tempDegree = coll;
|
|
3042
3056
|
if (tempDegree === -450) {
|
|
3043
3057
|
tempDegree = -90;
|
|
3044
3058
|
}
|
|
@@ -3136,12 +3150,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3136
3150
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3137
3151
|
var coll = actObj.rotateFlipColl[i];
|
|
3138
3152
|
if (typeof (coll) === 'number') {
|
|
3139
|
-
|
|
3140
|
-
tempDegree = coll;
|
|
3141
|
-
}
|
|
3142
|
-
else {
|
|
3143
|
-
tempDegree = coll - actObj.shapeDegree;
|
|
3144
|
-
}
|
|
3153
|
+
tempDegree = coll;
|
|
3145
3154
|
if (tempDegree === -450) {
|
|
3146
3155
|
tempDegree = -90;
|
|
3147
3156
|
}
|
|
@@ -6088,10 +6097,21 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
6088
6097
|
y: sinAngle * (p2.x - center.x) + cosAngle * (p2.y - center.y) + center.y };
|
|
6089
6098
|
var newP3 = { x: cosAngle * (p3.x - center.x) - sinAngle * (p3.y - center.y) + center.x,
|
|
6090
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();
|
|
6091
6111
|
if (this.parent.activeObj.redactType === 'blur') {
|
|
6092
6112
|
offscreenCanvas.width = width;
|
|
6093
6113
|
offscreenCanvas.height = height;
|
|
6094
|
-
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);
|
|
6095
6115
|
}
|
|
6096
6116
|
else {
|
|
6097
6117
|
var pixelSize = (obj.redactPixelate / 100) * 20;
|
|
@@ -6100,7 +6120,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
6100
6120
|
}
|
|
6101
6121
|
offscreenCanvas.width = Math.ceil(width / pixelSize);
|
|
6102
6122
|
offscreenCanvas.height = Math.ceil(height / pixelSize);
|
|
6103
|
-
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);
|
|
6104
6124
|
}
|
|
6105
6125
|
}
|
|
6106
6126
|
if (this.parent.activeObj.redactType === 'blur') {
|
|
@@ -7349,7 +7369,7 @@ var Filter = /** @__PURE__ @class */ (function () {
|
|
|
7349
7369
|
Filter.prototype.parseFilterString = function (filterString) {
|
|
7350
7370
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7351
7371
|
var filterArray = [];
|
|
7352
|
-
if (filterString !== 'none') {
|
|
7372
|
+
if (filterString && filterString !== 'none') {
|
|
7353
7373
|
filterArray = filterString.split(' ').map(function (filter) {
|
|
7354
7374
|
var _a = filter.match(/([a-z-]+)\(([^)]+)\)/).slice(1, 3), name = _a[0], value = _a[1];
|
|
7355
7375
|
return { filter: name, value: value };
|
|
@@ -12068,6 +12088,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
12068
12088
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
12069
12089
|
parent.activeObj.activePoint = activePoint;
|
|
12070
12090
|
parent.isShapeDrawing = true;
|
|
12091
|
+
this.tempActiveObj = extend({}, parent.activeObj, {}, true);
|
|
12071
12092
|
return;
|
|
12072
12093
|
}
|
|
12073
12094
|
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
|
|
@@ -14721,7 +14742,8 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14721
14742
|
};
|
|
14722
14743
|
Shape.prototype.setDimension = function (width, height) {
|
|
14723
14744
|
var parent = this.parent;
|
|
14724
|
-
|
|
14745
|
+
var shape = parent.activeObj.shape;
|
|
14746
|
+
if ((width && height) || ((shape === 'line' || shape === 'arrow') && (width || height))) {
|
|
14725
14747
|
parent.activeObj.activePoint.width = width;
|
|
14726
14748
|
parent.activeObj.activePoint.height = height;
|
|
14727
14749
|
if (parent.currObjType.shape.toLowerCase() === 'ellipse') {
|
|
@@ -14769,7 +14791,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
14769
14791
|
strokeSettings.strokeWidth = 0;
|
|
14770
14792
|
}
|
|
14771
14793
|
strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
|
|
14772
|
-
strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
|
|
14794
|
+
strokeSettings.fillColor = fillColor || fillColor === '' ? fillColor : strokeSettings.fillColor;
|
|
14773
14795
|
strokeSettings.radius = radius ? radius : strokeSettings.radius;
|
|
14774
14796
|
var tempWidth = parent.img.destWidth > 100 ? 100 : parent.img.destWidth / 2;
|
|
14775
14797
|
var tempHeight = parent.img.destHeight > 100 ? 100 : parent.img.destHeight / 2;
|
|
@@ -22272,7 +22294,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22272
22294
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
22273
22295
|
var supportObj = { key: 'SupportText' };
|
|
22274
22296
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22275
|
-
|
|
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>';
|
|
22276
22300
|
}
|
|
22277
22301
|
var dialog = new Dialog({
|
|
22278
22302
|
header: headerObj['value'],
|
|
@@ -28029,7 +28053,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28029
28053
|
qualityOptionDiv.appendChild(parent.createElement('button', { id: id + '_qualitybuttonIcon', className: 'e-ie-img-icon-button', attrs: { type: 'button' } }));
|
|
28030
28054
|
qualityNameDiv.appendChild(qualityOptionDiv);
|
|
28031
28055
|
if (Browser.isDevice) {
|
|
28032
|
-
|
|
28056
|
+
dialogRightContent.appendChild(parent.createElement('span', {
|
|
28033
28057
|
id: id + '_qualitySize', className: 'e-ie-img-quality-size'
|
|
28034
28058
|
}));
|
|
28035
28059
|
}
|
|
@@ -28289,48 +28313,44 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28289
28313
|
}).bind(this), 'image/jpeg', quality);
|
|
28290
28314
|
}
|
|
28291
28315
|
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
|
|
28292
|
-
|
|
28293
|
-
|
|
28316
|
+
ctx.drawImage(tempCanvas, 0, 0);
|
|
28317
|
+
tempCanvas.toBlob((function (blob) {
|
|
28318
|
+
fileSize = Math.floor(blob.size / 1024);
|
|
28319
|
+
if (fileSize > 1000) {
|
|
28320
|
+
var megabytes = fileSize / 1024;
|
|
28321
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28322
|
+
fileSize = +megabytes.toFixed(2);
|
|
28323
|
+
}
|
|
28324
|
+
else {
|
|
28325
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
|
|
28326
|
+
fileSize = +fileSize.toFixed(2);
|
|
28327
|
+
}
|
|
28328
|
+
if (Browser.isDevice) {
|
|
28329
|
+
canvas.style.display = 'none';
|
|
28330
|
+
}
|
|
28331
|
+
this.fileSize = fileSize;
|
|
28332
|
+
}).bind(this), 'image/png', 1);
|
|
28333
|
+
}
|
|
28334
|
+
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
28335
|
+
ctx.drawImage(tempCanvas, 0, 0);
|
|
28336
|
+
var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
|
|
28337
|
+
var base64Data = svgDataUrl.split(',')[1];
|
|
28338
|
+
var binaryStringLength = base64Data.length;
|
|
28339
|
+
var rawByteSize = binaryStringLength;
|
|
28340
|
+
var fileSize_1 = Math.floor(rawByteSize / 1024); // KB
|
|
28341
|
+
if (fileSize_1 > 1000) {
|
|
28342
|
+
var megabytes = fileSize_1 / 1024; // Convert to MB
|
|
28343
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28344
|
+
fileSize_1 = +megabytes.toFixed(2);
|
|
28294
28345
|
}
|
|
28295
28346
|
else {
|
|
28296
|
-
|
|
28297
|
-
|
|
28298
|
-
fileSize = Math.floor(blob.size / 1024);
|
|
28299
|
-
if (fileSize > 1000) {
|
|
28300
|
-
var megabytes = fileSize / 1024;
|
|
28301
|
-
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28302
|
-
fileSize = +megabytes.toFixed(2);
|
|
28303
|
-
}
|
|
28304
|
-
else {
|
|
28305
|
-
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
|
|
28306
|
-
fileSize = +fileSize.toFixed(2);
|
|
28307
|
-
}
|
|
28308
|
-
this.fileSize = fileSize;
|
|
28309
|
-
}).bind(this), 'image/png', 1);
|
|
28347
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize_1.toFixed(2) + ' KB';
|
|
28348
|
+
fileSize_1 = +fileSize_1.toFixed(2);
|
|
28310
28349
|
}
|
|
28311
|
-
}
|
|
28312
|
-
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
28313
28350
|
if (Browser.isDevice) {
|
|
28314
28351
|
canvas.style.display = 'none';
|
|
28315
28352
|
}
|
|
28316
|
-
|
|
28317
|
-
ctx.drawImage(tempCanvas, 0, 0);
|
|
28318
|
-
var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
|
|
28319
|
-
var base64Data = svgDataUrl.split(',')[1];
|
|
28320
|
-
var binaryStringLength = base64Data.length;
|
|
28321
|
-
var rawByteSize = binaryStringLength;
|
|
28322
|
-
var fileSize_1 = Math.floor(rawByteSize / 1024); // KB
|
|
28323
|
-
if (fileSize_1 > 1000) {
|
|
28324
|
-
var megabytes = fileSize_1 / 1024; // Convert to MB
|
|
28325
|
-
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28326
|
-
fileSize_1 = +megabytes.toFixed(2);
|
|
28327
|
-
}
|
|
28328
|
-
else {
|
|
28329
|
-
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize_1.toFixed(2) + ' KB';
|
|
28330
|
-
fileSize_1 = +fileSize_1.toFixed(2);
|
|
28331
|
-
}
|
|
28332
|
-
}
|
|
28333
|
-
this.fileSize = fileSize;
|
|
28353
|
+
this.fileSize = fileSize_1;
|
|
28334
28354
|
}
|
|
28335
28355
|
else {
|
|
28336
28356
|
if (Browser.isDevice) {
|