@syncfusion/ej2-image-editor 23.1.38 → 23.1.41
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 +24 -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 +216 -43
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +215 -42
- 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.js +5 -1
- package/src/image-editor/action/freehand-draw.js +5 -4
- package/src/image-editor/action/transform.js +13 -6
- package/src/image-editor/action/undo-redo.js +2 -1
- package/src/image-editor/base/enum.d.ts +28 -1
- package/src/image-editor/base/enum.js +27 -0
- package/src/image-editor/base/image-editor.d.ts +9 -2
- package/src/image-editor/base/image-editor.js +145 -24
- package/src/image-editor/renderer/toolbar.js +19 -7
|
@@ -4292,7 +4292,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4292
4292
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
4293
4293
|
filesData = fileData = args.filesData[0].rawFile;
|
|
4294
4294
|
}
|
|
4295
|
-
var fileExtension =
|
|
4295
|
+
var fileExtension = void 0;
|
|
4296
|
+
if (fileData.name) {
|
|
4297
|
+
var fileExtensionArray = fileData.name.split('.');
|
|
4298
|
+
fileExtension = fileExtensionArray[fileExtensionArray.length - 1].toLowerCase();
|
|
4299
|
+
}
|
|
4296
4300
|
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
4297
4301
|
this.errorLoading();
|
|
4298
4302
|
return;
|
|
@@ -6266,7 +6270,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6266
6270
|
EventHandler.add(canvas, 'mousemove touchmove', this.freehandMoveHandler, this);
|
|
6267
6271
|
var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
|
|
6268
6272
|
startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
|
|
6269
|
-
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.
|
|
6273
|
+
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
|
|
6270
6274
|
points: null };
|
|
6271
6275
|
var shapeChangingArgs = { action: 'draw-start', previousShapeSettings: shapeSettings,
|
|
6272
6276
|
currentShapeSettings: shapeSettings };
|
|
@@ -6323,7 +6327,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6323
6327
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
6324
6328
|
var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
|
|
6325
6329
|
startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
|
|
6326
|
-
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.
|
|
6330
|
+
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
|
|
6327
6331
|
points: this.parent.pointColl[this.currFHDIdx].points };
|
|
6328
6332
|
var shapeChangingArgs = { action: 'draw-end', previousShapeSettings: shapeSettings,
|
|
6329
6333
|
currentShapeSettings: shapeSettings };
|
|
@@ -6344,6 +6348,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6344
6348
|
y = e.touches[0].clientY - rect.top;
|
|
6345
6349
|
}
|
|
6346
6350
|
if (this.isFreehandDrawing) {
|
|
6351
|
+
this.upperContext.fillStyle = this.parent.activeObj.strokeSettings.strokeColor;
|
|
6347
6352
|
this.processPoint(x, y, false, this.upperContext);
|
|
6348
6353
|
}
|
|
6349
6354
|
};
|
|
@@ -7081,7 +7086,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
7081
7086
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7082
7087
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
|
|
7083
7088
|
parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7084
|
-
|
|
7089
|
+
_this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
7085
7090
|
if (_this.fhdSelID) {
|
|
7086
7091
|
parent.pointColl[_this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7087
7092
|
parent.pointColl[_this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
@@ -7097,7 +7102,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
7097
7102
|
else {
|
|
7098
7103
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
7099
7104
|
parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7100
|
-
|
|
7105
|
+
this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
7101
7106
|
if (this.fhdSelID) {
|
|
7102
7107
|
parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7103
7108
|
parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
@@ -15275,7 +15280,8 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
15275
15280
|
parent.rotateFlipColl = obj['collection'];
|
|
15276
15281
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
15277
15282
|
this.isPreventSelect = true;
|
|
15278
|
-
parent.
|
|
15283
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
15284
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
15279
15285
|
this.isPreventSelect = false;
|
|
15280
15286
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
15281
15287
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
@@ -15542,7 +15548,8 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
15542
15548
|
parent.rotateFlipColl = obj['collection'];
|
|
15543
15549
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
15544
15550
|
this.isPreventSelect = true;
|
|
15545
|
-
parent.
|
|
15551
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
15552
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
15546
15553
|
this.isPreventSelect = false;
|
|
15547
15554
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
15548
15555
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
@@ -17094,13 +17101,17 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
17094
17101
|
}
|
|
17095
17102
|
else if (parent.img.srcWidth === parent.baseImgCanvas.width && parent.img.srcHeight === parent.baseImgCanvas.height) {
|
|
17096
17103
|
parent.currSelectionPoint = null;
|
|
17097
|
-
parent.
|
|
17104
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17105
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
17098
17106
|
}
|
|
17099
17107
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
17100
|
-
parent.
|
|
17108
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17109
|
+
value: { type: 'custom', startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
17110
|
+
width: parent.img.destWidth, height: parent.img.destHeight } });
|
|
17101
17111
|
}
|
|
17102
17112
|
else {
|
|
17103
|
-
parent.
|
|
17113
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17114
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
17104
17115
|
}
|
|
17105
17116
|
width = parent.activeObj.activePoint.width * widthRatio;
|
|
17106
17117
|
height = parent.activeObj.activePoint.height * heightRatio;
|
|
@@ -17108,7 +17119,8 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
17108
17119
|
var sy = (parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2)) - (height / 2);
|
|
17109
17120
|
parent.transform.defaultZoomFactor = 0;
|
|
17110
17121
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: true } });
|
|
17111
|
-
parent.
|
|
17122
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17123
|
+
value: { type: 'custom', startX: sx, startY: sy, width: width, height: height } });
|
|
17112
17124
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: false } });
|
|
17113
17125
|
parent.isCropToolbar = true;
|
|
17114
17126
|
parent.crop();
|
|
@@ -17575,7 +17587,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
|
|
|
17575
17587
|
}
|
|
17576
17588
|
}
|
|
17577
17589
|
parent.updateCropTransformItems();
|
|
17578
|
-
parent.
|
|
17590
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17591
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
17579
17592
|
if (parent.isCircleCrop) {
|
|
17580
17593
|
parent.isCircleCrop = false;
|
|
17581
17594
|
this.tempCurrSelPoint = extend({}, parent.currSelectionPoint, {}, true);
|
|
@@ -18453,6 +18466,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18453
18466
|
* @private
|
|
18454
18467
|
*/
|
|
18455
18468
|
ImageEditor.prototype.onPropertyChanged = function (newProperties, oldProperties) {
|
|
18469
|
+
var indexObj;
|
|
18456
18470
|
for (var _i = 0, _a = Object.keys(newProperties); _i < _a.length; _i++) {
|
|
18457
18471
|
var prop = _a[_i];
|
|
18458
18472
|
switch (prop) {
|
|
@@ -18476,9 +18490,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18476
18490
|
break;
|
|
18477
18491
|
case 'height':
|
|
18478
18492
|
this.element.style.height = newProperties.height;
|
|
18493
|
+
this.update();
|
|
18479
18494
|
break;
|
|
18480
18495
|
case 'width':
|
|
18481
18496
|
this.element.style.width = newProperties.width;
|
|
18497
|
+
this.update();
|
|
18482
18498
|
break;
|
|
18483
18499
|
case 'theme':
|
|
18484
18500
|
if (newProperties.theme) {
|
|
@@ -18490,6 +18506,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18490
18506
|
}
|
|
18491
18507
|
this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
|
|
18492
18508
|
this.upperContext.fillStyle = this.themeColl[this.theme]['secondaryColor'];
|
|
18509
|
+
if (isBlazor()) {
|
|
18510
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18511
|
+
}
|
|
18512
|
+
else {
|
|
18513
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18514
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18515
|
+
}
|
|
18493
18516
|
}
|
|
18494
18517
|
break;
|
|
18495
18518
|
case 'finetuneSettings':
|
|
@@ -18501,8 +18524,13 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18501
18524
|
case 'locale':
|
|
18502
18525
|
if (newProperties.locale) {
|
|
18503
18526
|
this.notify('toolbar', { prop: 'setLocale', onPropertyChange: false, value: { locale: newProperties.locale } });
|
|
18504
|
-
|
|
18505
|
-
|
|
18527
|
+
if (isBlazor()) {
|
|
18528
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18529
|
+
}
|
|
18530
|
+
else {
|
|
18531
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18532
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18533
|
+
}
|
|
18506
18534
|
}
|
|
18507
18535
|
break;
|
|
18508
18536
|
case 'allowUndoRedo':
|
|
@@ -18512,18 +18540,47 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18512
18540
|
else {
|
|
18513
18541
|
this.allowUndoRedo = false;
|
|
18514
18542
|
}
|
|
18515
|
-
|
|
18516
|
-
|
|
18543
|
+
if (isBlazor()) {
|
|
18544
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18545
|
+
}
|
|
18546
|
+
else {
|
|
18547
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18548
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18549
|
+
}
|
|
18517
18550
|
break;
|
|
18518
18551
|
case 'showQuickAccessToolbar':
|
|
18519
18552
|
if (newProperties.showQuickAccessToolbar) {
|
|
18520
18553
|
this.showQuickAccessToolbar = true;
|
|
18521
|
-
|
|
18522
|
-
|
|
18554
|
+
if (!isBlazor()) {
|
|
18555
|
+
this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
|
|
18556
|
+
}
|
|
18557
|
+
indexObj = { freehandSelectedIndex: null };
|
|
18558
|
+
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
18559
|
+
if (this.activeObj.shape) {
|
|
18560
|
+
if (isBlazor()) {
|
|
18561
|
+
this.updateToolbar(this.element, 'quickAccessToolbar', this.activeObj.shape);
|
|
18562
|
+
}
|
|
18563
|
+
else {
|
|
18564
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
18565
|
+
}
|
|
18566
|
+
}
|
|
18567
|
+
else if (indexObj['freehandSelectedIndex']) {
|
|
18568
|
+
if (isBlazor()) {
|
|
18569
|
+
this.updateToolbar(this.element, 'quickAccessToolbar', 'pen');
|
|
18570
|
+
}
|
|
18571
|
+
else {
|
|
18572
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
18573
|
+
}
|
|
18574
|
+
}
|
|
18523
18575
|
}
|
|
18524
18576
|
else {
|
|
18525
18577
|
this.showQuickAccessToolbar = false;
|
|
18526
|
-
|
|
18578
|
+
if (isBlazor()) {
|
|
18579
|
+
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
18580
|
+
}
|
|
18581
|
+
else {
|
|
18582
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
18583
|
+
}
|
|
18527
18584
|
}
|
|
18528
18585
|
break;
|
|
18529
18586
|
case 'zoomSettings':
|
|
@@ -18533,12 +18590,22 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18533
18590
|
if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
|
|
18534
18591
|
this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
|
|
18535
18592
|
ZoomTrigger.Commands);
|
|
18536
|
-
|
|
18537
|
-
|
|
18593
|
+
if (isBlazor()) {
|
|
18594
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18595
|
+
}
|
|
18596
|
+
else {
|
|
18597
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18598
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18599
|
+
}
|
|
18538
18600
|
}
|
|
18539
18601
|
else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
18540
|
-
|
|
18541
|
-
|
|
18602
|
+
if (isBlazor()) {
|
|
18603
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18604
|
+
}
|
|
18605
|
+
else {
|
|
18606
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18607
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18608
|
+
}
|
|
18542
18609
|
}
|
|
18543
18610
|
break;
|
|
18544
18611
|
case 'selectionSettings':
|
|
@@ -18550,6 +18617,38 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18550
18617
|
}
|
|
18551
18618
|
}
|
|
18552
18619
|
break;
|
|
18620
|
+
case 'toolbar':
|
|
18621
|
+
if (newProperties.toolbar) {
|
|
18622
|
+
this.toolbar = newProperties.toolbar;
|
|
18623
|
+
if (isBlazor()) {
|
|
18624
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18625
|
+
}
|
|
18626
|
+
else {
|
|
18627
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18628
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18629
|
+
}
|
|
18630
|
+
}
|
|
18631
|
+
break;
|
|
18632
|
+
case 'toolbarTemplate':
|
|
18633
|
+
if (newProperties.toolbarTemplate) {
|
|
18634
|
+
if (!isBlazor()) {
|
|
18635
|
+
this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
|
|
18636
|
+
this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
|
|
18637
|
+
this.element.appendChild(this.createElement('div', {
|
|
18638
|
+
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
18639
|
+
}));
|
|
18640
|
+
this.toolbarTemplateFn();
|
|
18641
|
+
}
|
|
18642
|
+
}
|
|
18643
|
+
break;
|
|
18644
|
+
case 'quickAccessToolbarTemplate':
|
|
18645
|
+
if (newProperties.quickAccessToolbarTemplate) {
|
|
18646
|
+
if (!isBlazor()) {
|
|
18647
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
18648
|
+
this.quickAccessToolbarTemplateFn();
|
|
18649
|
+
}
|
|
18650
|
+
}
|
|
18651
|
+
break;
|
|
18553
18652
|
}
|
|
18554
18653
|
}
|
|
18555
18654
|
};
|
|
@@ -18634,15 +18733,20 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18634
18733
|
var uploadObj = new Uploader({
|
|
18635
18734
|
dropArea: document.getElementsByClassName('e-canvas-wrapper')[0],
|
|
18636
18735
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
18736
|
+
multiple: false,
|
|
18637
18737
|
selected: function (args) {
|
|
18638
18738
|
if (args.event.type === 'change' || args.event.type === 'drop') {
|
|
18639
18739
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18640
18740
|
var type = args.filesData[0].type;
|
|
18641
|
-
|
|
18741
|
+
var errType = 'unsupported';
|
|
18742
|
+
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) && (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg')) {
|
|
18642
18743
|
_this.notify('draw', { prop: 'fileSelect', value: { inputElement: _this.element.querySelector('#' + _this.element.id + '_dropfileUpload'), args: args } });
|
|
18643
18744
|
}
|
|
18644
18745
|
else {
|
|
18645
|
-
|
|
18746
|
+
if (args.event.type === 'drop' && args.event.dataTransfer.files.length > 1) {
|
|
18747
|
+
errType = 'multi-select-image';
|
|
18748
|
+
}
|
|
18749
|
+
_this.showDialogPopup(errType);
|
|
18646
18750
|
}
|
|
18647
18751
|
}
|
|
18648
18752
|
}
|
|
@@ -18652,20 +18756,39 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18652
18756
|
ImageEditor.prototype.dlgCloseBtnClick = function () {
|
|
18653
18757
|
getComponent(document.getElementById(this.element.id + '_dialog'), 'dialog').destroy();
|
|
18654
18758
|
};
|
|
18655
|
-
|
|
18759
|
+
/**
|
|
18760
|
+
* Show dialog popup for unsupported files.
|
|
18761
|
+
*
|
|
18762
|
+
* @param { string } type - Specifies the type of error.
|
|
18763
|
+
* @hidden
|
|
18764
|
+
* @returns {void}.
|
|
18765
|
+
*/
|
|
18766
|
+
ImageEditor.prototype.showDialogPopup = function (type) {
|
|
18767
|
+
var content = '';
|
|
18656
18768
|
this.element.querySelector('#' + this.element.id + '_dialog').style.display = 'block';
|
|
18657
|
-
var headerObj
|
|
18658
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
18659
|
-
var contentObj = { key: 'AlertDialogContent' };
|
|
18660
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
18661
|
-
var supportObj = { key: 'SupportText' };
|
|
18662
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
18769
|
+
var headerObj;
|
|
18663
18770
|
var okObj = { key: 'OK' };
|
|
18664
18771
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: okObj } });
|
|
18772
|
+
if (type === 'multi-select-image') {
|
|
18773
|
+
headerObj = { key: 'ImageErrorDialogHeader' };
|
|
18774
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
18775
|
+
var contentObj = { key: 'ImageErrorDialogContent' };
|
|
18776
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
18777
|
+
content = '<span>' + contentObj['value'] + '</span>';
|
|
18778
|
+
}
|
|
18779
|
+
else {
|
|
18780
|
+
headerObj = { key: 'AlertDialogHeader' };
|
|
18781
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
18782
|
+
var contentObj = { key: 'AlertDialogContent' };
|
|
18783
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
18784
|
+
var supportObj = { key: 'SupportText' };
|
|
18785
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
18786
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, and SVG</b></span>';
|
|
18787
|
+
}
|
|
18665
18788
|
var dialog = new Dialog({
|
|
18666
18789
|
header: headerObj['value'],
|
|
18667
18790
|
closeOnEscape: true,
|
|
18668
|
-
content:
|
|
18791
|
+
content: content,
|
|
18669
18792
|
target: document.getElementById('target'),
|
|
18670
18793
|
width: '285px',
|
|
18671
18794
|
isModal: true,
|
|
@@ -19111,6 +19234,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
19111
19234
|
ImageEditor.prototype.select = function (type, startX, startY, width, height) {
|
|
19112
19235
|
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
19113
19236
|
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
19237
|
+
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
19238
|
+
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
19114
19239
|
};
|
|
19115
19240
|
/**
|
|
19116
19241
|
* Enable or disable a freehand drawing option in an Image Editor.
|
|
@@ -19533,10 +19658,18 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
19533
19658
|
ImageEditor.prototype.drawFrame = function (frameType, color, gradientColor, size, inset, offset, borderRadius, frameLineStyle, lineCount) {
|
|
19534
19659
|
var isFrame = false;
|
|
19535
19660
|
var obj = { frameChangeEventArgs: null };
|
|
19661
|
+
color = color ? color : '#fff';
|
|
19662
|
+
gradientColor = gradientColor ? gradientColor : '';
|
|
19663
|
+
size = size ? size : 20;
|
|
19664
|
+
inset = inset ? inset : 0;
|
|
19665
|
+
offset = offset ? offset : 0;
|
|
19666
|
+
borderRadius = borderRadius ? borderRadius : 0;
|
|
19667
|
+
frameLineStyle = frameLineStyle ? frameLineStyle : FrameLineStyle.Solid;
|
|
19668
|
+
lineCount = lineCount ? lineCount : 0;
|
|
19536
19669
|
var prevFrameSettings = { type: this.toPascalCase(this.frameObj.type), color: this.frameObj.color,
|
|
19537
19670
|
gradientColor: this.frameObj.gradientColor, size: this.frameObj.size, inset: this.frameObj.inset,
|
|
19538
|
-
offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
|
|
19539
|
-
lineCount: this.frameObj.amount };
|
|
19671
|
+
offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
|
|
19672
|
+
frameLineStyle: this.toPascalCase(this.frameObj.border), lineCount: this.frameObj.amount };
|
|
19540
19673
|
extend(this.tempFrameObj, this.frameObj);
|
|
19541
19674
|
this.tempFrameZoomLevel = this.transform.zoomFactor;
|
|
19542
19675
|
this.frameDestPoints = extend({}, this.img, {}, true);
|
|
@@ -19544,6 +19677,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
19544
19677
|
this.notify('toolbar', { prop: 'frameToolbarClick' });
|
|
19545
19678
|
}
|
|
19546
19679
|
else {
|
|
19680
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19547
19681
|
this.performFrameClick();
|
|
19548
19682
|
}
|
|
19549
19683
|
this.frameObj.type = frameType.toLowerCase();
|
|
@@ -21196,6 +21330,33 @@ var ImageEditorCommand;
|
|
|
21196
21330
|
ImageEditorCommand["RotateRight"] = "RotateRight";
|
|
21197
21331
|
ImageEditorCommand["FlipHorizontal"] = "FlipHorizontal";
|
|
21198
21332
|
ImageEditorCommand["FlipVertical"] = "FlipVertical";
|
|
21333
|
+
ImageEditorCommand["Undo"] = "Undo";
|
|
21334
|
+
ImageEditorCommand["Redo"] = "Redo";
|
|
21335
|
+
ImageEditorCommand["None"] = "None";
|
|
21336
|
+
ImageEditorCommand["Mat"] = "Mat";
|
|
21337
|
+
ImageEditorCommand["Bevel"] = "Bevel";
|
|
21338
|
+
ImageEditorCommand["Inset"] = "Inset";
|
|
21339
|
+
ImageEditorCommand["Hook"] = "Hook";
|
|
21340
|
+
ImageEditorCommand["Finetune"] = "Finetune";
|
|
21341
|
+
ImageEditorCommand["Filter"] = "Filter";
|
|
21342
|
+
ImageEditorCommand["Frame"] = "Frame";
|
|
21343
|
+
ImageEditorCommand["Resize"] = "Resize";
|
|
21344
|
+
ImageEditorCommand["HorizontalFlip"] = "HorizontalFlip";
|
|
21345
|
+
ImageEditorCommand["VerticalFlip"] = "VerticalFlip";
|
|
21346
|
+
ImageEditorCommand["Brightness"] = "Brightness";
|
|
21347
|
+
ImageEditorCommand["Contrast"] = "Contrast";
|
|
21348
|
+
ImageEditorCommand["Hue"] = "Hue";
|
|
21349
|
+
ImageEditorCommand["Saturation"] = "Saturation";
|
|
21350
|
+
ImageEditorCommand["Opacity"] = "Opacity";
|
|
21351
|
+
ImageEditorCommand["Blur"] = "Blur";
|
|
21352
|
+
ImageEditorCommand["Exposure"] = "Exposure";
|
|
21353
|
+
ImageEditorCommand["Default"] = "Default";
|
|
21354
|
+
ImageEditorCommand["Chrome"] = "Chrome";
|
|
21355
|
+
ImageEditorCommand["Cold"] = "Cold";
|
|
21356
|
+
ImageEditorCommand["Warm"] = "Warm";
|
|
21357
|
+
ImageEditorCommand["Grayscale"] = "Grayscale";
|
|
21358
|
+
ImageEditorCommand["Sepia"] = "Sepia";
|
|
21359
|
+
ImageEditorCommand["Invert"] = "Invert";
|
|
21199
21360
|
})(ImageEditorCommand || (ImageEditorCommand = {}));
|
|
21200
21361
|
/**
|
|
21201
21362
|
* An enumeration of available image filter options.
|
|
@@ -21453,7 +21614,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21453
21614
|
AlertDialogHeader: 'Unsupported file',
|
|
21454
21615
|
AlertDialogContent: 'The dropped file is unsupported.',
|
|
21455
21616
|
Yes: 'Yes',
|
|
21456
|
-
No: 'No'
|
|
21617
|
+
No: 'No',
|
|
21618
|
+
ImageErrorDialogHeader: 'Image Selection Error',
|
|
21619
|
+
ImageErrorDialogContent: 'Please select only one image to open.'
|
|
21457
21620
|
};
|
|
21458
21621
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
21459
21622
|
};
|
|
@@ -21663,7 +21826,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21663
21826
|
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
21664
21827
|
}));
|
|
21665
21828
|
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
21666
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
21829
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
|
|
21667
21830
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
21668
21831
|
this.defToolbarItems = [];
|
|
21669
21832
|
}
|
|
@@ -21680,6 +21843,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21680
21843
|
tooltipText: this.l10n.getConstant('Browse'),
|
|
21681
21844
|
template: new Uploader({
|
|
21682
21845
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
21846
|
+
multiple: false,
|
|
21683
21847
|
selected: function () {
|
|
21684
21848
|
if (!parent.disabled) {
|
|
21685
21849
|
if (Browser.isDevice) {
|
|
@@ -21753,7 +21917,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21753
21917
|
var parent = this.parent;
|
|
21754
21918
|
if (parent.showQuickAccessToolbar) {
|
|
21755
21919
|
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
21756
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
21920
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
|
|
21757
21921
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
21758
21922
|
this.defToolbarItems = [];
|
|
21759
21923
|
}
|
|
@@ -21840,7 +22004,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21840
22004
|
var parent = this.parent;
|
|
21841
22005
|
var toolbarItems = [];
|
|
21842
22006
|
if (!isOkBtn || isResize) {
|
|
21843
|
-
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) });
|
|
22007
|
+
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
|
|
21844
22008
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
21845
22009
|
}
|
|
21846
22010
|
if (parent.allowUndoRedo && !isResize) {
|
|
@@ -22266,7 +22430,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
22266
22430
|
}
|
|
22267
22431
|
};
|
|
22268
22432
|
ToolbarModule.prototype.fileSelect = function (inputElement, args) {
|
|
22269
|
-
|
|
22433
|
+
var type = inputElement.files[0].type.split('/')[1];
|
|
22434
|
+
if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg') {
|
|
22435
|
+
this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
|
|
22436
|
+
}
|
|
22437
|
+
else {
|
|
22438
|
+
this.parent.showDialogPopup();
|
|
22439
|
+
}
|
|
22270
22440
|
};
|
|
22271
22441
|
ToolbarModule.prototype.renderAnnotationBtn = function (isContextualToolbar) {
|
|
22272
22442
|
var _this = this;
|
|
@@ -22672,7 +22842,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
22672
22842
|
}
|
|
22673
22843
|
}
|
|
22674
22844
|
if (document.getElementById(parent.element.id + '_cropBtn')) {
|
|
22675
|
-
parent.
|
|
22845
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
22846
|
+
value: { type: document.getElementById(parent.element.id + '_cropBtn').textContent.toLowerCase(),
|
|
22847
|
+
startX: null, startY: null, width: null, height: null } });
|
|
22676
22848
|
}
|
|
22677
22849
|
}
|
|
22678
22850
|
});
|
|
@@ -24588,7 +24760,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
24588
24760
|
var text = args.item.id;
|
|
24589
24761
|
this.currentToolbar = 'crop';
|
|
24590
24762
|
parent.currSelectionPoint = null;
|
|
24591
|
-
parent.select
|
|
24763
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
24764
|
+
value: { type: text, startX: null, startY: null, width: null, height: null } });
|
|
24592
24765
|
this.enableDisableTbrBtn();
|
|
24593
24766
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
24594
24767
|
};
|