@syncfusion/ej2-image-editor 21.2.5 → 21.2.10

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.
@@ -3360,6 +3360,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
3360
3360
  this.pointColl = [];
3361
3361
  this.freehandCounter = 0;
3362
3362
  this.objColl.push(this.currSelectionPoint);
3363
+ this.currSelectionPoint = null;
3363
3364
  this.zoomAction(this.cropObj.cropZoom);
3364
3365
  this.currSelectionPoint = extend({}, this.objColl[0], null, true);
3365
3366
  this.objColl = cropObjColl;
@@ -6211,7 +6212,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
6211
6212
  if (this.disabled) {
6212
6213
  this.element.setAttribute('class', 'e-disabled');
6213
6214
  }
6214
- this.trigger('fileOpened', fileOpened);
6215
+ if (this.isImageLoaded && this.element.style.opacity !== '0.5') {
6216
+ this.trigger('fileOpened', fileOpened);
6217
+ }
6215
6218
  if (this.zoomSettings.zoomFactor !== 1 || !isNullOrUndefined(this.zoomSettings.zoomPoint)) {
6216
6219
  this.zoom(this.zoomSettings.zoomFactor, this.zoomSettings.zoomPoint);
6217
6220
  }
@@ -6455,10 +6458,33 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
6455
6458
  }
6456
6459
  fileSelect(inputElement, args) {
6457
6460
  if (!this.disabled) {
6458
- showSpinner(this.element);
6459
- this.element.style.opacity = '0.5';
6460
6461
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6461
6462
  const filesData = args.target.files[0];
6463
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6464
+ const fileData = filesData;
6465
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6466
+ !isNullOrUndefined(fileData.name.split('.')[1]) &&
6467
+ fileData.name.split('.')[1].toLowerCase() !== 'jpg' &&
6468
+ fileData.name.split('.')[1].toLowerCase() !== 'jpeg' &&
6469
+ fileData.name.split('.')[1].toLowerCase() !== 'png' &&
6470
+ fileData.name.split('.')[1].toLowerCase() !== 'svg') {
6471
+ return;
6472
+ }
6473
+ showSpinner(this.element);
6474
+ this.element.style.opacity = '0.5';
6475
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6476
+ !isNullOrUndefined(fileData.name.split('.')[1])) {
6477
+ const fileType = this.toPascalCase(fileData.name.split('.')[1]);
6478
+ if (fileType === 'JPG' || fileType === 'Jpg') {
6479
+ this.fileType = 'Jpeg';
6480
+ }
6481
+ else {
6482
+ this.fileType = fileType;
6483
+ }
6484
+ }
6485
+ else {
6486
+ this.fileType = null;
6487
+ }
6462
6488
  if (this.isImageLoaded) {
6463
6489
  this.isImageLoaded = false;
6464
6490
  this.reset();
@@ -8088,17 +8114,19 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
8088
8114
  if (this.degree === 0 || this.degree === 180) {
8089
8115
  if (!isNullOrUndefined(this.activeObj.shape)) {
8090
8116
  this.setZoomDimension(-0.1, this.activeObj);
8091
- if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8092
- this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8093
- this.activeObj.activePoint.endY) {
8094
- zoomOut.classList.add('e-disabled');
8095
- zoomOut.parentElement.classList.add('e-overlay');
8096
- isDisabled = true;
8097
- }
8098
- else {
8099
- zoomOut.classList.remove('e-disabled');
8100
- zoomOut.parentElement.classList.remove('e-overlay');
8101
- isDisabled = false;
8117
+ if (!isNullOrUndefined(zoomOut)) {
8118
+ if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8119
+ this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8120
+ this.activeObj.activePoint.endY) {
8121
+ zoomOut.classList.add('e-disabled');
8122
+ zoomOut.parentElement.classList.add('e-overlay');
8123
+ isDisabled = true;
8124
+ }
8125
+ else {
8126
+ zoomOut.classList.remove('e-disabled');
8127
+ zoomOut.parentElement.classList.remove('e-overlay');
8128
+ isDisabled = false;
8129
+ }
8102
8130
  }
8103
8131
  }
8104
8132
  else {
@@ -13280,10 +13308,24 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
13280
13308
  else {
13281
13309
  this.fileName = 'ImageEditor';
13282
13310
  }
13311
+ if (!isNullOrUndefined(data.split('.')) &&
13312
+ !isNullOrUndefined(data.split('.')[2])) {
13313
+ const fileType = this.toPascalCase(data.split('.')[2]);
13314
+ if (fileType === 'JPG' || fileType === 'Jpg') {
13315
+ this.fileType = 'Jpeg';
13316
+ }
13317
+ else {
13318
+ this.fileType = fileType;
13319
+ }
13320
+ }
13321
+ else {
13322
+ this.fileType = null;
13323
+ }
13283
13324
  this.imageOnLoad(data);
13284
13325
  }
13285
13326
  else {
13286
13327
  this.fileName = 'ImageEditor';
13328
+ this.fileType = null;
13287
13329
  this.lowerCanvas = document.querySelector('#' + this.element.id + '_lowerCanvas');
13288
13330
  this.upperCanvas = document.querySelector('#' + this.element.id + '_upperCanvas');
13289
13331
  this.lowerContext = this.lowerCanvas.getContext('2d');
@@ -13433,7 +13475,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
13433
13475
  if (!isNullOrUndefined(document.getElementById(this.element.id + '_quickAccessToolbarArea'))) {
13434
13476
  document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
13435
13477
  }
13478
+ this.isImageLoaded = false;
13436
13479
  this.updateCanvas();
13480
+ this.isImageLoaded = true;
13437
13481
  this.refreshDropDownBtn(false);
13438
13482
  this.enableDisableToolbarBtn();
13439
13483
  }