@syncfusion/ej2-image-editor 24.2.8 → 25.1.37
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 +5 -45
- 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 +958 -1922
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +993 -1974
- 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 +133 -242
- package/src/image-editor/action/transform.d.ts +0 -1
- package/src/image-editor/action/transform.js +80 -291
- package/src/image-editor/action/undo-redo.d.ts +0 -1
- package/src/image-editor/action/undo-redo.js +32 -127
- 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 +316 -425
- package/src/image-editor/renderer/toolbar.d.ts +1 -0
- package/src/image-editor/renderer/toolbar.js +228 -207
- 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 +5 -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 +5 -25
- package/styles/image-editor/material3.css +5 -25
- package/styles/image-editor/tailwind-dark.css +2 -14
- package/styles/image-editor/tailwind.css +2 -14
- package/styles/material-dark.css +0 -12
- package/styles/material.css +0 -12
- package/styles/material3-dark.css +5 -25
- package/styles/material3.css +5 -25
- package/styles/tailwind-dark.css +2 -14
- package/styles/tailwind.css +2 -14
|
@@ -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
|
};
|
|
@@ -608,7 +539,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
608
539
|
ImageEditor.prototype.createDropUploader = function () {
|
|
609
540
|
var _this = this;
|
|
610
541
|
var uploadObj = new Uploader({
|
|
611
|
-
dropArea:
|
|
542
|
+
dropArea: this.element.getElementsByClassName('e-canvas-wrapper')[0],
|
|
612
543
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
613
544
|
multiple: false,
|
|
614
545
|
selected: function (args) {
|
|
@@ -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',
|
|
@@ -891,7 +825,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
891
825
|
ImageEditor.prototype.notifyResetForAllModules = function () {
|
|
892
826
|
var modules = this.requiredModules();
|
|
893
827
|
for (var i = 0; i < modules.length; i++) {
|
|
894
|
-
|
|
828
|
+
var module = modules[i].member;
|
|
829
|
+
this.notify(module === 'toolbar-module' ? 'toolbar' : module, { prop: 'reset', onPropertyChange: false });
|
|
895
830
|
}
|
|
896
831
|
};
|
|
897
832
|
ImageEditor.prototype.allowShape = function (x, y) {
|
|
@@ -904,10 +839,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
904
839
|
/**
|
|
905
840
|
* Clears the current selection performed in the image editor.
|
|
906
841
|
*
|
|
842
|
+
* @param { boolean } resetCrop - Specifies to reset last cropped image.
|
|
843
|
+
*
|
|
907
844
|
* @returns {void}.
|
|
908
845
|
*/
|
|
909
|
-
ImageEditor.prototype.clearSelection = function () {
|
|
910
|
-
this.notify('selection', { prop: 'clearSelection', onPropertyChange: false });
|
|
846
|
+
ImageEditor.prototype.clearSelection = function (resetCrop) {
|
|
847
|
+
this.notify('selection', { prop: 'clearSelection', onPropertyChange: false, value: { resetCrop: resetCrop } });
|
|
911
848
|
};
|
|
912
849
|
/**
|
|
913
850
|
* Crops an image based on the selection done in the image editor.
|
|
@@ -955,7 +892,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
955
892
|
*/
|
|
956
893
|
ImageEditor.prototype.getImageData = function () {
|
|
957
894
|
var obj = { canvas: null };
|
|
958
|
-
|
|
895
|
+
var dummyObj = { bool: false };
|
|
896
|
+
this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: dummyObj } });
|
|
897
|
+
if (dummyObj['bool'] || this.togglePen || this.activeObj.shape) {
|
|
959
898
|
this.okBtn();
|
|
960
899
|
}
|
|
961
900
|
this.notify('export', { prop: 'exportToCanvas', value: { object: obj } });
|
|
@@ -994,13 +933,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
994
933
|
this.clearContext(this.lowerContext);
|
|
995
934
|
this.clearContext(this.upperContext);
|
|
996
935
|
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
|
|
1003
|
-
}
|
|
936
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
937
|
+
isApplyBtn: false, isCropping: false, isZooming: null, cType: null } });
|
|
938
|
+
if (Browser.isDevice && document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
939
|
+
getComponent(document.getElementById(this.element.id + '_bottomToolbar'), 'toolbar').destroy();
|
|
940
|
+
this.notify('toolbar', { prop: 'create-bottom-toolbar', onPropertyChange: false });
|
|
1004
941
|
}
|
|
1005
942
|
var isImageLoaded = this.isImageLoaded;
|
|
1006
943
|
this.currObjType.isUndoAction = this.isUndoRedo = this.togglePan = this.togglePen = this.isImageLoaded = this.isFinetuning = false;
|
|
@@ -1065,36 +1002,28 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1065
1002
|
}
|
|
1066
1003
|
this.notifyResetForAllModules();
|
|
1067
1004
|
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 } });
|
|
1005
|
+
if (this.toolbarTemplate) {
|
|
1006
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
1007
|
+
}
|
|
1008
|
+
else if (this.element.querySelector('#' + this.element.id + '_toolbar')) {
|
|
1009
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbar').clientHeight;
|
|
1076
1010
|
}
|
|
1011
|
+
this.notify('toolbar', { prop: 'setToolbarHeight', value: { height: this.toolbarHeight } });
|
|
1077
1012
|
this.isImageLoaded = isImageLoaded;
|
|
1078
1013
|
this.straightenBaseImageCanvas();
|
|
1079
1014
|
this.isImageLoaded = false;
|
|
1080
1015
|
this.notify('draw', { prop: 'update-canvas', onPropertyChange: false });
|
|
1081
1016
|
this.isImageLoaded = isImageLoaded;
|
|
1082
1017
|
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
|
-
}
|
|
1018
|
+
var ctWrapper = this.element.querySelector('.e-contextual-toolbar-wrapper');
|
|
1019
|
+
if (ctWrapper) {
|
|
1020
|
+
ctWrapper.classList.add('e-hide');
|
|
1094
1021
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1022
|
+
this.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
1023
|
+
this.notify('toolbar', { prop: 'enable-disable-btns' });
|
|
1024
|
+
var straightenObj = { bool: this.isStraightening };
|
|
1025
|
+
if (Browser.isDevice && straightenObj['bool']) {
|
|
1026
|
+
this.notify('crop', { prop: 'resizeWrapper' });
|
|
1098
1027
|
}
|
|
1099
1028
|
}
|
|
1100
1029
|
};
|
|
@@ -1114,9 +1043,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1114
1043
|
*/
|
|
1115
1044
|
ImageEditor.prototype.rotate = function (degree) {
|
|
1116
1045
|
var obj = { isRotate: false };
|
|
1046
|
+
if (degree === 90 || degree === -90) {
|
|
1047
|
+
this.updateImageTransformColl(degree === 90 ? 'rotateright' : 'rotateleft');
|
|
1048
|
+
}
|
|
1117
1049
|
this.notify('transform', { prop: 'rotate', value: { degree: degree, obj: obj } });
|
|
1118
1050
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1119
|
-
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1120
1051
|
return obj['isRotate'];
|
|
1121
1052
|
};
|
|
1122
1053
|
/**
|
|
@@ -1154,8 +1085,20 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1154
1085
|
this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
|
|
1155
1086
|
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
1156
1087
|
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
1157
|
-
|
|
1158
|
-
|
|
1088
|
+
if ((startX && startY) || (width && height)) {
|
|
1089
|
+
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
1090
|
+
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
1094
|
+
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
1095
|
+
rotateFlipColl: [], degree: 0, currFlipState: '', straighten: 0, zoomFactor: 0, previousZoomValue: 0,
|
|
1096
|
+
destPoints: { startX: 0, startY: 0, width: 0, height: 0 }, frame: 'none',
|
|
1097
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
|
|
1098
|
+
aspectWidth: null, aspectHeight: null, straightenZoom: 0,
|
|
1099
|
+
adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
|
|
1100
|
+
exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
|
|
1101
|
+
}
|
|
1159
1102
|
};
|
|
1160
1103
|
/**
|
|
1161
1104
|
* Enable or disable a freehand drawing option in an Image Editor.
|
|
@@ -1227,16 +1170,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1227
1170
|
* @param {string} strokeColor - Specifies the stroke color of ellipse.
|
|
1228
1171
|
* @param {string} fillColor - Specifies the fill color of the ellipse.
|
|
1229
1172
|
* @param {number} degree - Specifies the degree to rotate the ellipse.
|
|
1173
|
+
* @param {boolean} isSelected - Specifies to show the ellipse in the selected state.
|
|
1230
1174
|
* @returns {boolean}.
|
|
1231
1175
|
*
|
|
1232
1176
|
*/
|
|
1233
|
-
ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
|
|
1177
|
+
ImageEditor.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
|
|
1234
1178
|
var isEllipse = false;
|
|
1235
1179
|
var isPointsInRange = this.allowShape(x, y);
|
|
1236
1180
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1237
1181
|
isEllipse = true;
|
|
1238
1182
|
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 } });
|
|
1183
|
+
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
|
|
1240
1184
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1241
1185
|
}
|
|
1242
1186
|
return isEllipse;
|
|
@@ -1250,15 +1194,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1250
1194
|
* @param {number} endY - Specifies end point y-coordinates of the line.
|
|
1251
1195
|
* @param {number} strokeWidth - Specifies the stroke width of line.
|
|
1252
1196
|
* @param {string} strokeColor - Specifies the stroke color of line.
|
|
1197
|
+
* @param {boolean} isSelected - Specifies to show the line in the selected state.
|
|
1253
1198
|
* @returns {boolean}.
|
|
1254
1199
|
*/
|
|
1255
|
-
ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
1200
|
+
ImageEditor.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor, isSelected) {
|
|
1256
1201
|
var isLine = false;
|
|
1257
1202
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
1258
1203
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
1259
1204
|
isLine = true;
|
|
1260
1205
|
this.notify('shape', { prop: 'drawLine', onPropertyChange: false, value: { startX: startX, startY: startY, endX: endX,
|
|
1261
|
-
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
1206
|
+
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
|
|
1262
1207
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1263
1208
|
}
|
|
1264
1209
|
return isLine;
|
|
@@ -1274,15 +1219,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1274
1219
|
* @param {string} strokeColor - Specifies the stroke color of arrow.
|
|
1275
1220
|
* @param {ArrowheadType} arrowStart – Specifies the type of arrowhead for start position. The default value is ‘None’.
|
|
1276
1221
|
* @param {ArrowheadType} arrowEnd – Specifies the type of arrowhead for end position. The default value is ‘SolidArrow’.
|
|
1222
|
+
* @param {boolean} isSelected - Specifies to show the arrow in the selected state.
|
|
1277
1223
|
* @returns {boolean}.
|
|
1278
1224
|
*/
|
|
1279
|
-
ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd) {
|
|
1225
|
+
ImageEditor.prototype.drawArrow = function (startX, startY, endX, endY, strokeWidth, strokeColor, arrowStart, arrowEnd, isSelected) {
|
|
1280
1226
|
var isArrow = false;
|
|
1281
1227
|
var isPointsInRange = this.allowShape(startX, startY);
|
|
1282
1228
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(startX) && isNullOrUndefined(startY)))) {
|
|
1283
1229
|
isArrow = true;
|
|
1284
1230
|
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
|
|
1231
|
+
endY: endY, strokeWidth: strokeWidth, strokeColor: strokeColor, arrowStart: arrowStart, arrowEnd: arrowEnd,
|
|
1232
|
+
isSelected: isSelected } });
|
|
1286
1233
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1287
1234
|
}
|
|
1288
1235
|
return isArrow;
|
|
@@ -1293,9 +1240,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1293
1240
|
* @param {Point[]} pointColl – Specifies collection of start and end x, y-coordinates of path.
|
|
1294
1241
|
* @param {number} strokeWidth - Specifies the stroke width of path.
|
|
1295
1242
|
* @param {string} strokeColor - Specifies the stroke color of path.
|
|
1243
|
+
* @param {boolean} isSelected - Specifies to show the path in the selected state.
|
|
1296
1244
|
* @returns {boolean}.
|
|
1297
1245
|
*/
|
|
1298
|
-
ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor,
|
|
1246
|
+
ImageEditor.prototype.drawPath = function (pointColl, strokeWidth, strokeColor, isSelected) {
|
|
1299
1247
|
this.isPublicMethod = true;
|
|
1300
1248
|
var obj = { inRange: false };
|
|
1301
1249
|
var isPath = false;
|
|
@@ -1311,7 +1259,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1311
1259
|
if (!this.disabled && this.isImageLoaded && (obj['inRange'] || isNullOrUndefined(pointColl))) {
|
|
1312
1260
|
isPath = true;
|
|
1313
1261
|
this.notify('shape', { prop: 'drawPath', onPropertyChange: false, value: { pointColl: pointColl,
|
|
1314
|
-
strokeWidth: strokeWidth, strokeColor: strokeColor } });
|
|
1262
|
+
strokeWidth: strokeWidth, strokeColor: strokeColor, isSelected: isSelected } });
|
|
1315
1263
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1316
1264
|
}
|
|
1317
1265
|
return isPath;
|
|
@@ -1327,15 +1275,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1327
1275
|
* @param {string} strokeColor - Specifies the stroke color of rectangle.
|
|
1328
1276
|
* @param {string} fillColor - Specifies the fill color of the rectangle.
|
|
1329
1277
|
* @param {number} degree - Specifies the degree to rotate the rectangle.
|
|
1278
|
+
* @param {boolean} isSelected - Specifies to show the rectangle in the selected state.
|
|
1330
1279
|
* @returns {boolean}.
|
|
1331
1280
|
*/
|
|
1332
|
-
ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
|
|
1281
|
+
ImageEditor.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree, isSelected) {
|
|
1333
1282
|
var isRectangle = false;
|
|
1334
1283
|
var isPointsInRange = this.allowShape(x, y);
|
|
1335
1284
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1336
1285
|
isRectangle = true;
|
|
1337
1286
|
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 } });
|
|
1287
|
+
strokeWidth: strokeWidth, strokeColor: strokeColor, fillColor: fillColor, degree: degree, isSelected: isSelected } });
|
|
1339
1288
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1340
1289
|
}
|
|
1341
1290
|
return isRectangle;
|
|
@@ -1353,16 +1302,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1353
1302
|
* @param {boolean} bold - Specifies whether the text is bold or not.
|
|
1354
1303
|
* @param {boolean} italic - Specifies whether the text is italic or not.
|
|
1355
1304
|
* @param {string} color - Specifies font color of the text.
|
|
1305
|
+
* @param {boolean} isSelected - Specifies to show the text in the selected state.
|
|
1356
1306
|
* @returns {boolean}.
|
|
1357
1307
|
*
|
|
1358
1308
|
*/
|
|
1359
|
-
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
1309
|
+
ImageEditor.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
|
|
1360
1310
|
var isText = false;
|
|
1361
1311
|
var isPointsInRange = this.allowShape(x, y);
|
|
1362
1312
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1363
1313
|
isText = true;
|
|
1364
1314
|
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 } });
|
|
1315
|
+
fontSize: fontSize, bold: bold, italic: italic, color: color, isSelected: isSelected } });
|
|
1366
1316
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1367
1317
|
}
|
|
1368
1318
|
return isText;
|
|
@@ -1379,16 +1329,17 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1379
1329
|
* @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
|
|
1380
1330
|
* @param {number} degree - Specifies the degree to rotate the image.
|
|
1381
1331
|
* @param {number} opacity - Specifies the value for the image.
|
|
1332
|
+
* @param {boolean} isSelected - Specifies to show the image in the selected state.
|
|
1382
1333
|
* @returns {boolean}.
|
|
1383
1334
|
*
|
|
1384
1335
|
*/
|
|
1385
|
-
ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity) {
|
|
1336
|
+
ImageEditor.prototype.drawImage = function (data, x, y, width, height, isAspectRatio, degree, opacity, isSelected) {
|
|
1386
1337
|
var isImage = false;
|
|
1387
1338
|
var isPointsInRange = this.allowShape(x, y);
|
|
1388
1339
|
if (!this.disabled && this.isImageLoaded && (isPointsInRange || (isNullOrUndefined(x) && isNullOrUndefined(y)))) {
|
|
1389
1340
|
var length_1 = this.objColl.length;
|
|
1390
1341
|
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 } });
|
|
1342
|
+
src: data, degree: degree, isAspectRatio: isAspectRatio, opacity: opacity, isSelected: isSelected } });
|
|
1392
1343
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1393
1344
|
if (this.objColl.length > length_1) {
|
|
1394
1345
|
isImage = true;
|
|
@@ -1436,10 +1387,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1436
1387
|
*
|
|
1437
1388
|
*/
|
|
1438
1389
|
ImageEditor.prototype.getShapeSetting = function (id) {
|
|
1439
|
-
var
|
|
1390
|
+
var obj = { shapeDetails: null };
|
|
1440
1391
|
this.notify('shape', { prop: 'getShapeSetting', onPropertyChange: false,
|
|
1441
|
-
value: { id: id, obj:
|
|
1392
|
+
value: { id: id, obj: obj } });
|
|
1442
1393
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1394
|
+
var shapeDetails = obj['shapeDetails'] ? obj['shapeDetails'] : {};
|
|
1443
1395
|
return shapeDetails;
|
|
1444
1396
|
};
|
|
1445
1397
|
/**
|
|
@@ -1543,28 +1495,23 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1543
1495
|
if ((width.toString()).length <= 4 && (height.toString()).length <= 4) {
|
|
1544
1496
|
var destPoints = { startX: this.img.destLeft, startY: this.img.destTop, width: this.img.destWidth,
|
|
1545
1497
|
height: this.img.destHeight };
|
|
1546
|
-
if (
|
|
1547
|
-
this.
|
|
1498
|
+
if (isAspectRatio) {
|
|
1499
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
|
|
1500
|
+
isApplyBtn: false, isCropping: false } });
|
|
1501
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
|
|
1502
|
+
isApplyBtn: false, isCropping: false } });
|
|
1548
1503
|
}
|
|
1549
1504
|
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
|
-
}
|
|
1505
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'resize',
|
|
1506
|
+
isApplyBtn: false, isCropping: false } });
|
|
1507
|
+
}
|
|
1508
|
+
var aspectRatioWidth = this.element.querySelector('#' + this.element.id + '_resizeWidth');
|
|
1509
|
+
var aspectRatioHeight = this.element.querySelector('#' + this.element.id + '_resizeHeight');
|
|
1510
|
+
if (aspectRatioWidth && aspectRatioHeight) {
|
|
1511
|
+
getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(width);
|
|
1512
|
+
aspectRatioWidth.value = Math.floor(width).toString() + ' px';
|
|
1513
|
+
getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(height);
|
|
1514
|
+
aspectRatioHeight.value = Math.floor(height).toString() + ' px';
|
|
1568
1515
|
}
|
|
1569
1516
|
this.notify('transform', { prop: 'resize', value: { width: width, height: height, isAspectRatio: isAspectRatio } });
|
|
1570
1517
|
if (destPoints.startX !== this.img.destLeft || destPoints.startY !== this.img.destTop ||
|
|
@@ -1612,13 +1559,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1612
1559
|
extend(this.tempFrameObj, this.frameObj);
|
|
1613
1560
|
this.tempFrameZoomLevel = this.transform.zoomFactor;
|
|
1614
1561
|
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
|
-
}
|
|
1562
|
+
this.notify('toolbar', { prop: 'frameToolbarClick' });
|
|
1622
1563
|
this.frameObj.type = frameType.toLowerCase();
|
|
1623
1564
|
this.frameObj.color = color;
|
|
1624
1565
|
this.frameObj.gradientColor = gradientColor;
|
|
@@ -1673,22 +1614,76 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1673
1614
|
* {% codeBlock src='image-editor/updateShape/index.md' %}{% endcodeBlock %}
|
|
1674
1615
|
*
|
|
1675
1616
|
* @param {ShapeSettings} setting - Specifies the shape settings to be updated for the shape on an image.
|
|
1617
|
+
* @param {boolean} isSelected - Specifies to show the shape in the selected state.
|
|
1676
1618
|
* @returns {boolean}.
|
|
1677
1619
|
*
|
|
1678
1620
|
*/
|
|
1679
|
-
ImageEditor.prototype.updateShape = function (setting) {
|
|
1621
|
+
ImageEditor.prototype.updateShape = function (setting, isSelected) {
|
|
1680
1622
|
var obj = { isSelected: false };
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1623
|
+
var isTextArea = false;
|
|
1624
|
+
var freehandObj = { bool: false };
|
|
1625
|
+
if (isNullOrUndefined(setting.id)) {
|
|
1626
|
+
if (setting.strokeColor) {
|
|
1627
|
+
this.activeObj.strokeSettings.strokeColor = setting.strokeColor;
|
|
1628
|
+
}
|
|
1629
|
+
if (setting.fillColor) {
|
|
1630
|
+
this.activeObj.strokeSettings.fillColor = setting.fillColor;
|
|
1631
|
+
}
|
|
1632
|
+
if (setting.strokeWidth) {
|
|
1633
|
+
this.activeObj.strokeSettings.strokeWidth = setting.strokeWidth;
|
|
1634
|
+
}
|
|
1635
|
+
if (setting.type === 'FreehandDraw' && setting.strokeWidth) {
|
|
1636
|
+
this.notify('freehand-draw', { prop: 'setPenStrokeWidth', onPropertyChange: false, value: { value: setting.strokeWidth } });
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
else {
|
|
1640
|
+
if (setting.type.toLowerCase() === 'text' && (this.textArea.style.display === 'block' ||
|
|
1641
|
+
this.textArea.style.display === 'inline-block')) {
|
|
1642
|
+
this.okBtn();
|
|
1643
|
+
isTextArea = true;
|
|
1644
|
+
}
|
|
1645
|
+
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: setting.id, obj: obj } });
|
|
1646
|
+
this.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: freehandObj } });
|
|
1647
|
+
if (obj['isSelected']) {
|
|
1648
|
+
var tempFontSize = this.activeObj.textSettings.fontSize;
|
|
1649
|
+
this.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1650
|
+
value: { shapeSettings: setting } });
|
|
1651
|
+
if (this.activeObj.shape === 'text' && tempFontSize) {
|
|
1652
|
+
var diff = this.activeObj.textSettings.fontSize - tempFontSize;
|
|
1653
|
+
if (diff !== 0) {
|
|
1654
|
+
this.activeObj.activePoint.height += diff;
|
|
1655
|
+
this.activeObj.activePoint.startY -= (diff / 2);
|
|
1656
|
+
this.activeObj.activePoint.endY += (diff / 2);
|
|
1657
|
+
this.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: this.activeObj.activePoint, obj: this.activeObj,
|
|
1658
|
+
isMouseMove: null, x: null, y: null } });
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
1662
|
+
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1663
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: null } });
|
|
1664
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1665
|
+
if (activeObj.shape) {
|
|
1666
|
+
this.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
1667
|
+
}
|
|
1668
|
+
if (this.activeObj.shape === 'text') {
|
|
1669
|
+
this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
|
|
1670
|
+
}
|
|
1671
|
+
if (freehandObj['bool']) {
|
|
1672
|
+
this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
|
|
1673
|
+
}
|
|
1674
|
+
this.okBtn(isSelected);
|
|
1675
|
+
if (freehandObj['bool']) {
|
|
1676
|
+
this.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
|
|
1677
|
+
}
|
|
1678
|
+
this.upperContext.clearRect(0, 0, this.upperCanvas.width, this.upperCanvas.height);
|
|
1679
|
+
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1680
|
+
if (isTextArea) {
|
|
1681
|
+
this.enableTextEditing();
|
|
1682
|
+
}
|
|
1683
|
+
if (isSelected) {
|
|
1684
|
+
this.selectShape(setting.id);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1692
1687
|
}
|
|
1693
1688
|
return obj['isSelected'];
|
|
1694
1689
|
};
|
|
@@ -1705,19 +1700,80 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1705
1700
|
if (shapeId.split('_')[0] === 'shape') {
|
|
1706
1701
|
this.notify('shape', { prop: 'selectShape', onPropertyChange: false, value: { id: shapeId, obj: obj } });
|
|
1707
1702
|
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
|
-
}
|
|
1703
|
+
this.notify('toolbar', { prop: 'duplicateShape', onPropertyChange: false, value: { isPreventUndoRedo: false } });
|
|
1715
1704
|
this.okBtn();
|
|
1716
1705
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
1717
1706
|
}
|
|
1718
1707
|
}
|
|
1719
1708
|
return obj['isSelected'];
|
|
1720
1709
|
};
|
|
1710
|
+
/**
|
|
1711
|
+
* Update filter to the canvas in the ImageEditor.
|
|
1712
|
+
*
|
|
1713
|
+
* @param {ImageFilterOption } filterOption - Specifies the filter options to the image.
|
|
1714
|
+
*
|
|
1715
|
+
* @returns {string}.
|
|
1716
|
+
*
|
|
1717
|
+
*/
|
|
1718
|
+
ImageEditor.prototype.getImageFilter = function (filterOption) {
|
|
1719
|
+
var canvas = this.createElement('canvas');
|
|
1720
|
+
var ctx = canvas.getContext('2d');
|
|
1721
|
+
this.notify('filter', { prop: 'updateAdj', value: { type: filterOption.toLowerCase(), value: null, isPreview: true, ctx: ctx } });
|
|
1722
|
+
return ctx.filter;
|
|
1723
|
+
};
|
|
1724
|
+
/**
|
|
1725
|
+
* Enable text area editing in the ImageEditor.
|
|
1726
|
+
*
|
|
1727
|
+
* @returns {void}.
|
|
1728
|
+
*
|
|
1729
|
+
*/
|
|
1730
|
+
ImageEditor.prototype.enableTextEditing = function () {
|
|
1731
|
+
var activeObj = extend({}, this.activeObj, {}, true);
|
|
1732
|
+
this.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1733
|
+
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: false } });
|
|
1734
|
+
this.activeObj = activeObj;
|
|
1735
|
+
this.notify('toolbar', { prop: 'editText', onPropertyChange: false });
|
|
1736
|
+
};
|
|
1737
|
+
/**
|
|
1738
|
+
* Specifies if it's possible to undo the last recent action made in an Image Editor.
|
|
1739
|
+
*
|
|
1740
|
+
* @returns {boolean}.
|
|
1741
|
+
*
|
|
1742
|
+
*/
|
|
1743
|
+
ImageEditor.prototype.canUndo = function () {
|
|
1744
|
+
var canUndo = false;
|
|
1745
|
+
var object = this.getUndoRedoColl();
|
|
1746
|
+
var undoRedoIndex = object['index'];
|
|
1747
|
+
if (undoRedoIndex > 0) {
|
|
1748
|
+
canUndo = true;
|
|
1749
|
+
}
|
|
1750
|
+
return canUndo;
|
|
1751
|
+
};
|
|
1752
|
+
/**
|
|
1753
|
+
* Specifies if it's possible to redo the last recent action made in an Image Editor.
|
|
1754
|
+
*
|
|
1755
|
+
* @returns {boolean}.
|
|
1756
|
+
*
|
|
1757
|
+
*/
|
|
1758
|
+
ImageEditor.prototype.canRedo = function () {
|
|
1759
|
+
var canRedo = false;
|
|
1760
|
+
var object = this.getUndoRedoColl();
|
|
1761
|
+
var undoRedoColl = object['undoRedoColl'];
|
|
1762
|
+
var undoRedoIndex = object['index'];
|
|
1763
|
+
if (undoRedoColl && undoRedoColl.length > 0 && undoRedoIndex < undoRedoColl.length - 1) {
|
|
1764
|
+
canRedo = true;
|
|
1765
|
+
}
|
|
1766
|
+
if (undoRedoIndex === undoRedoColl.length) {
|
|
1767
|
+
canRedo = false;
|
|
1768
|
+
}
|
|
1769
|
+
else if (undoRedoIndex === 0 && undoRedoColl.length > 0) {
|
|
1770
|
+
canRedo = true;
|
|
1771
|
+
}
|
|
1772
|
+
else if (undoRedoIndex > 0) {
|
|
1773
|
+
canRedo = true;
|
|
1774
|
+
}
|
|
1775
|
+
return canRedo;
|
|
1776
|
+
};
|
|
1721
1777
|
// Toolbar related codes
|
|
1722
1778
|
ImageEditor.prototype.toolbarTemplateFn = function () {
|
|
1723
1779
|
var template;
|
|
@@ -1801,6 +1857,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1801
1857
|
this.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
|
|
1802
1858
|
this.notify('freehand-draw', { prop: 'color-change', value: { color: obj['tempFreeHandDrawEditingStyles'].strokeColor } });
|
|
1803
1859
|
};
|
|
1860
|
+
ImageEditor.prototype.getUndoRedoColl = function () {
|
|
1861
|
+
var obj = { undoRedoColl: null, index: null };
|
|
1862
|
+
var undoRedoObj = { undoRedoStep: null };
|
|
1863
|
+
var object = { appliedUndoRedoColl: [] };
|
|
1864
|
+
this.notify('undo-redo', { prop: 'getAppliedUndoRedoColl', value: { obj: object } });
|
|
1865
|
+
this.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
1866
|
+
obj['undoRedoColl'] = object['appliedUndoRedoColl'];
|
|
1867
|
+
obj['index'] = undoRedoObj['undoRedoStep'];
|
|
1868
|
+
return obj;
|
|
1869
|
+
};
|
|
1804
1870
|
ImageEditor.prototype.updateImageTransformColl = function (type) {
|
|
1805
1871
|
var value;
|
|
1806
1872
|
if (type === 'rotateleft') {
|
|
@@ -1944,10 +2010,9 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1944
2010
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
1945
2011
|
}
|
|
1946
2012
|
var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
1947
|
-
this.
|
|
2013
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
1948
2014
|
}
|
|
1949
|
-
|
|
1950
|
-
if (aspectIcon || nonAspectIcon || (isBlazor() && this.currentToolbar === 'resize-toolbar')) {
|
|
2015
|
+
if (aspectIcon || nonAspectIcon) {
|
|
1951
2016
|
var obj_2 = { width: null, height: null };
|
|
1952
2017
|
this.notify('selection', { prop: 'getNumTextValue', onPropertyChange: false, value: { obj: obj_2 } });
|
|
1953
2018
|
var point = { x: obj_2['width'], y: obj_2['height'] };
|
|
@@ -1981,7 +2046,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1981
2046
|
isCircleCrop: null } });
|
|
1982
2047
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
1983
2048
|
var obj_3 = this.cancelCropSelection;
|
|
1984
|
-
if ((
|
|
2049
|
+
if ((obj_3 && (isNullOrUndefined(nonAspectIcon) || !nonAspectIcon))) {
|
|
1985
2050
|
obj_3.previousObj.aspectWidth = obj_3.currentObj.aspectWidth = this.aspectWidth;
|
|
1986
2051
|
obj_3.previousObj.aspectHeight = obj_3.currentObj.aspectHeight = this.aspectHeight;
|
|
1987
2052
|
obj_3.previousCropObj = extend({}, this.cropObj, {}, true);
|
|
@@ -2035,9 +2100,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2035
2100
|
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
2036
2101
|
this.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
2037
2102
|
}
|
|
2038
|
-
else if (
|
|
2039
|
-
(isBlazor() && !this.element.querySelector('.e-ie-contextual-slider').classList.contains('e-hidden')) ||
|
|
2040
|
-
this.currObjType.isFiltered) {
|
|
2103
|
+
else if (document.querySelector('#' + this.element.id + '_sliderWrapper') || this.currObjType.isFiltered) {
|
|
2041
2104
|
this.initialAdjustmentValue = this.canvasFilter = this.lowerContext.filter;
|
|
2042
2105
|
this.currObjType.isFiltered = false;
|
|
2043
2106
|
var obj_4 = { value: null };
|
|
@@ -2053,12 +2116,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2053
2116
|
else if (obj['bool']) {
|
|
2054
2117
|
this.notify('freehand-draw', { prop: 'applyFhd', onPropertyChange: false });
|
|
2055
2118
|
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
|
-
}
|
|
2119
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
2062
2120
|
this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2063
2121
|
}
|
|
2064
2122
|
else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
|
|
@@ -2084,20 +2142,16 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2084
2142
|
}
|
|
2085
2143
|
this.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
|
|
2086
2144
|
}
|
|
2087
|
-
if (!
|
|
2145
|
+
if (!obj['isCropToolbar']) {
|
|
2088
2146
|
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
2089
2147
|
isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
|
|
2090
2148
|
}
|
|
2091
|
-
else if (isBlazor() && !obj['isCropToolbar'] && (this.currentToolbar == 'resize-toolbar' || this.currentToolbar == 'frame-toolbar')) {
|
|
2092
|
-
this.updateToolbar(this.element, 'imageLoaded');
|
|
2093
|
-
}
|
|
2094
2149
|
this.notify('draw', { prop: 'setNewPath', value: { bool: false } });
|
|
2095
2150
|
this.transform.zoomFactor = this.transform.defaultZoomFactor;
|
|
2096
2151
|
this.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
|
|
2097
2152
|
this.isResizeOkBtn = false;
|
|
2098
2153
|
this.notify('draw', { prop: 'redrawDownScale' });
|
|
2099
2154
|
this.isChangesSaved = false;
|
|
2100
|
-
this.triggerActionComplete();
|
|
2101
2155
|
};
|
|
2102
2156
|
/**
|
|
2103
2157
|
* Set the temporary filter properties.
|
|
@@ -2156,18 +2210,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2156
2210
|
var data = this.getImageData();
|
|
2157
2211
|
if (ctWrapper) {
|
|
2158
2212
|
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
2213
|
}
|
|
2164
|
-
if (!
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
isApplyBtn: true, isCropping: false } });
|
|
2168
|
-
}
|
|
2169
|
-
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
2214
|
+
if (!Browser.isDevice) {
|
|
2215
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
2216
|
+
isApplyBtn: true, isCropping: false } });
|
|
2170
2217
|
}
|
|
2218
|
+
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
2171
2219
|
this.objColl = objColl;
|
|
2172
2220
|
this.pointColl = pointColl;
|
|
2173
2221
|
this.freehandCounter = pointColl.length;
|
|
@@ -2185,26 +2233,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2185
2233
|
* @returns {void}.
|
|
2186
2234
|
*/
|
|
2187
2235
|
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 } });
|
|
2236
|
+
var finetuneValueChanging = { finetune: this.getFinetuneOption(type), value: value, cancel: false };
|
|
2237
|
+
this.trigger('finetuneValueChanging', finetuneValueChanging);
|
|
2238
|
+
if (finetuneValueChanging.cancel) {
|
|
2239
|
+
return;
|
|
2207
2240
|
}
|
|
2241
|
+
this.notify('filter', { prop: 'setCurrAdjValue', value: { type: type.toLowerCase(), value: value } });
|
|
2208
2242
|
};
|
|
2209
2243
|
/**
|
|
2210
2244
|
* Get the square point for path.
|
|
@@ -2298,24 +2332,22 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2298
2332
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2299
2333
|
}
|
|
2300
2334
|
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
|
-
}
|
|
2335
|
+
if (Browser.isDevice) {
|
|
2336
|
+
if (document.getElementById(this.element.id + '_bottomToolbar')) {
|
|
2337
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2338
|
+
var toolbar_1 = getComponent(this.element.id + '_bottomToolbar', 'toolbar');
|
|
2339
|
+
toolbar_1.refreshOverflow();
|
|
2308
2340
|
}
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2341
|
+
}
|
|
2342
|
+
else {
|
|
2343
|
+
if (document.getElementById(this.element.id + '_toolbar')) {
|
|
2344
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2345
|
+
var toolbar_2 = getComponent(this.element.id + '_toolbar', 'toolbar');
|
|
2346
|
+
toolbar_2.refreshOverflow();
|
|
2315
2347
|
}
|
|
2316
2348
|
}
|
|
2317
2349
|
var shapeChangedArgs = { action: type, currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2318
|
-
this.
|
|
2350
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2319
2351
|
};
|
|
2320
2352
|
/**
|
|
2321
2353
|
* Apply Font style for text.
|
|
@@ -2386,7 +2418,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2386
2418
|
}
|
|
2387
2419
|
var shapeChangedArgs = { action: 'font-family', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2388
2420
|
shapeChangedArgs.currentShapeSettings.fontFamily = this.textArea.style.fontFamily;
|
|
2389
|
-
this.
|
|
2421
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2390
2422
|
};
|
|
2391
2423
|
/**
|
|
2392
2424
|
* Apply Font size for text.
|
|
@@ -2488,7 +2520,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2488
2520
|
}
|
|
2489
2521
|
var shapeChangedArgs = { action: 'font-size', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2490
2522
|
shapeChangedArgs.currentShapeSettings.fontSize = this.activeObj.textSettings.fontSize;
|
|
2491
|
-
this.
|
|
2523
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2492
2524
|
};
|
|
2493
2525
|
/**
|
|
2494
2526
|
* Apply Font color for text.
|
|
@@ -2559,7 +2591,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2559
2591
|
}
|
|
2560
2592
|
var shapeChangedArgs = { action: 'font-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2561
2593
|
shapeChangedArgs.currentShapeSettings.fillColor = value;
|
|
2562
|
-
this.
|
|
2594
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2563
2595
|
};
|
|
2564
2596
|
/**
|
|
2565
2597
|
* Apply Pen stroke width.
|
|
@@ -2614,7 +2646,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2614
2646
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
2615
2647
|
var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2616
2648
|
shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
2617
|
-
this.
|
|
2649
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2618
2650
|
};
|
|
2619
2651
|
/**
|
|
2620
2652
|
* Apply Pen stroke color.
|
|
@@ -2684,7 +2716,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2684
2716
|
shapeSettings.type = ShapeType.FreehandDraw;
|
|
2685
2717
|
var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2686
2718
|
shapeChangedArgs.currentShapeSettings.strokeColor = value;
|
|
2687
|
-
this.
|
|
2719
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2688
2720
|
};
|
|
2689
2721
|
/**
|
|
2690
2722
|
* Apply Shape stroke width.
|
|
@@ -2730,7 +2762,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2730
2762
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2731
2763
|
var shapeChangedArgs = { action: 'stroke-width', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2732
2764
|
shapeChangedArgs.currentShapeSettings.strokeWidth = this.activeObj.strokeSettings.strokeWidth;
|
|
2733
|
-
this.
|
|
2765
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2734
2766
|
}
|
|
2735
2767
|
else if (this.activeObj.shape && (this.activeObj.shape === 'path' &&
|
|
2736
2768
|
this.activeObj.pointColl.length === 0)) {
|
|
@@ -2787,7 +2819,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2787
2819
|
}
|
|
2788
2820
|
var shapeChangedArgs = { action: 'stroke-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2789
2821
|
shapeChangedArgs.currentShapeSettings.strokeColor = value;
|
|
2790
|
-
this.
|
|
2822
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2791
2823
|
};
|
|
2792
2824
|
/**
|
|
2793
2825
|
* Apply Shape fill color.
|
|
@@ -2827,7 +2859,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2827
2859
|
}
|
|
2828
2860
|
this.notify('selection', { prop: 'redrawShape', value: { obj: this.objColl[this.objColl.length - 1] } });
|
|
2829
2861
|
var shapeChangedArgs = { action: 'fill-color', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2830
|
-
this.
|
|
2862
|
+
this.trigger('shapeChange', shapeChangedArgs);
|
|
2831
2863
|
};
|
|
2832
2864
|
/**
|
|
2833
2865
|
* Apply horizontal flip.
|
|
@@ -2858,9 +2890,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2858
2890
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2859
2891
|
this.objColl.pop();
|
|
2860
2892
|
}
|
|
2861
|
-
|
|
2862
|
-
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2863
|
-
}
|
|
2893
|
+
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2864
2894
|
ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
|
|
2865
2895
|
var activePoint = this.duplicateImage();
|
|
2866
2896
|
this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
@@ -2906,9 +2936,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2906
2936
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2907
2937
|
this.objColl.pop();
|
|
2908
2938
|
}
|
|
2909
|
-
|
|
2910
|
-
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2911
|
-
}
|
|
2939
|
+
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2912
2940
|
ctx.clearRect(0, 0, this.activeObj.imageCanvas.width, this.activeObj.imageCanvas.height);
|
|
2913
2941
|
var activePoint = this.duplicateImage();
|
|
2914
2942
|
this.notify('draw', { prop: 'downScaleImgCanvas', onPropertyChange: false,
|
|
@@ -2952,9 +2980,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2952
2980
|
value: { obj: selPointCollObj } });
|
|
2953
2981
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2954
2982
|
this.objColl.pop();
|
|
2955
|
-
|
|
2956
|
-
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2957
|
-
}
|
|
2983
|
+
this.notify('toolbar', { prop: 'refreshSlider' });
|
|
2958
2984
|
if (rotate === 'rotleft') {
|
|
2959
2985
|
this.activeObj.rotatedAngle -= (90 * (Math.PI / 180));
|
|
2960
2986
|
}
|
|
@@ -2971,14 +2997,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2971
2997
|
previousCropObj: prevCropObj, previousText: null,
|
|
2972
2998
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
2973
2999
|
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
|
-
}
|
|
3000
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
|
|
3001
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
2982
3002
|
};
|
|
2983
3003
|
/**
|
|
2984
3004
|
* Get pascalToSplitWords from string.
|
|
@@ -3037,6 +3057,12 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3037
3057
|
* @returns {void}.
|
|
3038
3058
|
*/
|
|
3039
3059
|
ImageEditor.prototype.transformSelect = function (type) {
|
|
3060
|
+
if (this.transform.straighten === 0 && (type === 'rotateleft' || type === 'rotateright') &&
|
|
3061
|
+
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',
|
|
3062
|
+
'crop-9:16', 'crop-16:9'].indexOf(this.activeObj.shape) !== -1) {
|
|
3063
|
+
this.activeObj.shape = 'crop-' + this.activeObj.shape.split('-')[1].split(':')[1] + ':' + this.activeObj.shape.split('-')[1].split(':')[0];
|
|
3064
|
+
this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: this.activeObj.shape, isTransform: true } });
|
|
3065
|
+
}
|
|
3040
3066
|
this.isCropToolbar = true;
|
|
3041
3067
|
this.allowDownScale = false;
|
|
3042
3068
|
var straighten = this.transform.straighten;
|
|
@@ -3133,12 +3159,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3133
3159
|
*/
|
|
3134
3160
|
ImageEditor.prototype.setStraighten = function (value, isMethod) {
|
|
3135
3161
|
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
|
-
}
|
|
3162
|
+
this.trigger('rotating', straightenEventArgs);
|
|
3142
3163
|
if (!straightenEventArgs.cancel) {
|
|
3143
3164
|
this.performStraighten(straightenEventArgs);
|
|
3144
3165
|
}
|
|
@@ -3263,85 +3284,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3263
3284
|
}
|
|
3264
3285
|
return flipState;
|
|
3265
3286
|
};
|
|
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
3287
|
ImageEditor.prototype.initializeZoomSettings = function () {
|
|
3346
3288
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3347
3289
|
if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
|
|
@@ -3374,57 +3316,6 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
3374
3316
|
Material3Dark: { primaryColor: '#d0bcff', secondaryColor: '#fff' }
|
|
3375
3317
|
};
|
|
3376
3318
|
};
|
|
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
3319
|
var ImageEditor_1;
|
|
3429
3320
|
__decorate([
|
|
3430
3321
|
Property('')
|