@syncfusion/ej2-image-editor 22.1.34 → 22.1.36
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/CHANGELOG.md +8 -0
- 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 +1004 -1059
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1002 -1061
- 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 +8 -8
- package/src/image-editor/action/crop.d.ts +1 -0
- package/src/image-editor/action/crop.js +12 -1
- package/src/image-editor/action/draw.d.ts +4 -1
- package/src/image-editor/action/draw.js +137 -127
- package/src/image-editor/action/filter.js +1 -1
- package/src/image-editor/action/freehand-draw.js +9 -9
- package/src/image-editor/action/selection.d.ts +0 -1
- package/src/image-editor/action/selection.js +55 -226
- package/src/image-editor/action/shape.d.ts +1 -0
- package/src/image-editor/action/shape.js +97 -9
- package/src/image-editor/action/transform.js +211 -22
- package/src/image-editor/action/undo-redo.js +5 -5
- package/src/image-editor/base/image-editor-model.d.ts +2 -2
- package/src/image-editor/base/image-editor.d.ts +0 -15
- package/src/image-editor/base/image-editor.js +34 -222
- package/src/image-editor/base/interface.d.ts +11 -3
- package/src/image-editor/renderer/toolbar.js +362 -363
- package/styles/highcontrast-light.css +2 -2
- package/styles/highcontrast.css +6 -1
- package/styles/image-editor/_highcontrast-definition.scss +1 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +1 -1
- package/styles/image-editor/_theme.scss +2 -4
- package/styles/image-editor/highcontrast-light.css +2 -2
- package/styles/image-editor/highcontrast.css +6 -1
|
@@ -309,7 +309,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
309
309
|
break;
|
|
310
310
|
case 'theme':
|
|
311
311
|
if (newProperties.theme) {
|
|
312
|
-
if (
|
|
312
|
+
if (this.theme && this.theme !== '') {
|
|
313
313
|
this.theme = this.toPascalCase(this.theme);
|
|
314
314
|
}
|
|
315
315
|
else {
|
|
@@ -371,7 +371,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
371
371
|
case 'selectionSettings':
|
|
372
372
|
if (newProperties.selectionSettings) {
|
|
373
373
|
this.selectionSettings = newProperties.selectionSettings;
|
|
374
|
-
if (
|
|
374
|
+
if (this.activeObj.shape) {
|
|
375
375
|
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
376
376
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
377
377
|
}
|
|
@@ -391,9 +391,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
391
391
|
this.element.removeAttribute('class');
|
|
392
392
|
}
|
|
393
393
|
if (!isBlazor()) {
|
|
394
|
-
this.notify('toolbar', {
|
|
395
|
-
prop: 'destroySubComponents', onPropertyChange: false
|
|
396
|
-
});
|
|
394
|
+
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
397
395
|
this.notify('destroyed', null);
|
|
398
396
|
_super.prototype.destroy.call(this);
|
|
399
397
|
}
|
|
@@ -404,7 +402,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
404
402
|
this.element.innerHTML = '';
|
|
405
403
|
};
|
|
406
404
|
ImageEditor.prototype.initialize = function () {
|
|
407
|
-
if (
|
|
405
|
+
if (this.toolbarTemplate) {
|
|
408
406
|
this.element.appendChild(this.createElement('div', {
|
|
409
407
|
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
410
408
|
}));
|
|
@@ -423,13 +421,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
423
421
|
var quickAccessToolbar = document.getElementById(this.element.id + '_quickAccessToolbarArea');
|
|
424
422
|
quickAccessToolbar.style.position = 'absolute';
|
|
425
423
|
quickAccessToolbar.style.display = 'none';
|
|
426
|
-
if (
|
|
424
|
+
if (this.activeObj) {
|
|
427
425
|
quickAccessToolbar.style.left = this.activeObj.activePoint.startX + 'px';
|
|
428
426
|
quickAccessToolbar.style.top = this.activeObj.activePoint.startY + 'px';
|
|
429
427
|
}
|
|
430
428
|
quickAccessToolbar.style.width = '100%';
|
|
431
429
|
}
|
|
432
|
-
if (
|
|
430
|
+
if (this.quickAccessToolbarTemplate) {
|
|
433
431
|
this.quickAccessToolbarTemplateFn();
|
|
434
432
|
}
|
|
435
433
|
else {
|
|
@@ -585,7 +583,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
585
583
|
this.notify('selection', { prop: 'handleScroll', onPropertyChange: false, value: { e: e } });
|
|
586
584
|
};
|
|
587
585
|
ImageEditor.prototype.adjustToScreen = function () {
|
|
588
|
-
this.
|
|
586
|
+
this.update();
|
|
589
587
|
};
|
|
590
588
|
ImageEditor.prototype.screenOrientation = function () {
|
|
591
589
|
if (Browser.isDevice) {
|
|
@@ -742,10 +740,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
742
740
|
this.currentFilter = '';
|
|
743
741
|
var obj_1 = { initialZoomValue: false };
|
|
744
742
|
this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
|
|
745
|
-
if (
|
|
743
|
+
if (obj_1['initialZoomValue']) {
|
|
746
744
|
this.setProperties({ zoomSettings: { zoomFactor: obj_1['initialZoomValue'] } }, true);
|
|
747
745
|
}
|
|
748
|
-
if (
|
|
746
|
+
if (document.getElementById(this.element.id + '_quickAccessToolbarArea')) {
|
|
749
747
|
document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
750
748
|
}
|
|
751
749
|
this.notifyResetForAllModules();
|
|
@@ -754,7 +752,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
754
752
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
755
753
|
this.isImageLoaded = true;
|
|
756
754
|
if (!isBlazor()) {
|
|
757
|
-
if (
|
|
755
|
+
if (this.element.querySelector('.e-contextual-toolbar-wrapper')) {
|
|
758
756
|
this.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
|
|
759
757
|
}
|
|
760
758
|
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
@@ -890,7 +888,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
890
888
|
ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
891
889
|
var isEllipse = false;
|
|
892
890
|
var isPointsInRange = this.allowShape(x, y);
|
|
893
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
891
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
894
892
|
isEllipse = true;
|
|
895
893
|
this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
|
|
896
894
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -911,7 +909,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
911
909
|
ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
912
910
|
var isLine = false;
|
|
913
911
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
914
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
912
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
915
913
|
isLine = true;
|
|
916
914
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
917
915
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -929,14 +927,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
929
927
|
* @param {string} strokeColor - Specifies the stroke color of arrow.
|
|
930
928
|
* @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
|
|
931
929
|
* @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
|
|
932
|
-
|
|
933
930
|
* @returns {boolean}.
|
|
934
|
-
* @private
|
|
935
931
|
*/
|
|
936
932
|
ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
937
933
|
var isArrow = false;
|
|
938
934
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
939
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
935
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
940
936
|
isArrow = true;
|
|
941
937
|
this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
942
938
|
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd } });
|
|
@@ -955,7 +951,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
955
951
|
this.isPublicMethod = true;
|
|
956
952
|
var obj = { inRange: false };
|
|
957
953
|
var isPath = false;
|
|
958
|
-
if (pointColl.length > 0) {
|
|
954
|
+
if (pointColl && pointColl.length > 0) {
|
|
959
955
|
for (var i = 0; i < pointColl.length; i++) {
|
|
960
956
|
if (obj['inRange']) {
|
|
961
957
|
break;
|
|
@@ -964,7 +960,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
964
960
|
value: { x: pointColl[i].x, y: pointColl[i].y, obj: obj } });
|
|
965
961
|
}
|
|
966
962
|
}
|
|
967
|
-
if (!this.disabled && this.isImageLoaded && obj['inRange']) {
|
|
963
|
+
if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
|
|
968
964
|
isPath = true;
|
|
969
965
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
970
966
|
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
@@ -986,7 +982,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
986
982
|
ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
987
983
|
var isRectangle = false;
|
|
988
984
|
var isPointsInRange = this.allowShape(x, y);
|
|
989
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
985
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
990
986
|
isRectangle = true;
|
|
991
987
|
this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
992
988
|
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor } });
|
|
@@ -1012,7 +1008,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1012
1008
|
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
1013
1009
|
var isText = false;
|
|
1014
1010
|
var isPointsInRange = this.allowShape(x, y);
|
|
1015
|
-
if (!this.disabled && this.isImageLoaded && isPointsInRange) {
|
|
1011
|
+
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1016
1012
|
isText = true;
|
|
1017
1013
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
1018
1014
|
fontSize: fontSize, bold: bold, italic: italic, color: color } });
|
|
@@ -1164,6 +1160,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1164
1160
|
template = this.toolbarFn({ type: 'toolbar' }, this, 'Template', templateID)[0];
|
|
1165
1161
|
}
|
|
1166
1162
|
toolbarArea.appendChild(template);
|
|
1163
|
+
this.toolbarHeight = toolbarArea.clientHeight;
|
|
1164
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
1167
1165
|
this['renderReactTemplates']();
|
|
1168
1166
|
}
|
|
1169
1167
|
};
|
|
@@ -1231,7 +1229,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1231
1229
|
var isUndoRedo = this.isUndoRedo;
|
|
1232
1230
|
this.isCropTab = false;
|
|
1233
1231
|
this.isUndoRedo = true;
|
|
1234
|
-
if (
|
|
1232
|
+
if (this.transform.cropZoomFactor && this.transform.cropZoomFactor > 0) {
|
|
1235
1233
|
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1236
1234
|
value: { zoomFactor: -this.transform.cropZoomFactor, zoomPoint: null } });
|
|
1237
1235
|
}
|
|
@@ -1248,120 +1246,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1248
1246
|
this.isCropTab = true;
|
|
1249
1247
|
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
1250
1248
|
};
|
|
1251
|
-
ImageEditor.prototype.moveToSelectionRange = function (type, activeObj) {
|
|
1252
|
-
if (!isNullOrUndefined(this.activeObj.shape)) {
|
|
1253
|
-
if (type === 'rotateleft' || type === 'rotateright') {
|
|
1254
|
-
var zoomFactor = this.transform.zoomFactor;
|
|
1255
|
-
this.objColl.push(this.activeObj);
|
|
1256
|
-
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1257
|
-
if (this.transform.degree % 90 === 0 && this.transform.degree % 180 !== 0) {
|
|
1258
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
1259
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
1260
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
1261
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
1262
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
1263
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
1264
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1265
|
-
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
1266
|
-
}
|
|
1267
|
-
break;
|
|
1268
|
-
}
|
|
1269
|
-
zoomFactor += .1;
|
|
1270
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1271
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
else {
|
|
1275
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
1276
|
-
if (this.objColl[this.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
1277
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
1278
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
1279
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
1280
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1281
|
-
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
1282
|
-
}
|
|
1283
|
-
break;
|
|
1284
|
-
}
|
|
1285
|
-
zoomFactor -= .1;
|
|
1286
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1287
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
else {
|
|
1292
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
1293
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
1294
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
1295
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
1296
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
1297
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
1298
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1299
|
-
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
1300
|
-
}
|
|
1301
|
-
break;
|
|
1302
|
-
}
|
|
1303
|
-
zoomFactor += .1;
|
|
1304
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1305
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
else {
|
|
1309
|
-
for (var i = 2; i < this.zoomSettings.maxZoomFactor; i++) {
|
|
1310
|
-
if (this.objColl[this.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
1311
|
-
this.isSelectionBiggerThanCanvas(this.objColl[this.objColl.length - 1]) ||
|
|
1312
|
-
this.isSelectionOutsideCanvas(this.objColl[this.objColl.length - 1])) {
|
|
1313
|
-
if (!isNullOrUndefined(zoomFactor)) {
|
|
1314
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1315
|
-
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
1316
|
-
}
|
|
1317
|
-
break;
|
|
1318
|
-
}
|
|
1319
|
-
zoomFactor -= .1;
|
|
1320
|
-
this.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
1321
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
var panX = (this.lowerCanvas.clientWidth / 2) - (this.objColl[this.objColl.length - 1].activePoint.startX +
|
|
1326
|
-
(this.objColl[this.objColl.length - 1].activePoint.width / 2));
|
|
1327
|
-
var panY = (this.lowerCanvas.clientHeight / 2) - (this.objColl[this.objColl.length - 1].activePoint.startY +
|
|
1328
|
-
(this.objColl[this.objColl.length - 1].activePoint.height / 2));
|
|
1329
|
-
if (this.transform.degree === 0) {
|
|
1330
|
-
this.img.destLeft += panX;
|
|
1331
|
-
this.img.destTop += panY;
|
|
1332
|
-
this.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
1333
|
-
}
|
|
1334
|
-
else {
|
|
1335
|
-
this.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
1336
|
-
this.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
1337
|
-
this.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
1338
|
-
}
|
|
1339
|
-
this.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
1340
|
-
value: { point: null } });
|
|
1341
|
-
this.activeObj = extend({}, this.objColl[this.objColl.length - 1]);
|
|
1342
|
-
this.objColl.pop();
|
|
1343
|
-
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: this.activeObj } });
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
};
|
|
1347
|
-
ImageEditor.prototype.isSelectionBiggerThanCanvas = function (obj) {
|
|
1348
|
-
var isBigger = false;
|
|
1349
|
-
if (obj.activePoint.startX <= this.img.destLeft ||
|
|
1350
|
-
obj.activePoint.startY <= this.img.destTop ||
|
|
1351
|
-
obj.activePoint.endX >= this.img.destLeft + this.img.destWidth ||
|
|
1352
|
-
obj.activePoint.endY >= this.img.destTop + this.img.destHeight) {
|
|
1353
|
-
isBigger = true;
|
|
1354
|
-
}
|
|
1355
|
-
return isBigger;
|
|
1356
|
-
};
|
|
1357
|
-
ImageEditor.prototype.isSelectionOutsideCanvas = function (obj) {
|
|
1358
|
-
var isOutside = false;
|
|
1359
|
-
if ((obj.activePoint.height < this.lowerCanvas.height - this.toolbarHeight) ||
|
|
1360
|
-
(obj.activePoint.width < this.lowerCanvas.width)) {
|
|
1361
|
-
isOutside = true;
|
|
1362
|
-
}
|
|
1363
|
-
return isOutside;
|
|
1364
|
-
};
|
|
1365
1249
|
/**
|
|
1366
1250
|
* Set the old item Transform item state.
|
|
1367
1251
|
*
|
|
@@ -1405,7 +1289,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1405
1289
|
for (var i = 0; i < strArr.length; i++) {
|
|
1406
1290
|
strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1);
|
|
1407
1291
|
}
|
|
1408
|
-
if (
|
|
1292
|
+
if (obj) {
|
|
1409
1293
|
obj['maxText'] = strArr.join('');
|
|
1410
1294
|
}
|
|
1411
1295
|
return strArr.join('');
|
|
@@ -1472,7 +1356,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1472
1356
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1473
1357
|
}
|
|
1474
1358
|
}
|
|
1475
|
-
else if ((!isBlazor() &&
|
|
1359
|
+
else if ((!isBlazor() && document.querySelector('#' + this.element.id + '_sliderWrapper')) || (isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
1476
1360
|
this.currObjType.isFiltered) {
|
|
1477
1361
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
1478
1362
|
this.currObjType.isFiltered = false;
|
|
@@ -1534,7 +1418,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1534
1418
|
* @returns {void}.
|
|
1535
1419
|
*/
|
|
1536
1420
|
ImageEditor.prototype.cropSelectedState = function () {
|
|
1537
|
-
if (
|
|
1421
|
+
if (this.activeObj.shape && this.activeObj.shape.split('-')[0] === 'crop') {
|
|
1538
1422
|
this.okBtn();
|
|
1539
1423
|
}
|
|
1540
1424
|
};
|
|
@@ -1549,7 +1433,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1549
1433
|
var tempFilter = this.lowerContext.filter;
|
|
1550
1434
|
this.lowerContext.filter = this.canvasFilter = 'none';
|
|
1551
1435
|
var objColl = extend([], this.objColl, null, true);
|
|
1436
|
+
var pointColl = extend([], this.pointColl, null, true);
|
|
1552
1437
|
this.objColl = [];
|
|
1438
|
+
this.pointColl = [];
|
|
1439
|
+
this.freehandCounter = 0;
|
|
1553
1440
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
1554
1441
|
var data = this.getImageData();
|
|
1555
1442
|
if (!isBlazor()) {
|
|
@@ -1558,6 +1445,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1558
1445
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
1559
1446
|
}
|
|
1560
1447
|
this.objColl = objColl;
|
|
1448
|
+
this.pointColl = pointColl;
|
|
1449
|
+
this.freehandCounter = pointColl.length;
|
|
1561
1450
|
this.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
1562
1451
|
this.lowerContext.filter = this.canvasFilter = tempFilter;
|
|
1563
1452
|
return data;
|
|
@@ -1574,7 +1463,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1574
1463
|
var _this = this;
|
|
1575
1464
|
var finetuneValueChanging = { finetune: this.getFinetuneOption(type),
|
|
1576
1465
|
value: value, cancel: false };
|
|
1577
|
-
if (isBlazor() &&
|
|
1466
|
+
if (isBlazor() && this.events && this.events.finetuneValueChanging.hasDelegate === true) {
|
|
1578
1467
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1579
1468
|
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', finetuneValueChanging).then(function (finetuneValueChanging) {
|
|
1580
1469
|
if (finetuneValueChanging.cancel) {
|
|
@@ -1591,82 +1480,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1591
1480
|
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
1592
1481
|
}
|
|
1593
1482
|
};
|
|
1594
|
-
/**
|
|
1595
|
-
* Get the square point for rotated shape.
|
|
1596
|
-
*
|
|
1597
|
-
* @param { SelectionPoint } obj - Specifies the selection point.
|
|
1598
|
-
* @param { Object } object - Specifies the object.
|
|
1599
|
-
* @hidden
|
|
1600
|
-
* @returns {ActivePoint}.
|
|
1601
|
-
* An ActivePoint object which returns the square point.
|
|
1602
|
-
*/
|
|
1603
|
-
ImageEditor.prototype.getSquarePointForRotatedShape = function (obj, object) {
|
|
1604
|
-
var point = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
1605
|
-
var center = { x: obj.activePoint.startX + (obj.activePoint.width / 2), y: obj.activePoint.startY +
|
|
1606
|
-
(obj.activePoint.height / 2) };
|
|
1607
|
-
var p1 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle)
|
|
1608
|
-
* (obj.activePoint.startY - center.y) + center.x,
|
|
1609
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
1610
|
-
- center.y) + center.y };
|
|
1611
|
-
var p2 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
1612
|
-
(obj.activePoint.startY - center.y) + center.x,
|
|
1613
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.startY
|
|
1614
|
-
- center.y) + center.y };
|
|
1615
|
-
var p3 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.startX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
1616
|
-
(obj.activePoint.endY - center.y) + center.x,
|
|
1617
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.startX - center.x) + Math.cos(obj.rotatedAngle) * (obj.activePoint.endY
|
|
1618
|
-
- center.y) + center.y };
|
|
1619
|
-
var p4 = { x: Math.cos(obj.rotatedAngle) * (obj.activePoint.endX - center.x) - Math.sin(obj.rotatedAngle) *
|
|
1620
|
-
(obj.activePoint.endY - center.y) + center.x,
|
|
1621
|
-
y: Math.sin(obj.rotatedAngle) * (obj.activePoint.endX - center.x) + Math.cos(obj.rotatedAngle) *
|
|
1622
|
-
(obj.activePoint.endY - center.y) + center.y };
|
|
1623
|
-
point.startX = p1.x;
|
|
1624
|
-
point.startY = p1.y;
|
|
1625
|
-
point.endX = p1.x;
|
|
1626
|
-
point.endY = p1.y;
|
|
1627
|
-
if (point.startX > p2.x) {
|
|
1628
|
-
point.startX = p2.x;
|
|
1629
|
-
}
|
|
1630
|
-
if (point.startX > p3.x) {
|
|
1631
|
-
point.startX = p3.x;
|
|
1632
|
-
}
|
|
1633
|
-
if (point.startX > p4.x) {
|
|
1634
|
-
point.startX = p4.x;
|
|
1635
|
-
}
|
|
1636
|
-
if (point.startY > p2.y) {
|
|
1637
|
-
point.startY = p2.y;
|
|
1638
|
-
}
|
|
1639
|
-
if (point.startY > p3.y) {
|
|
1640
|
-
point.startY = p3.y;
|
|
1641
|
-
}
|
|
1642
|
-
if (point.startY > p4.y) {
|
|
1643
|
-
point.startY = p4.y;
|
|
1644
|
-
}
|
|
1645
|
-
if (point.endX < p2.x) {
|
|
1646
|
-
point.endX = p2.x;
|
|
1647
|
-
}
|
|
1648
|
-
if (point.endX < p3.x) {
|
|
1649
|
-
point.endX = p3.x;
|
|
1650
|
-
}
|
|
1651
|
-
if (point.endX < p4.x) {
|
|
1652
|
-
point.endX = p4.x;
|
|
1653
|
-
}
|
|
1654
|
-
if (point.endY < p2.y) {
|
|
1655
|
-
point.endY = p2.y;
|
|
1656
|
-
}
|
|
1657
|
-
if (point.endY < p3.y) {
|
|
1658
|
-
point.endY = p3.y;
|
|
1659
|
-
}
|
|
1660
|
-
if (point.endY < p4.y) {
|
|
1661
|
-
point.endY = p4.y;
|
|
1662
|
-
}
|
|
1663
|
-
point.width = point.endX - point.startX;
|
|
1664
|
-
point.height = point.endY - point.startY;
|
|
1665
|
-
if (!isNullOrUndefined(object)) {
|
|
1666
|
-
object['activePoint'] = point;
|
|
1667
|
-
}
|
|
1668
|
-
return point;
|
|
1669
|
-
};
|
|
1670
1483
|
/**
|
|
1671
1484
|
* Get the square point for path.
|
|
1672
1485
|
*
|
|
@@ -1755,14 +1568,14 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1755
1568
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
1756
1569
|
if (!isBlazor()) {
|
|
1757
1570
|
if (Browser.isDevice) {
|
|
1758
|
-
if (
|
|
1571
|
+
if (document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
1759
1572
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1760
1573
|
var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
|
|
1761
1574
|
toolbar_1.refreshOverflow();
|
|
1762
1575
|
}
|
|
1763
1576
|
}
|
|
1764
1577
|
else {
|
|
1765
|
-
if (
|
|
1578
|
+
if (document.getElementById(this.element.id + '_toolbar')) {
|
|
1766
1579
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1767
1580
|
var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
|
|
1768
1581
|
toolbar_2.refreshOverflow();
|
|
@@ -2196,9 +2009,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2196
2009
|
var obj = { adjustmentLevel: null };
|
|
2197
2010
|
this.notify('filter', { prop: 'getAdjustmentLevel', onPropertyChange: false,
|
|
2198
2011
|
value: { obj: obj } });
|
|
2199
|
-
var value;
|
|
2200
2012
|
var typeToAdjustmentLevel = { 'brightness': obj['adjustmentLevel'].brightness,
|
|
2201
|
-
'contrast':
|
|
2013
|
+
'contrast': obj['adjustmentLevel'].contrast, 'hue': obj['adjustmentLevel'].hue,
|
|
2202
2014
|
'saturation': obj['adjustmentLevel'].saturation, 'opacity': obj['adjustmentLevel'].opacity,
|
|
2203
2015
|
'blur': obj['adjustmentLevel'].blur, 'exposure': obj['adjustmentLevel'].exposure };
|
|
2204
2016
|
return typeToAdjustmentLevel["" + type];
|
|
@@ -2217,7 +2029,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2217
2029
|
this.cropSelectedState();
|
|
2218
2030
|
this.notify('draw', { prop: 'resetCurrentSelectionPoint' });
|
|
2219
2031
|
this.notify('transform', { prop: 'performTransformation', value: { text: type } });
|
|
2220
|
-
this.moveToSelectionRange
|
|
2032
|
+
this.notify('draw', { prop: 'moveToSelectionRange', value: { type: type, activeObj: activeObj } });
|
|
2221
2033
|
this.isCropToolbar = false;
|
|
2222
2034
|
};
|
|
2223
2035
|
/**
|
|
@@ -2244,7 +2056,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2244
2056
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2245
2057
|
this.element = element;
|
|
2246
2058
|
var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
2247
|
-
if (
|
|
2059
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
2248
2060
|
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
2249
2061
|
}
|
|
2250
2062
|
else {
|
|
@@ -90,14 +90,14 @@ export interface PanEventArgs {
|
|
|
90
90
|
cancel: boolean;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* The Interface which contains the properties for crop transition
|
|
93
|
+
* The Interface which contains the properties for crop transition occurs in the Image Editor.
|
|
94
94
|
*/
|
|
95
95
|
export interface CropEventArgs {
|
|
96
96
|
/**
|
|
97
97
|
* Returns the start point of the crop region.
|
|
98
98
|
*
|
|
99
99
|
* @remarks
|
|
100
|
-
* The start and end point is used get the cropping region in
|
|
100
|
+
* The start and end point is used get the cropping region in an image editor.
|
|
101
101
|
*
|
|
102
102
|
*/
|
|
103
103
|
startPoint: Point;
|
|
@@ -105,10 +105,14 @@ export interface CropEventArgs {
|
|
|
105
105
|
* Returns the end point of the crop region.
|
|
106
106
|
*
|
|
107
107
|
* @remarks
|
|
108
|
-
* The start and end point is used get the cropping region in
|
|
108
|
+
* The start and end point is used get the cropping region in an image editor.
|
|
109
109
|
*
|
|
110
110
|
*/
|
|
111
111
|
endPoint: Point;
|
|
112
|
+
/**
|
|
113
|
+
* Specifies whether to prevent scale-based cropping in the image editor.
|
|
114
|
+
*/
|
|
115
|
+
preventScaling: boolean;
|
|
112
116
|
/**
|
|
113
117
|
* Defines whether to cancel the cropping action of image editor.
|
|
114
118
|
*/
|
|
@@ -221,6 +225,10 @@ export interface OpenEventArgs {
|
|
|
221
225
|
* Returns the file type of an image.
|
|
222
226
|
*/
|
|
223
227
|
fileType: FileType;
|
|
228
|
+
/**
|
|
229
|
+
* Returns whether the loaded file is valid in the image editor.
|
|
230
|
+
*/
|
|
231
|
+
isValidImage: boolean;
|
|
224
232
|
}
|
|
225
233
|
/**
|
|
226
234
|
* The Interface which contains the properties for saving the canvas as image.
|