@syncfusion/ej2-image-editor 27.1.50 → 27.1.52
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 +68 -22
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +67 -21
- 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 +9 -9
- package/src/image-editor/action/draw.js +9 -17
- package/src/image-editor/action/filter.js +1 -1
- package/src/image-editor/action/selection.js +1 -0
- package/src/image-editor/action/undo-redo.js +10 -0
- package/src/image-editor/renderer/toolbar.js +46 -3
|
@@ -1992,7 +1992,7 @@ class Draw {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
this.drawArrowHead(canvasDraw, true);
|
|
1994
1994
|
this.drawArrowHead(canvasDraw, false);
|
|
1995
|
-
if (actObj.end === 'none') {
|
|
1995
|
+
if (actObj.end === 'none' && actObj.start !== 'circle' && actObj.start !== 'square') {
|
|
1996
1996
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
1997
1997
|
}
|
|
1998
1998
|
canvasDraw.fillStyle = tempFillStyle;
|
|
@@ -2396,9 +2396,10 @@ class Draw {
|
|
|
2396
2396
|
const isStartArrow = actObj.start === 'arrow';
|
|
2397
2397
|
const isEndArrow = actObj.end === 'arrow';
|
|
2398
2398
|
const isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
|
|
2399
|
+
const isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
|
|
2399
2400
|
if ((start && actObj.triangleDirection === 'left' || actObj.triangleDirection === 'right') &&
|
|
2400
|
-
((isStartArrow && actObj.end === 'none') || (isStartArrow && !isEndCircleOrSquare)) ||
|
|
2401
|
-
(!start && (isEndArrow && actObj.start === 'none' || !isStartArrow && !isEndCircleOrSquare))) {
|
|
2401
|
+
((isStartArrow && actObj.end === 'none') || (isStartArrow && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
|
|
2402
|
+
(!start && (isEndArrow && actObj.start === 'none' || !isStartArrow && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
|
|
2402
2403
|
this.shapeLine(canvasDraw, startX, startY, endX, endY);
|
|
2403
2404
|
}
|
|
2404
2405
|
if ((start && actObj.triangleDirection === 'left') || (!start && actObj.triangleDirection === 'right')) {
|
|
@@ -2433,9 +2434,10 @@ class Draw {
|
|
|
2433
2434
|
const angle = Math.atan2(this.dy, this.dx);
|
|
2434
2435
|
const isStartArrowSolid = actObj.start === 'arrowSolid';
|
|
2435
2436
|
const isEndArrowSolid = actObj.end === 'arrowSolid';
|
|
2437
|
+
const isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
|
|
2436
2438
|
const isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
|
|
2437
|
-
if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare)) ||
|
|
2438
|
-
(!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare))) {
|
|
2439
|
+
if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
|
|
2440
|
+
(!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
|
|
2439
2441
|
this.shapeLine(canvasDraw, startX, startY, endX, endY);
|
|
2440
2442
|
}
|
|
2441
2443
|
if ((start && actObj.triangleDirection === 'left') || (!start && actObj.triangleDirection === 'right')) {
|
|
@@ -3002,12 +3004,7 @@ class Draw {
|
|
|
3002
3004
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3003
3005
|
let coll = actObj.rotateFlipColl[i];
|
|
3004
3006
|
if (typeof (coll) === 'number') {
|
|
3005
|
-
|
|
3006
|
-
tempDegree = coll;
|
|
3007
|
-
}
|
|
3008
|
-
else {
|
|
3009
|
-
tempDegree = coll - actObj.shapeDegree;
|
|
3010
|
-
}
|
|
3007
|
+
tempDegree = coll;
|
|
3011
3008
|
if (tempDegree === -450) {
|
|
3012
3009
|
tempDegree = -90;
|
|
3013
3010
|
}
|
|
@@ -3105,12 +3102,7 @@ class Draw {
|
|
|
3105
3102
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3106
3103
|
let coll = actObj.rotateFlipColl[i];
|
|
3107
3104
|
if (typeof (coll) === 'number') {
|
|
3108
|
-
|
|
3109
|
-
tempDegree = coll;
|
|
3110
|
-
}
|
|
3111
|
-
else {
|
|
3112
|
-
tempDegree = coll - actObj.shapeDegree;
|
|
3113
|
-
}
|
|
3105
|
+
tempDegree = coll;
|
|
3114
3106
|
if (tempDegree === -450) {
|
|
3115
3107
|
tempDegree = -90;
|
|
3116
3108
|
}
|
|
@@ -7298,7 +7290,7 @@ class Filter {
|
|
|
7298
7290
|
parseFilterString(filterString) {
|
|
7299
7291
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7300
7292
|
let filterArray = [];
|
|
7301
|
-
if (filterString !== 'none') {
|
|
7293
|
+
if (filterString && filterString !== 'none') {
|
|
7302
7294
|
filterArray = filterString.split(' ').map((filter) => {
|
|
7303
7295
|
const [name, value] = filter.match(/([a-z-]+)\(([^)]+)\)/).slice(1, 3);
|
|
7304
7296
|
return { filter: name, value: value };
|
|
@@ -12004,6 +11996,7 @@ class Selection {
|
|
|
12004
11996
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
12005
11997
|
parent.activeObj.activePoint = activePoint;
|
|
12006
11998
|
parent.isShapeDrawing = true;
|
|
11999
|
+
this.tempActiveObj = extend({}, parent.activeObj, {}, true);
|
|
12007
12000
|
return;
|
|
12008
12001
|
}
|
|
12009
12002
|
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
|
|
@@ -21493,13 +21486,23 @@ class UndoRedo {
|
|
|
21493
21486
|
updateObjColl() {
|
|
21494
21487
|
const parent = this.parent;
|
|
21495
21488
|
for (let i = 0; i < parent.objColl.length; i++) {
|
|
21496
|
-
|
|
21489
|
+
let obj = parent.objColl[i];
|
|
21490
|
+
let isUpdated = false;
|
|
21497
21491
|
if (obj.shape === 'line' || obj.shape === 'arrow') {
|
|
21498
21492
|
if (obj.activePoint.width < 0) {
|
|
21499
21493
|
obj.activePoint.width = Math.abs(obj.activePoint.width);
|
|
21494
|
+
isUpdated = true;
|
|
21500
21495
|
}
|
|
21501
21496
|
if (obj.activePoint.height < 0) {
|
|
21502
21497
|
obj.activePoint.height = Math.abs(obj.activePoint.height);
|
|
21498
|
+
isUpdated = true;
|
|
21499
|
+
}
|
|
21500
|
+
if (isUpdated) {
|
|
21501
|
+
const activeObj = extend({}, parent.activeObj, {}, true);
|
|
21502
|
+
parent.activeObj = obj;
|
|
21503
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
21504
|
+
obj = parent.activeObj;
|
|
21505
|
+
parent.activeObj = activeObj;
|
|
21503
21506
|
}
|
|
21504
21507
|
}
|
|
21505
21508
|
}
|
|
@@ -27668,6 +27671,9 @@ class ToolbarModule {
|
|
|
27668
27671
|
zOrderElement.classList.remove('e-overlay');
|
|
27669
27672
|
}
|
|
27670
27673
|
}
|
|
27674
|
+
if (zOrderElement && (parent.shapeColl.length === 0 || (obj['freehandDrawSelectedId'] && parent.shapeColl.length === 1))) {
|
|
27675
|
+
zOrderElement.classList.add('e-overlay');
|
|
27676
|
+
}
|
|
27671
27677
|
}
|
|
27672
27678
|
renderStraightenSlider() {
|
|
27673
27679
|
const parent = this.parent;
|
|
@@ -27897,7 +27903,7 @@ class ToolbarModule {
|
|
|
27897
27903
|
qualityOptionDiv.appendChild(parent.createElement('button', { id: id + '_qualitybuttonIcon', className: 'e-ie-img-icon-button', attrs: { type: 'button' } }));
|
|
27898
27904
|
qualityNameDiv.appendChild(qualityOptionDiv);
|
|
27899
27905
|
if (Browser.isDevice) {
|
|
27900
|
-
|
|
27906
|
+
dialogRightContent.appendChild(parent.createElement('span', {
|
|
27901
27907
|
id: id + '_qualitySize', className: 'e-ie-img-quality-size'
|
|
27902
27908
|
}));
|
|
27903
27909
|
}
|
|
@@ -28132,11 +28138,11 @@ class ToolbarModule {
|
|
|
28132
28138
|
fileSize = Math.floor(blob.size / 1024);
|
|
28133
28139
|
if (fileSize > 1000) {
|
|
28134
28140
|
const megabytes = fileSize / 1024;
|
|
28135
|
-
imageNameLabel.innerHTML = '
|
|
28141
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28136
28142
|
fileSize = +megabytes.toFixed(2);
|
|
28137
28143
|
}
|
|
28138
28144
|
else {
|
|
28139
|
-
imageNameLabel.innerHTML = '
|
|
28145
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
|
|
28140
28146
|
fileSize = +fileSize.toFixed(2);
|
|
28141
28147
|
}
|
|
28142
28148
|
if (Browser.isDevice) {
|
|
@@ -28154,6 +28160,46 @@ class ToolbarModule {
|
|
|
28154
28160
|
this.fileSize = fileSize;
|
|
28155
28161
|
}).bind(this), 'image/jpeg', quality);
|
|
28156
28162
|
}
|
|
28163
|
+
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
|
|
28164
|
+
ctx.drawImage(tempCanvas, 0, 0);
|
|
28165
|
+
tempCanvas.toBlob((function (blob) {
|
|
28166
|
+
fileSize = Math.floor(blob.size / 1024);
|
|
28167
|
+
if (fileSize > 1000) {
|
|
28168
|
+
const megabytes = fileSize / 1024;
|
|
28169
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28170
|
+
fileSize = +megabytes.toFixed(2);
|
|
28171
|
+
}
|
|
28172
|
+
else {
|
|
28173
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
|
|
28174
|
+
fileSize = +fileSize.toFixed(2);
|
|
28175
|
+
}
|
|
28176
|
+
if (Browser.isDevice) {
|
|
28177
|
+
canvas.style.display = 'none';
|
|
28178
|
+
}
|
|
28179
|
+
this.fileSize = fileSize;
|
|
28180
|
+
}).bind(this), 'image/png', 1);
|
|
28181
|
+
}
|
|
28182
|
+
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
28183
|
+
ctx.drawImage(tempCanvas, 0, 0);
|
|
28184
|
+
const svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
|
|
28185
|
+
const base64Data = svgDataUrl.split(',')[1];
|
|
28186
|
+
const binaryStringLength = base64Data.length;
|
|
28187
|
+
const rawByteSize = binaryStringLength;
|
|
28188
|
+
let fileSize = Math.floor(rawByteSize / 1024); // KB
|
|
28189
|
+
if (fileSize > 1000) {
|
|
28190
|
+
const megabytes = fileSize / 1024; // Convert to MB
|
|
28191
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
|
|
28192
|
+
fileSize = +megabytes.toFixed(2);
|
|
28193
|
+
}
|
|
28194
|
+
else {
|
|
28195
|
+
imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
|
|
28196
|
+
fileSize = +fileSize.toFixed(2);
|
|
28197
|
+
}
|
|
28198
|
+
if (Browser.isDevice) {
|
|
28199
|
+
canvas.style.display = 'none';
|
|
28200
|
+
}
|
|
28201
|
+
this.fileSize = fileSize;
|
|
28202
|
+
}
|
|
28157
28203
|
else {
|
|
28158
28204
|
if (Browser.isDevice) {
|
|
28159
28205
|
canvas.style.display = 'none';
|