@syncfusion/ej2-image-editor 24.2.8 → 25.1.35
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 +3 -51
- 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 +942 -1874
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +974 -1923
- 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/crop.js +9 -45
- package/src/image-editor/action/draw.js +52 -207
- package/src/image-editor/action/export.js +6 -35
- package/src/image-editor/action/freehand-draw.js +26 -80
- package/src/image-editor/action/selection.js +122 -326
- package/src/image-editor/action/shape.js +130 -242
- package/src/image-editor/action/transform.d.ts +0 -1
- package/src/image-editor/action/transform.js +77 -289
- package/src/image-editor/action/undo-redo.js +32 -101
- package/src/image-editor/base/image-editor-model.d.ts +1 -1
- package/src/image-editor/base/image-editor.d.ts +51 -42
- package/src/image-editor/base/image-editor.js +302 -423
- package/src/image-editor/renderer/toolbar.d.ts +1 -0
- package/src/image-editor/renderer/toolbar.js +228 -185
- package/styles/bootstrap-dark.css +0 -12
- package/styles/bootstrap.css +0 -12
- package/styles/bootstrap4.css +0 -12
- package/styles/bootstrap5-dark.css +0 -12
- package/styles/bootstrap5.css +0 -12
- package/styles/fabric-dark.css +0 -12
- package/styles/fabric.css +0 -12
- package/styles/fluent-dark.css +0 -12
- package/styles/fluent.css +0 -12
- package/styles/highcontrast-light.css +0 -12
- package/styles/highcontrast.css +0 -12
- package/styles/image-editor/_bds-definition.scss +21 -0
- package/styles/image-editor/_bootstrap-dark-definition.scss +0 -1
- package/styles/image-editor/_bootstrap-definition.scss +0 -1
- package/styles/image-editor/_bootstrap4-definition.scss +0 -1
- package/styles/image-editor/_bootstrap5-definition.scss +0 -1
- package/styles/image-editor/_fabric-dark-definition.scss +0 -1
- package/styles/image-editor/_fabric-definition.scss +0 -1
- package/styles/image-editor/_fluent-definition.scss +0 -1
- package/styles/image-editor/_fusionnew-definition.scss +0 -1
- package/styles/image-editor/_highcontrast-definition.scss +0 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +0 -1
- package/styles/image-editor/_layout.scss +2 -32
- package/styles/image-editor/_material-dark-definition.scss +0 -1
- package/styles/image-editor/_material-definition.scss +0 -1
- package/styles/image-editor/_material3-definition.scss +2 -3
- package/styles/image-editor/_tailwind-definition.scss +0 -1
- package/styles/image-editor/bootstrap-dark.css +0 -12
- package/styles/image-editor/bootstrap.css +0 -12
- package/styles/image-editor/bootstrap4.css +0 -12
- package/styles/image-editor/bootstrap5-dark.css +0 -12
- package/styles/image-editor/bootstrap5.css +0 -12
- package/styles/image-editor/fabric-dark.css +0 -12
- package/styles/image-editor/fabric.css +0 -12
- package/styles/image-editor/fluent-dark.css +0 -12
- package/styles/image-editor/fluent.css +0 -12
- package/styles/image-editor/highcontrast-light.css +0 -12
- package/styles/image-editor/highcontrast.css +0 -12
- package/styles/image-editor/icons/_bds.scss +411 -0
- package/styles/image-editor/material-dark.css +0 -12
- package/styles/image-editor/material.css +0 -12
- package/styles/image-editor/material3-dark.css +4 -25
- package/styles/image-editor/material3.css +4 -25
- package/styles/image-editor/tailwind-dark.css +2 -15
- package/styles/image-editor/tailwind.css +2 -15
- package/styles/material-dark.css +0 -12
- package/styles/material.css +0 -12
- package/styles/material3-dark.css +4 -25
- package/styles/material3.css +4 -25
- package/styles/tailwind-dark.css +2 -15
- package/styles/tailwind.css +2 -15
|
@@ -17,7 +17,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
17
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
19
|
};
|
|
20
|
-
import { Component, NotifyPropertyChanges, Property, addClass, removeClass, extend
|
|
20
|
+
import { Component, NotifyPropertyChanges, Property, addClass, removeClass, extend } from '@syncfusion/ej2-base';
|
|
21
21
|
import { Event, EventHandler, getComponent, isNullOrUndefined, getUniqueID } from '@syncfusion/ej2-base';
|
|
22
22
|
import { Dialog, createSpinner } from '@syncfusion/ej2-popups';
|
|
23
23
|
import { Complex, Browser, ChildProperty, compile as templateCompiler, compile } from '@syncfusion/ej2-base';
|
|
@@ -252,26 +252,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
252
252
|
_this.isFrameBtnClick = false;
|
|
253
253
|
/** @hidden */
|
|
254
254
|
_this.isChangesSaved = false;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
new Transform(_this);
|
|
263
|
-
new UndoRedo(_this);
|
|
264
|
-
new Export(_this);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
|
|
268
|
-
ImageEditor_1.Inject(UndoRedo);
|
|
269
|
-
ImageEditor_1.Inject(Filter);
|
|
270
|
-
ImageEditor_1.Inject(Shape);
|
|
271
|
-
ImageEditor_1.Inject(FreehandDrawing);
|
|
272
|
-
if (element) {
|
|
273
|
-
_this.appendTo(element);
|
|
274
|
-
}
|
|
255
|
+
ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
|
|
256
|
+
ImageEditor_1.Inject(UndoRedo);
|
|
257
|
+
ImageEditor_1.Inject(Filter);
|
|
258
|
+
ImageEditor_1.Inject(Shape);
|
|
259
|
+
ImageEditor_1.Inject(FreehandDrawing);
|
|
260
|
+
if (element) {
|
|
261
|
+
_this.appendTo(element);
|
|
275
262
|
}
|
|
276
263
|
return _this;
|
|
277
264
|
}
|
|
@@ -383,13 +370,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
383
370
|
}
|
|
384
371
|
this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
|
|
385
372
|
this.upperContext.fillStyle = this.themeColl[this.theme]['secondaryColor'];
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
391
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
392
|
-
}
|
|
373
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
374
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
393
375
|
}
|
|
394
376
|
break;
|
|
395
377
|
case 'finetuneSettings':
|
|
@@ -401,13 +383,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
401
383
|
case 'locale':
|
|
402
384
|
if (newProperties.locale) {
|
|
403
385
|
this.notify('toolbar', { prop: 'setLocale', onPropertyChange: false, value: { locale: newProperties.locale } });
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
409
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
410
|
-
}
|
|
386
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
387
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
411
388
|
}
|
|
412
389
|
break;
|
|
413
390
|
case 'allowUndoRedo':
|
|
@@ -417,47 +394,25 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
417
394
|
else {
|
|
418
395
|
this.allowUndoRedo = false;
|
|
419
396
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
425
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
426
|
-
}
|
|
397
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
398
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
427
399
|
break;
|
|
428
400
|
case 'showQuickAccessToolbar':
|
|
429
401
|
if (newProperties.showQuickAccessToolbar) {
|
|
430
402
|
this.showQuickAccessToolbar = true;
|
|
431
|
-
|
|
432
|
-
this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
|
|
433
|
-
}
|
|
403
|
+
this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
|
|
434
404
|
indexObj = { freehandSelectedIndex: null };
|
|
435
405
|
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
436
406
|
if (this.activeObj.shape) {
|
|
437
|
-
|
|
438
|
-
this.updateToolbar(this.element, 'quickAccessToolbar', this.activeObj.shape);
|
|
439
|
-
}
|
|
440
|
-
else {
|
|
441
|
-
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
442
|
-
}
|
|
407
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
443
408
|
}
|
|
444
409
|
else if (indexObj['freehandSelectedIndex']) {
|
|
445
|
-
|
|
446
|
-
this.updateToolbar(this.element, 'quickAccessToolbar', 'pen');
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
450
|
-
}
|
|
410
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
451
411
|
}
|
|
452
412
|
}
|
|
453
413
|
else {
|
|
454
414
|
this.showQuickAccessToolbar = false;
|
|
455
|
-
|
|
456
|
-
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
460
|
-
}
|
|
415
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
461
416
|
}
|
|
462
417
|
break;
|
|
463
418
|
case 'zoomSettings':
|
|
@@ -467,22 +422,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
467
422
|
if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
|
|
468
423
|
this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
|
|
469
424
|
ZoomTrigger.Commands);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
475
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
476
|
-
}
|
|
425
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
426
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
477
427
|
}
|
|
478
428
|
else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
484
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
485
|
-
}
|
|
429
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
430
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
486
431
|
}
|
|
487
432
|
break;
|
|
488
433
|
case 'selectionSettings':
|
|
@@ -497,33 +442,24 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
497
442
|
case 'toolbar':
|
|
498
443
|
if (newProperties.toolbar) {
|
|
499
444
|
this.toolbar = newProperties.toolbar;
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
505
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
506
|
-
}
|
|
445
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
446
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
507
447
|
}
|
|
508
448
|
break;
|
|
509
449
|
case 'toolbarTemplate':
|
|
510
450
|
if (newProperties.toolbarTemplate) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
this.element.
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
this.toolbarTemplateFn();
|
|
518
|
-
}
|
|
451
|
+
this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
|
|
452
|
+
this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
|
|
453
|
+
this.element.appendChild(this.createElement('div', {
|
|
454
|
+
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
455
|
+
}));
|
|
456
|
+
this.toolbarTemplateFn();
|
|
519
457
|
}
|
|
520
458
|
break;
|
|
521
459
|
case 'quickAccessToolbarTemplate':
|
|
522
460
|
if (newProperties.quickAccessToolbarTemplate) {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
this.quickAccessToolbarTemplateFn();
|
|
526
|
-
}
|
|
461
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
462
|
+
this.quickAccessToolbarTemplateFn();
|
|
527
463
|
}
|
|
528
464
|
break;
|
|
529
465
|
}
|
|
@@ -539,14 +475,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
539
475
|
if (!this.element.getAttribute('class')) {
|
|
540
476
|
this.element.removeAttribute('class');
|
|
541
477
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
else {
|
|
546
|
-
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
547
|
-
this.notify('destroyed', null);
|
|
548
|
-
_super.prototype.destroy.call(this);
|
|
549
|
-
}
|
|
478
|
+
this.notify('toolbar', { prop: 'destroySubComponents', onPropertyChange: false });
|
|
479
|
+
this.notify('destroyed', null);
|
|
480
|
+
_super.prototype.destroy.call(this);
|
|
550
481
|
this.unwireEvent();
|
|
551
482
|
this.element.innerHTML = '';
|
|
552
483
|
};
|
|
@@ -737,6 +668,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
737
668
|
var obj = { toolbarHeight: 0 };
|
|
738
669
|
this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
|
|
739
670
|
var height = obj['toolbarHeight'];
|
|
671
|
+
if (this.toolbar && this.toolbar.length > 0 && this.toolbar.indexOf('Open') === -1) {
|
|
672
|
+
height = 0;
|
|
673
|
+
}
|
|
740
674
|
this.element.style.width = this.width;
|
|
741
675
|
this.element.style.height = this.height;
|
|
742
676
|
var canvasWrapper = this.element.appendChild(this.createElement('div', { id: this.element.id + '_canvasWrapper',
|
|
@@ -904,10 +838,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
904
838
|
/**
|
|
905
839
|
* Clears the current selection performed in the image editor.
|
|
906
840
|
*
|
|
841
|
+
* @param { boolean } resetCrop - Specifies to reset last cropped image.
|
|
842
|
+
*
|
|
907
843
|
* @returns {void}.
|
|
908
844
|
*/
|
|
909
|
-
ImageEditor.prototype.clearSelection = function () {
|
|
910
|
-
this.notify('selection', { prop: 'clearSelection', onPropertyChange: false });
|
|
845
|
+
ImageEditor.prototype.clearSelection = function (resetCrop) {
|
|
846
|
+
this.notify('selection', { prop: 'clearSelection', onPropertyChange: false, value: { resetCrop: resetCrop } });
|
|
911
847
|
};
|
|
912
848
|
/**
|
|
913
849
|
* Crops an image based on the selection done in the image editor.
|
|
@@ -955,7 +891,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
955
891
|
*/
|
|
956
892
|
ImageEditor.prototype.getImageData = function () {
|
|
957
893
|
var obj = { canvas: null };
|
|
958
|
-
|
|
894
|
+
var dummyObj = { bool: false };
|
|
895
|
+
this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: dummyObj } });
|
|
896
|
+
if (dummyObj['bool'] || this.togglePen || this.activeObj.shape) {
|
|
959
897
|
this.okBtn();
|
|
960
898
|
}
|
|
961
899
|
this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
|
|
@@ -994,13 +932,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
994
932
|
this.clearContext(this.lowerContext);
|
|
995
933
|
this.clearContext(this.upperContext);
|
|
996
934
|
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
|
|
1003
|
-
}
|
|
935
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
936
|
+
isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
|
|
937
|
+
if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
938
|
+
getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
939
|
+
this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
|
|
1004
940
|
}
|
|
1005
941
|
var isImageLoaded = this.isImageLoaded;
|
|
1006
942
|
this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
|
|
@@ -1065,36 +1001,28 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1065
1001
|
}
|
|
1066
1002
|
this.notifyResetForAllModules();
|
|
1067
1003
|
this.notify('filter', { prop: 'update-finetunes' });
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
1074
|
-
}
|
|
1075
|
-
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
1004
|
+
if (this.toolbarTemplate) {
|
|
1005
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
1006
|
+
}
|
|
1007
|
+
else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
1008
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
1076
1009
|
}
|
|
1010
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
1077
1011
|
this.isImageLoaded = isImageLoaded;
|
|
1078
1012
|
this.straightenBaseImageCanvas();
|
|
1079
1013
|
this.isImageLoaded = false;
|
|
1080
1014
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
1081
1015
|
this.isImageLoaded = isImageLoaded;
|
|
1082
1016
|
this.prevStraightenedDegree = 0;
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
ctWrapper.classList.add('e-hide');
|
|
1087
|
-
}
|
|
1088
|
-
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
1089
|
-
this.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
1090
|
-
var straightenObj = { bool: this.isStraightening };
|
|
1091
|
-
if (Browser.isDevice && straightenObj['bool']) {
|
|
1092
|
-
this.notify('crop', { prop: 'resizeWrapper' });
|
|
1093
|
-
}
|
|
1017
|
+
var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
|
|
1018
|
+
if (ctWrapper) {
|
|
1019
|
+
ctWrapper.classList.add('e-hide');
|
|
1094
1020
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1021
|
+
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
1022
|
+
this.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
1023
|
+
var straightenObj = { bool: this.isStraightening };
|
|
1024
|
+
if (Browser.isDevice && straightenObj['bool']) {
|
|
1025
|
+
this.notify('crop', { prop: 'resizeWrapper' });
|
|
1098
1026
|
}
|
|
1099
1027
|
}
|
|
1100
1028
|
};
|
|
@@ -1114,9 +1042,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1114
1042
|
*/
|
|
1115
1043
|
ImageEditor.prototype.rotate = function (degree) {
|
|
1116
1044
|
var obj = { isRotate: false };
|
|
1045
|
+
if (degree === 90 || degree === -90) {
|
|
1046
|
+
this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
|
|
1047
|
+
}
|
|
1117
1048
|
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
1118
1049
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1119
|
-
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1120
1050
|
return obj['isRotate'];
|
|
1121
1051
|
};
|
|
1122
1052
|
/**
|
|
@@ -1154,8 +1084,20 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1154
1084
|
this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
|
|
1155
1085
|
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
1156
1086
|
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
1157
|
-
|
|
1158
|
-
|
|
1087
|
+
if ((startX && startY) || (width && height)) {
|
|
1088
|
+
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
1089
|
+
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
1093
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
1094
|
+
rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
|
|
1095
|
+
destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
|
|
1096
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
|
|
1097
|
+
aspectWidth: null, aspectHeight: null, straightenZoom: 0,
|
|
1098
|
+
adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
|
|
1099
|
+
exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
|
|
1100
|
+
}
|
|
1159
1101
|
};
|
|
1160
1102
|
/**
|
|
1161
1103
|
* Enable or disable a freehand drawing option in an Image Editor.
|
|
@@ -1227,16 +1169,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1227
1169
|
* @param {string} strokeColor - Specifies the stroke color of ellipse.
|
|
1228
1170
|
* @param {string} fillColor - Specifies the fill color of the ellipse.
|
|
1229
1171
|
* @param {number} degree - Specifies the degree to rotate the ellipse.
|
|
1172
|
+
* @param {boolean} isSelected - Specifies to show the ellipse in the selected state.
|
|
1230
1173
|
* @returns {boolean}.
|
|
1231
1174
|
*
|
|
1232
1175
|
*/
|
|
1233
|
-
ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
|
|
1176
|
+
ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
|
|
1234
1177
|
var isEllipse = false;
|
|
1235
1178
|
var isPointsInRange = this.allowShape(x, y);
|
|
1236
1179
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1237
1180
|
isEllipse = true;
|
|
1238
1181
|
this.notify('shape', { prop: 'drawEllipse', onPropertyChange: false, value: { x: x, y: y, radiusX: radiusX, radiusY: radiusY,
|
|
1239
|
-
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
|
|
1182
|
+
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
|
|
1240
1183
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1241
1184
|
}
|
|
1242
1185
|
return isEllipse;
|
|
@@ -1250,15 +1193,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1250
1193
|
* @param {number} endY - Specifies end point y-coordinates of the line.
|
|
1251
1194
|
* @param {number} strokeWidth - Specifies the stroke width of line.
|
|
1252
1195
|
* @param {string} strokeColor - Specifies the stroke color of line.
|
|
1196
|
+
* @param {boolean} isSelected - Specifies to show the line in the selected state.
|
|
1253
1197
|
* @returns {boolean}.
|
|
1254
1198
|
*/
|
|
1255
|
-
ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
1199
|
+
ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
|
|
1256
1200
|
var isLine = false;
|
|
1257
1201
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
1258
1202
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
1259
1203
|
isLine = true;
|
|
1260
1204
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
1261
|
-
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
1205
|
+
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
|
|
1262
1206
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1263
1207
|
}
|
|
1264
1208
|
return isLine;
|
|
@@ -1274,15 +1218,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1274
1218
|
* @param {string} strokeColor - Specifies the stroke color of arrow.
|
|
1275
1219
|
* @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
|
|
1276
1220
|
* @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
|
|
1221
|
+
* @param {boolean} isSelected - Specifies to show the arrow in the selected state.
|
|
1277
1222
|
* @returns {boolean}.
|
|
1278
1223
|
*/
|
|
1279
|
-
ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
1224
|
+
ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
|
|
1280
1225
|
var isArrow = false;
|
|
1281
1226
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
1282
1227
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
1283
1228
|
isArrow = true;
|
|
1284
1229
|
this.notify('shape', { prop: 'drawArrow', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
1285
|
-
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd
|
|
1230
|
+
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
|
|
1231
|
+
isSelected: isSelected } });
|
|
1286
1232
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1287
1233
|
}
|
|
1288
1234
|
return isArrow;
|
|
@@ -1293,9 +1239,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1293
1239
|
* @param {Point[]} pointColl – Specifies collection of start and end x, y-coordinates of path.
|
|
1294
1240
|
* @param {number} strokeWidth - Specifies the stroke width of path.
|
|
1295
1241
|
* @param {string} strokeColor - Specifies the stroke color of path.
|
|
1242
|
+
* @param {boolean} isSelected - Specifies to show the path in the selected state.
|
|
1296
1243
|
* @returns {boolean}.
|
|
1297
1244
|
*/
|
|
1298
|
-
ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor,
|
|
1245
|
+
ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, isSelected) {
|
|
1299
1246
|
this.isPublicMethod = true;
|
|
1300
1247
|
var obj = { inRange: false };
|
|
1301
1248
|
var isPath = false;
|
|
@@ -1311,7 +1258,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1311
1258
|
if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
|
|
1312
1259
|
isPath = true;
|
|
1313
1260
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
1314
|
-
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
1261
|
+
strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
|
|
1315
1262
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1316
1263
|
}
|
|
1317
1264
|
return isPath;
|
|
@@ -1327,15 +1274,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1327
1274
|
* @param {string} strokeColor - Specifies the stroke color of rectangle.
|
|
1328
1275
|
* @param {string} fillColor - Specifies the fill color of the rectangle.
|
|
1329
1276
|
* @param {number} degree - Specifies the degree to rotate the rectangle.
|
|
1277
|
+
* @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
|
|
1330
1278
|
* @returns {boolean}.
|
|
1331
1279
|
*/
|
|
1332
|
-
ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
|
|
1280
|
+
ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
|
|
1333
1281
|
var isRectangle = false;
|
|
1334
1282
|
var isPointsInRange = this.allowShape(x, y);
|
|
1335
1283
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1336
1284
|
isRectangle = true;
|
|
1337
1285
|
this.notify('shape', { prop: 'drawRectangle', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
1338
|
-
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree } });
|
|
1286
|
+
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
|
|
1339
1287
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1340
1288
|
}
|
|
1341
1289
|
return isRectangle;
|
|
@@ -1353,16 +1301,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1353
1301
|
* @param {boolean} bold - Specifies whether the text is bold or not.
|
|
1354
1302
|
* @param {boolean} italic - Specifies whether the text is italic or not.
|
|
1355
1303
|
* @param {string} color - Specifies font color of the text.
|
|
1304
|
+
* @param {boolean} isSelected - Specifies to show the text in the selected state.
|
|
1356
1305
|
* @returns {boolean}.
|
|
1357
1306
|
*
|
|
1358
1307
|
*/
|
|
1359
|
-
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
1308
|
+
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
|
|
1360
1309
|
var isText = false;
|
|
1361
1310
|
var isPointsInRange = this.allowShape(x, y);
|
|
1362
1311
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1363
1312
|
isText = true;
|
|
1364
1313
|
this.notify('shape', { prop: 'drawText', onPropertyChange: false, value: { x: x, y: y, text: text, fontFamily: fontFamily,
|
|
1365
|
-
fontSize: fontSize, bold: bold, italic: italic, color: color } });
|
|
1314
|
+
fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected } });
|
|
1366
1315
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1367
1316
|
}
|
|
1368
1317
|
return isText;
|
|
@@ -1379,16 +1328,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1379
1328
|
* @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
|
|
1380
1329
|
* @param {number} degree - Specifies the degree to rotate the image.
|
|
1381
1330
|
* @param {number} opacity - Specifies the value for the image.
|
|
1331
|
+
* @param {boolean} isSelected - Specifies to show the image in the selected state.
|
|
1382
1332
|
* @returns {boolean}.
|
|
1383
1333
|
*
|
|
1384
1334
|
*/
|
|
1385
|
-
ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity) {
|
|
1335
|
+
ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity, isSelected) {
|
|
1386
1336
|
var isImage = false;
|
|
1387
1337
|
var isPointsInRange = this.allowShape(x, y);
|
|
1388
1338
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1389
1339
|
var length_1 = this.objColl.length;
|
|
1390
1340
|
this.notify('shape', { prop: 'drawImage', onPropertyChange: false, value: { x: x, y: y, width: width, height: height,
|
|
1391
|
-
src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity } });
|
|
1341
|
+
src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
|
|
1392
1342
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1393
1343
|
if (this.objColl.length > length_1) {
|
|
1394
1344
|
isImage = true;
|
|
@@ -1436,10 +1386,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1436
1386
|
*
|
|
1437
1387
|
*/
|
|
1438
1388
|
ImageEditor.prototype.getShapeSetting = function (id) {
|
|
1439
|
-
var
|
|
1389
|
+
var obj = { shapeDetails: null };
|
|
1440
1390
|
this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
|
|
1441
|
-
value: { id: id, obj:
|
|
1391
|
+
value: { id: id, obj: obj } });
|
|
1442
1392
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1393
|
+
var shapeDetails = obj['shapeDetails'] ? obj['shapeDetails'] : {};
|
|
1443
1394
|
return shapeDetails;
|
|
1444
1395
|
};
|
|
1445
1396
|
/**
|
|
@@ -1543,28 +1494,23 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1543
1494
|
if ((width.toString()).length <= 4 && (height.toString()).length <= 4) {
|
|
1544
1495
|
var destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
|
|
1545
1496
|
height: this.img.destHeight };
|
|
1546
|
-
if (
|
|
1547
|
-
this.
|
|
1497
|
+
if (isAspectRatio) {
|
|
1498
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
|
|
1499
|
+
isApplyBtn: false, isCropping: false } });
|
|
1500
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
|
|
1501
|
+
isApplyBtn: false, isCropping: false } });
|
|
1548
1502
|
}
|
|
1549
1503
|
else {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
var aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
|
|
1561
|
-
var aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
|
|
1562
|
-
if (aspectRatioWidth && aspectRatioHeight) {
|
|
1563
|
-
getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
|
|
1564
|
-
aspectRatioWidth.value = Math.floor(width).toString() + ' px';
|
|
1565
|
-
getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
|
|
1566
|
-
aspectRatioHeight.value = Math.floor(height).toString() + ' px';
|
|
1567
|
-
}
|
|
1504
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
|
|
1505
|
+
isApplyBtn: false, isCropping: false } });
|
|
1506
|
+
}
|
|
1507
|
+
var aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
|
|
1508
|
+
var aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
|
|
1509
|
+
if (aspectRatioWidth && aspectRatioHeight) {
|
|
1510
|
+
getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
|
|
1511
|
+
aspectRatioWidth.value = Math.floor(width).toString() + ' px';
|
|
1512
|
+
getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
|
|
1513
|
+
aspectRatioHeight.value = Math.floor(height).toString() + ' px';
|
|
1568
1514
|
}
|
|
1569
1515
|
this.notify('transform', { prop: 'resize', value: { width: width, height: height, isAspectRatio: isAspectRatio } });
|
|
1570
1516
|
if (destPoints.startX !== this.img.destLeft || destPoints.startY !== this.img.destTop ||
|
|
@@ -1612,13 +1558,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1612
1558
|
extend(this.tempFrameObj, this.frameObj);
|
|
1613
1559
|
this.tempFrameZoomLevel = this.transform.zoomFactor;
|
|
1614
1560
|
this.frameDestPoints = extend({}, this.img, {}, true);
|
|
1615
|
-
|
|
1616
|
-
this.notify('toolbar', { prop: 'frameToolbarClick' });
|
|
1617
|
-
}
|
|
1618
|
-
else {
|
|
1619
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1620
|
-
this.performFrameClick();
|
|
1621
|
-
}
|
|
1561
|
+
this.notify('toolbar', { prop: 'frameToolbarClick' });
|
|
1622
1562
|
this.frameObj.type = frameType.toLowerCase();
|
|
1623
1563
|
this.frameObj.color = color;
|
|
1624
1564
|
this.frameObj.gradientColor = gradientColor;
|
|
@@ -1673,22 +1613,65 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1673
1613
|
* {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
|
|
1674
1614
|
*
|
|
1675
1615
|
* @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
|
|
1616
|
+
* @param {boolean} isSelected - Specifies to show the shape in the selected state.
|
|
1676
1617
|
* @returns {boolean}.
|
|
1677
1618
|
*
|
|
1678
1619
|
*/
|
|
1679
|
-
ImageEditor.prototype.updateShape = function (setting) {
|
|
1620
|
+
ImageEditor.prototype.updateShape = function (setting, isSelected) {
|
|
1680
1621
|
var obj = { isSelected: false };
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1622
|
+
var isTextArea = false;
|
|
1623
|
+
var freehandObj = { bool: false };
|
|
1624
|
+
if (isNullOrUndefined(setting.id)) {
|
|
1625
|
+
if (setting.strokeColor) {
|
|
1626
|
+
this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
|
|
1627
|
+
}
|
|
1628
|
+
if (setting.fillColor) {
|
|
1629
|
+
this.activeObj.strokeSettings.fillColor = setting.fillColor;
|
|
1630
|
+
}
|
|
1631
|
+
if (setting.strokeWidth) {
|
|
1632
|
+
this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
|
|
1633
|
+
}
|
|
1634
|
+
if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
|
|
1635
|
+
this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
|
|
1640
|
+
this.textArea.style.display === 'inline-block')) {
|
|
1641
|
+
this.okBtn();
|
|
1642
|
+
isTextArea = true;
|
|
1643
|
+
}
|
|
1644
|
+
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
|
|
1645
|
+
this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
|
|
1646
|
+
if (obj['isSelected']) {
|
|
1647
|
+
this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1648
|
+
value: { shapeSettings: setting } });
|
|
1649
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
1650
|
+
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1651
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
|
|
1652
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1653
|
+
if (activeObj.shape) {
|
|
1654
|
+
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
1655
|
+
}
|
|
1656
|
+
if (this.activeObj.shape === 'text') {
|
|
1657
|
+
this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
|
|
1658
|
+
}
|
|
1659
|
+
if (freehandObj['bool']) {
|
|
1660
|
+
this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
|
|
1661
|
+
}
|
|
1662
|
+
this.okBtn(isSelected);
|
|
1663
|
+
if (freehandObj['bool']) {
|
|
1664
|
+
this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
|
|
1665
|
+
}
|
|
1666
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1667
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1668
|
+
if (isTextArea) {
|
|
1669
|
+
this.enableTextEditing();
|
|
1670
|
+
}
|
|
1671
|
+
if (isSelected) {
|
|
1672
|
+
this.selectShape(setting.id);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1692
1675
|
}
|
|
1693
1676
|
return obj['isSelected'];
|
|
1694
1677
|
};
|
|
@@ -1705,19 +1688,80 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1705
1688
|
if (shapeId.split('_')[0] === 'shape') {
|
|
1706
1689
|
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
|
|
1707
1690
|
if (obj['isSelected']) {
|
|
1708
|
-
|
|
1709
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1710
|
-
this.duplicateShape(false, true);
|
|
1711
|
-
}
|
|
1712
|
-
else {
|
|
1713
|
-
this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
|
|
1714
|
-
}
|
|
1691
|
+
this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
|
|
1715
1692
|
this.okBtn();
|
|
1716
1693
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1717
1694
|
}
|
|
1718
1695
|
}
|
|
1719
1696
|
return obj['isSelected'];
|
|
1720
1697
|
};
|
|
1698
|
+
/**
|
|
1699
|
+
* Update filter to the canvas in the ImageEditor.
|
|
1700
|
+
*
|
|
1701
|
+
* @param {ImageFilterOption } filterOption - Specifies the filter options to the image.
|
|
1702
|
+
*
|
|
1703
|
+
* @returns {string}.
|
|
1704
|
+
*
|
|
1705
|
+
*/
|
|
1706
|
+
ImageEditor.prototype.getImageFilter = function (filterOption) {
|
|
1707
|
+
var canvas = this.createElement('canvas');
|
|
1708
|
+
var ctx = canvas.getContext('2d');
|
|
1709
|
+
this.notify('filter', { prop: 'updateAdj', value: { type: filterOption.toLowerCase(), value: null, isPreview: true, ctx: ctx } });
|
|
1710
|
+
return ctx.filter;
|
|
1711
|
+
};
|
|
1712
|
+
/**
|
|
1713
|
+
* Enable text area editing in the ImageEditor.
|
|
1714
|
+
*
|
|
1715
|
+
* @returns {void}.
|
|
1716
|
+
*
|
|
1717
|
+
*/
|
|
1718
|
+
ImageEditor.prototype.enableTextEditing = function () {
|
|
1719
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
1720
|
+
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1721
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: false } });
|
|
1722
|
+
this.activeObj = activeObj;
|
|
1723
|
+
this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
|
|
1724
|
+
};
|
|
1725
|
+
/**
|
|
1726
|
+
* Specifies if it's possible to undo the last recent action made in an Image Editor.
|
|
1727
|
+
*
|
|
1728
|
+
* @returns {boolean}.
|
|
1729
|
+
*
|
|
1730
|
+
*/
|
|
1731
|
+
ImageEditor.prototype.canUndo = function () {
|
|
1732
|
+
var canUndo = false;
|
|
1733
|
+
var object = this.getUndoRedoColl();
|
|
1734
|
+
var undoRedoIndex = object['index'];
|
|
1735
|
+
if (undoRedoIndex > 0) {
|
|
1736
|
+
canUndo = true;
|
|
1737
|
+
}
|
|
1738
|
+
return canUndo;
|
|
1739
|
+
};
|
|
1740
|
+
/**
|
|
1741
|
+
* Specifies if it's possible to redo the last recent action made in an Image Editor.
|
|
1742
|
+
*
|
|
1743
|
+
* @returns {boolean}.
|
|
1744
|
+
*
|
|
1745
|
+
*/
|
|
1746
|
+
ImageEditor.prototype.canRedo = function () {
|
|
1747
|
+
var canRedo = false;
|
|
1748
|
+
var object = this.getUndoRedoColl();
|
|
1749
|
+
var undoRedoColl = object['undoRedoColl'];
|
|
1750
|
+
var undoRedoIndex = object['index'];
|
|
1751
|
+
if (undoRedoColl && undoRedoColl.length > 0 && undoRedoIndex < undoRedoColl.length - 1) {
|
|
1752
|
+
canRedo = true;
|
|
1753
|
+
}
|
|
1754
|
+
if (undoRedoIndex === undoRedoColl.length) {
|
|
1755
|
+
canRedo = false;
|
|
1756
|
+
}
|
|
1757
|
+
else if (undoRedoIndex === 0 && undoRedoColl.length > 0) {
|
|
1758
|
+
canRedo = true;
|
|
1759
|
+
}
|
|
1760
|
+
else if (undoRedoIndex > 0) {
|
|
1761
|
+
canRedo = true;
|
|
1762
|
+
}
|
|
1763
|
+
return canRedo;
|
|
1764
|
+
};
|
|
1721
1765
|
// Toolbar related codes
|
|
1722
1766
|
ImageEditor.prototype.toolbarTemplateFn = function () {
|
|
1723
1767
|
var template;
|
|
@@ -1801,6 +1845,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1801
1845
|
this.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
|
|
1802
1846
|
this.notify('freehand-draw', { prop: 'color-change', value: { color: obj['tempFreeHandDrawEditingStyles'].strokeColor } });
|
|
1803
1847
|
};
|
|
1848
|
+
ImageEditor.prototype.getUndoRedoColl = function () {
|
|
1849
|
+
var obj = { undoRedoColl: null, index: null };
|
|
1850
|
+
var undoRedoObj = { undoRedoStep: null };
|
|
1851
|
+
var object = { appliedUndoRedoColl: [] };
|
|
1852
|
+
this.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
|
|
1853
|
+
this.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
1854
|
+
obj['undoRedoColl'] = object['appliedUndoRedoColl'];
|
|
1855
|
+
obj['index'] = undoRedoObj['undoRedoStep'];
|
|
1856
|
+
return obj;
|
|
1857
|
+
};
|
|
1804
1858
|
ImageEditor.prototype.updateImageTransformColl = function (type) {
|
|
1805
1859
|
var value;
|
|
1806
1860
|
if (type === 'rotateleft') {
|
|
@@ -1944,10 +1998,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1944
1998
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
1945
1999
|
}
|
|
1946
2000
|
var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
1947
|
-
this.
|
|
2001
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
1948
2002
|
}
|
|
1949
|
-
|
|
1950
|
-
if (aspectIcon || nonAspectIcon || (isBlazor() && this.currentToolbar === 'resize-toolbar')) {
|
|
2003
|
+
if (aspectIcon || nonAspectIcon) {
|
|
1951
2004
|
var obj_2 = { width: null, height: null };
|
|
1952
2005
|
this.notify('selection', { prop: 'getNumTextValue', onPropertyChange: false, value: { obj: obj_2 } });
|
|
1953
2006
|
var point = { x: obj_2['width'], y: obj_2['height'] };
|
|
@@ -1981,7 +2034,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1981
2034
|
isCircleCrop: null } });
|
|
1982
2035
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1983
2036
|
var obj_3 = this.cancelCropSelection;
|
|
1984
|
-
if ((
|
|
2037
|
+
if ((obj_3 && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon))) {
|
|
1985
2038
|
obj_3.previousObj.aspectWidth = obj_3.currentObj.aspectWidth = this.aspectWidth;
|
|
1986
2039
|
obj_3.previousObj.aspectHeight = obj_3.currentObj.aspectHeight = this.aspectHeight;
|
|
1987
2040
|
obj_3.previousCropObj = extend({}, this.cropObj, {}, true);
|
|
@@ -2035,9 +2088,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2035
2088
|
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
2036
2089
|
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
2037
2090
|
}
|
|
2038
|
-
else if (
|
|
2039
|
-
(isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
2040
|
-
this.currObjType.isFiltered) {
|
|
2091
|
+
else if (document.querySelector('#' + this.element.id + '_sliderWrapper') || this.currObjType.isFiltered) {
|
|
2041
2092
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
2042
2093
|
this.currObjType.isFiltered = false;
|
|
2043
2094
|
var obj_4 = { value: null };
|
|
@@ -2053,12 +2104,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2053
2104
|
else if (obj['bool']) {
|
|
2054
2105
|
this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
2055
2106
|
this.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
|
|
2056
|
-
|
|
2057
|
-
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
2058
|
-
}
|
|
2059
|
-
else {
|
|
2060
|
-
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
2061
|
-
}
|
|
2107
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
2062
2108
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2063
2109
|
}
|
|
2064
2110
|
else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
|
|
@@ -2084,20 +2130,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2084
2130
|
}
|
|
2085
2131
|
this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
|
|
2086
2132
|
}
|
|
2087
|
-
if (!
|
|
2133
|
+
if (!obj['isCropToolbar']) {
|
|
2088
2134
|
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
2089
2135
|
isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
|
|
2090
2136
|
}
|
|
2091
|
-
else if (isBlazor() && !obj['isCropToolbar'] && (this.currentToolbar == 'resize-toolbar' || this.currentToolbar == 'frame-toolbar')) {
|
|
2092
|
-
this.updateToolbar(this.element, 'imageLoaded');
|
|
2093
|
-
}
|
|
2094
2137
|
this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
|
|
2095
2138
|
this.transform.zoomFactor = this.transform.defaultZoomFactor;
|
|
2096
2139
|
this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
2097
2140
|
this.isResizeOkBtn = false;
|
|
2098
2141
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
2099
2142
|
this.isChangesSaved = false;
|
|
2100
|
-
this.triggerActionComplete();
|
|
2101
2143
|
};
|
|
2102
2144
|
/**
|
|
2103
2145
|
* Set the temporary filter properties.
|
|
@@ -2156,18 +2198,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2156
2198
|
var data = this.getImageData();
|
|
2157
2199
|
if (ctWrapper) {
|
|
2158
2200
|
ctWrapper.classList.remove('e-hide');
|
|
2159
|
-
if (isBlazor()) {
|
|
2160
|
-
this.element.querySelector('.e-ie-toolbar-check-btn').classList.remove('e-hidden');
|
|
2161
|
-
this.element.querySelector('.e-ie-toolbar-close-btn').classList.remove('e-hidden');
|
|
2162
|
-
}
|
|
2163
2201
|
}
|
|
2164
|
-
if (!
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
isApplyBtn: true, isCropping: false } });
|
|
2168
|
-
}
|
|
2169
|
-
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
2202
|
+
if (!Browser.isDevice) {
|
|
2203
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
2204
|
+
isApplyBtn: true, isCropping: false } });
|
|
2170
2205
|
}
|
|
2206
|
+
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
2171
2207
|
this.objColl = objColl;
|
|
2172
2208
|
this.pointColl = pointColl;
|
|
2173
2209
|
this.freehandCounter = pointColl.length;
|
|
@@ -2185,26 +2221,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2185
2221
|
* @returns {void}.
|
|
2186
2222
|
*/
|
|
2187
2223
|
ImageEditor.prototype.setCurrAdjustmentValue = function (type, value) {
|
|
2188
|
-
var
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
finetuneValueChanging.value = parseInt(finetuneValueChanging.value.toString());
|
|
2193
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2194
|
-
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanging', finetuneValueChanging, null).then(function (finetuneValueChanging) {
|
|
2195
|
-
if (finetuneValueChanging.cancel) {
|
|
2196
|
-
return;
|
|
2197
|
-
}
|
|
2198
|
-
_this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
else {
|
|
2202
|
-
this.trigger('finetuneValueChanging', finetuneValueChanging);
|
|
2203
|
-
if (finetuneValueChanging.cancel) {
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
|
-
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
2224
|
+
var finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
|
|
2225
|
+
this.trigger('finetuneValueChanging', finetuneValueChanging);
|
|
2226
|
+
if (finetuneValueChanging.cancel) {
|
|
2227
|
+
return;
|
|
2207
2228
|
}
|
|
2229
|
+
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
2208
2230
|
};
|
|
2209
2231
|
/**
|
|
2210
2232
|
* Get the square point for path.
|
|
@@ -2298,24 +2320,22 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2298
2320
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2299
2321
|
}
|
|
2300
2322
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2301
|
-
if (
|
|
2302
|
-
if (
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
toolbar_1.refreshOverflow();
|
|
2307
|
-
}
|
|
2323
|
+
if (Browser.isDevice) {
|
|
2324
|
+
if (document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
2325
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2326
|
+
var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
|
|
2327
|
+
toolbar_1.refreshOverflow();
|
|
2308
2328
|
}
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2329
|
+
}
|
|
2330
|
+
else {
|
|
2331
|
+
if (document.getElementById(this.element.id + '_toolbar')) {
|
|
2332
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2333
|
+
var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
|
|
2334
|
+
toolbar_2.refreshOverflow();
|
|
2315
2335
|
}
|
|
2316
2336
|
}
|
|
2317
2337
|
var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2318
|
-
this.
|
|
2338
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2319
2339
|
};
|
|
2320
2340
|
/**
|
|
2321
2341
|
* Apply Font style for text.
|
|
@@ -2386,7 +2406,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2386
2406
|
}
|
|
2387
2407
|
var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2388
2408
|
shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
|
|
2389
|
-
this.
|
|
2409
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2390
2410
|
};
|
|
2391
2411
|
/**
|
|
2392
2412
|
* Apply Font size for text.
|
|
@@ -2488,7 +2508,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2488
2508
|
}
|
|
2489
2509
|
var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2490
2510
|
shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
|
|
2491
|
-
this.
|
|
2511
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2492
2512
|
};
|
|
2493
2513
|
/**
|
|
2494
2514
|
* Apply Font color for text.
|
|
@@ -2559,7 +2579,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2559
2579
|
}
|
|
2560
2580
|
var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2561
2581
|
shapeChangedArgs.currentShapeSettings.fillColor = value;
|
|
2562
|
-
this.
|
|
2582
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2563
2583
|
};
|
|
2564
2584
|
/**
|
|
2565
2585
|
* Apply Pen stroke width.
|
|
@@ -2614,7 +2634,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2614
2634
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
2615
2635
|
var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2616
2636
|
shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
2617
|
-
this.
|
|
2637
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2618
2638
|
};
|
|
2619
2639
|
/**
|
|
2620
2640
|
* Apply Pen stroke color.
|
|
@@ -2684,7 +2704,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2684
2704
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
2685
2705
|
var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2686
2706
|
shapeChangedArgs.currentShapeSettings.strokeColor = value;
|
|
2687
|
-
this.
|
|
2707
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2688
2708
|
};
|
|
2689
2709
|
/**
|
|
2690
2710
|
* Apply Shape stroke width.
|
|
@@ -2730,7 +2750,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2730
2750
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2731
2751
|
var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2732
2752
|
shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
2733
|
-
this.
|
|
2753
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2734
2754
|
}
|
|
2735
2755
|
else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
|
|
2736
2756
|
this.activeObj.pointColl.length === 0)) {
|
|
@@ -2787,7 +2807,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2787
2807
|
}
|
|
2788
2808
|
var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2789
2809
|
shapeChangedArgs.currentShapeSettings.strokeColor = value;
|
|
2790
|
-
this.
|
|
2810
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2791
2811
|
};
|
|
2792
2812
|
/**
|
|
2793
2813
|
* Apply Shape fill color.
|
|
@@ -2827,7 +2847,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2827
2847
|
}
|
|
2828
2848
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2829
2849
|
var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2830
|
-
this.
|
|
2850
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2831
2851
|
};
|
|
2832
2852
|
/**
|
|
2833
2853
|
* Apply horizontal flip.
|
|
@@ -2858,9 +2878,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2858
2878
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2859
2879
|
this.objColl.pop();
|
|
2860
2880
|
}
|
|
2861
|
-
|
|
2862
|
-
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2863
|
-
}
|
|
2881
|
+
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2864
2882
|
ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
|
|
2865
2883
|
var activePoint = this.duplicateImage();
|
|
2866
2884
|
this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
@@ -2906,9 +2924,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2906
2924
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2907
2925
|
this.objColl.pop();
|
|
2908
2926
|
}
|
|
2909
|
-
|
|
2910
|
-
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2911
|
-
}
|
|
2927
|
+
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2912
2928
|
ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
|
|
2913
2929
|
var activePoint = this.duplicateImage();
|
|
2914
2930
|
this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
@@ -2952,9 +2968,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2952
2968
|
value: { obj: selPointCollObj } });
|
|
2953
2969
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2954
2970
|
this.objColl.pop();
|
|
2955
|
-
|
|
2956
|
-
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2957
|
-
}
|
|
2971
|
+
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2958
2972
|
if (rotate === 'rotleft') {
|
|
2959
2973
|
this.activeObj.rotatedAngle -= (90 * (Math.PI / 180));
|
|
2960
2974
|
}
|
|
@@ -2971,14 +2985,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2971
2985
|
previousCropObj: prevCropObj, previousText: null,
|
|
2972
2986
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2973
2987
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
this.updateToolbar(this.element, 'quickAccessToolbar', 'image');
|
|
2977
|
-
}
|
|
2978
|
-
else {
|
|
2979
|
-
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
2980
|
-
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
2981
|
-
}
|
|
2988
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
2989
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
2982
2990
|
};
|
|
2983
2991
|
/**
|
|
2984
2992
|
* Get pascalToSplitWords from string.
|
|
@@ -3037,6 +3045,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3037
3045
|
* @returns {void}.
|
|
3038
3046
|
*/
|
|
3039
3047
|
ImageEditor.prototype.transformSelect = function (type) {
|
|
3048
|
+
if (this.transform.straighten === 0 && (type === 'rotateleft' || type === 'rotateright') &&
|
|
3049
|
+
this.activeObj.shape && ['crop-2:3', 'crop-3:2', 'crop-3:4', 'crop-4:3', 'crop-4:5', 'crop-5:4', 'crop-5:7', 'crop-7:5',
|
|
3050
|
+
'crop-9:16', 'crop-16:9'].indexOf(this.activeObj.shape) !== -1) {
|
|
3051
|
+
this.activeObj.shape = 'crop-' + this.activeObj.shape.split('-')[1].split(':')[1] + ':' + this.activeObj.shape.split('-')[1].split(':')[0];
|
|
3052
|
+
this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: this.activeObj.shape, isTransform: true } });
|
|
3053
|
+
}
|
|
3040
3054
|
this.isCropToolbar = true;
|
|
3041
3055
|
this.allowDownScale = false;
|
|
3042
3056
|
var straighten = this.transform.straighten;
|
|
@@ -3133,12 +3147,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3133
3147
|
*/
|
|
3134
3148
|
ImageEditor.prototype.setStraighten = function (value, isMethod) {
|
|
3135
3149
|
var straightenEventArgs = { cancel: false, previousDegree: this.transform.straighten, currentDegree: value };
|
|
3136
|
-
|
|
3137
|
-
this.prevStraightenEvent = this.transform.straighten;
|
|
3138
|
-
}
|
|
3139
|
-
else {
|
|
3140
|
-
this.trigger('rotating', straightenEventArgs);
|
|
3141
|
-
}
|
|
3150
|
+
this.trigger('rotating', straightenEventArgs);
|
|
3142
3151
|
if (!straightenEventArgs.cancel) {
|
|
3143
3152
|
this.performStraighten(straightenEventArgs);
|
|
3144
3153
|
}
|
|
@@ -3263,85 +3272,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3263
3272
|
}
|
|
3264
3273
|
return flipState;
|
|
3265
3274
|
};
|
|
3266
|
-
// Blazor codes
|
|
3267
|
-
/**
|
|
3268
|
-
* To Initialize the component rendering
|
|
3269
|
-
*
|
|
3270
|
-
* @private
|
|
3271
|
-
* @param {HTMLCanvasElement} element - Specifies the canvas element.
|
|
3272
|
-
* @param {BlazorDotnetObject} dotnetRef - Specifies for blazor client to server communication.
|
|
3273
|
-
* @returns {void}
|
|
3274
|
-
*/
|
|
3275
|
-
ImageEditor.prototype.initializeImageEditor = function (element, dotnetRef) {
|
|
3276
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3277
|
-
this.element = element;
|
|
3278
|
-
if (isBlazor() && this.element.querySelector('.place-holder')) {
|
|
3279
|
-
this.element.querySelector('.place-holder').remove();
|
|
3280
|
-
}
|
|
3281
|
-
if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
|
|
3282
|
-
this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
|
|
3283
|
-
this.element.querySelector('.e-ie-drop-content').style.display = 'block';
|
|
3284
|
-
}
|
|
3285
|
-
if (isBlazor() && this.element.querySelector('.e-ie-drop-area')) {
|
|
3286
|
-
this.element.querySelector('.e-ie-drop-area').style.display = 'block';
|
|
3287
|
-
}
|
|
3288
|
-
if (isBlazor() && this.element.querySelector('.e-toolbar-area')) {
|
|
3289
|
-
this.element.querySelector('.e-toolbar-area').style.display = 'block';
|
|
3290
|
-
}
|
|
3291
|
-
var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
3292
|
-
if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
|
|
3293
|
-
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').scrollHeight;
|
|
3294
|
-
}
|
|
3295
|
-
else {
|
|
3296
|
-
this.toolbarHeight = 0;
|
|
3297
|
-
}
|
|
3298
|
-
canvasWrapper.style.height = (this.element.offsetHeight - this.toolbarHeight - 2) + 'px';
|
|
3299
|
-
canvasWrapper.style.width = (this.element.offsetWidth - 2) + 'px';
|
|
3300
|
-
this.lowerCanvas = this.element.querySelector('.e-lower-canvas');
|
|
3301
|
-
this.upperCanvas = this.element.querySelector('.e-upper-canvas');
|
|
3302
|
-
this.lowerCanvas.id = this.element.id + '_lowerCanvas';
|
|
3303
|
-
this.upperCanvas.id = this.element.id + '_upperCanvas';
|
|
3304
|
-
this.textArea = this.element.querySelector('.e-textarea');
|
|
3305
|
-
this.inMemoryCanvas = this.createElement('canvas', {
|
|
3306
|
-
id: this.element.id + '_inMemoryCanvas', attrs: { name: 'canvasImage' }
|
|
3307
|
-
});
|
|
3308
|
-
this.baseImgCanvas = this.createElement('canvas', {
|
|
3309
|
-
id: this.element.id + '_baseImgCanvas', attrs: { name: 'canvasImage' }
|
|
3310
|
-
});
|
|
3311
|
-
this.upperCanvas.width = this.lowerCanvas.width = this.inMemoryCanvas.width = this.element.offsetWidth;
|
|
3312
|
-
this.upperCanvas.height = this.lowerCanvas.height = this.inMemoryCanvas.height = (this.element.offsetHeight - this.toolbarHeight);
|
|
3313
|
-
this.lowerContext = this.lowerCanvas.getContext('2d');
|
|
3314
|
-
this.baseImg = this.createElement('img', {
|
|
3315
|
-
id: this.element.id + '_orgImg', attrs: { name: 'Image', crossorigin: 'anonymous' }
|
|
3316
|
-
});
|
|
3317
|
-
this.upperContext = this.upperCanvas.getContext('2d');
|
|
3318
|
-
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
3319
|
-
if (dotnetRef) {
|
|
3320
|
-
this.dotNetRef = dotnetRef;
|
|
3321
|
-
}
|
|
3322
|
-
this.prerender();
|
|
3323
|
-
this.wireEvent();
|
|
3324
|
-
this.lowerContext.filter = this.getDefaultFilter();
|
|
3325
|
-
this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
3326
|
-
this.canvasFilter = this.initialAdjustmentValue = this.lowerContext.filter;
|
|
3327
|
-
if (this.cssClass) {
|
|
3328
|
-
addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
|
|
3329
|
-
}
|
|
3330
|
-
if (this.element) {
|
|
3331
|
-
createSpinner({
|
|
3332
|
-
target: this.element
|
|
3333
|
-
});
|
|
3334
|
-
}
|
|
3335
|
-
this.initializeZoomSettings();
|
|
3336
|
-
};
|
|
3337
|
-
ImageEditor.prototype.prerender = function () {
|
|
3338
|
-
// pre render code snippets
|
|
3339
|
-
this.element.id = this.element.id || getUniqueID('ej2-image-editor');
|
|
3340
|
-
if (Browser.isDevice) {
|
|
3341
|
-
this.element.classList.add('e-device');
|
|
3342
|
-
}
|
|
3343
|
-
this.initializeThemeColl();
|
|
3344
|
-
};
|
|
3345
3275
|
ImageEditor.prototype.initializeZoomSettings = function () {
|
|
3346
3276
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3347
3277
|
if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
|
|
@@ -3374,57 +3304,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3374
3304
|
Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' }
|
|
3375
3305
|
};
|
|
3376
3306
|
};
|
|
3377
|
-
/**
|
|
3378
|
-
* Get the square point for path.
|
|
3379
|
-
*
|
|
3380
|
-
* @param { HTMLDivElement } element - Specifies element.
|
|
3381
|
-
* @param { string } type - Specifies the type.
|
|
3382
|
-
* @param { string } value - Specifies the value.
|
|
3383
|
-
* @hidden
|
|
3384
|
-
* @private
|
|
3385
|
-
* @returns {void}.
|
|
3386
|
-
*/
|
|
3387
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
3388
|
-
ImageEditor.prototype.updateToolbar = function (element, type, value) {
|
|
3389
|
-
};
|
|
3390
|
-
/**
|
|
3391
|
-
* Trigger the shapeChanging event for after the shape applied.
|
|
3392
|
-
*
|
|
3393
|
-
* @param { ShapeChangeEventArgs } shapeChangedArgs - Specifies the shapeChaning event args.
|
|
3394
|
-
* @hidden
|
|
3395
|
-
* @returns {void}.
|
|
3396
|
-
*/
|
|
3397
|
-
ImageEditor.prototype.triggerShapeChanged = function (shapeChangedArgs) {
|
|
3398
|
-
if (isBlazor() && this.events && this.events.shapeChanged.hasDelegate === true) {
|
|
3399
|
-
var args = { action: shapeChangedArgs.action, shapeSettings: shapeChangedArgs.currentShapeSettings };
|
|
3400
|
-
this.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'ShapeChanged', null, args);
|
|
3401
|
-
}
|
|
3402
|
-
else {
|
|
3403
|
-
this.trigger('shapeChange', shapeChangedArgs);
|
|
3404
|
-
}
|
|
3405
|
-
};
|
|
3406
|
-
ImageEditor.prototype.triggerActionComplete = function () {
|
|
3407
|
-
var frameChangedArgs = this.curFrameObjEvent;
|
|
3408
|
-
var finetuneValueChanged = this.curFinetuneObjEvent;
|
|
3409
|
-
var imageFiltered = this.curFilterObjEvent;
|
|
3410
|
-
if (isBlazor()) {
|
|
3411
|
-
if (this.isFrameBtnClick && this.events && this.events.frameChanged.hasDelegate === true) {
|
|
3412
|
-
var frameChangeArgs = { frameSettings: frameChangedArgs.currentFrameSetting };
|
|
3413
|
-
this.dotNetRef.invokeMethodAsync('OnFrameChangingAsync', 'FrameChanged', null, frameChangeArgs);
|
|
3414
|
-
}
|
|
3415
|
-
if (this.isFinetuneBtnClick && this.events && this.events.finetuneValueChanged.hasDelegate === true) {
|
|
3416
|
-
var finetuneValueChange = { finetune: this.toPascalCase(finetuneValueChanged.finetune),
|
|
3417
|
-
value: parseInt(finetuneValueChanged.value.toString()) };
|
|
3418
|
-
this.dotNetRef.invokeMethodAsync('OnFinetuneValueChangeAsync', 'FinetuneValueChanged', null, finetuneValueChange);
|
|
3419
|
-
}
|
|
3420
|
-
if (this.isFilterCanvasClick && this.events && this.events.imageFiltered.hasDelegate === true) {
|
|
3421
|
-
var imageFilter = { filter: this.toPascalCase(imageFiltered.filter) };
|
|
3422
|
-
this.dotNetRef.invokeMethodAsync('OnImageFilterEventAsync', 'ImageFiltered', null, imageFilter);
|
|
3423
|
-
}
|
|
3424
|
-
}
|
|
3425
|
-
else { }
|
|
3426
|
-
this.isFilterCanvasClick = this.isFinetuneBtnClick = this.isFrameBtnClick = false;
|
|
3427
|
-
};
|
|
3428
3307
|
var ImageEditor_1;
|
|
3429
3308
|
__decorate([
|
|
3430
3309
|
Property('')
|