@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.
@@ -3399,6 +3399,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
3399
3399
  this.pointColl = [];
3400
3400
  this.freehandCounter = 0;
3401
3401
  this.objColl.push(this.currSelectionPoint);
3402
+ this.currSelectionPoint = null;
3402
3403
  this.zoomAction(this.cropObj.cropZoom);
3403
3404
  this.currSelectionPoint = extend({}, this.objColl[0], null, true);
3404
3405
  this.objColl = cropObjColl_1;
@@ -6255,7 +6256,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6255
6256
  if (this.disabled) {
6256
6257
  this.element.setAttribute('class', 'e-disabled');
6257
6258
  }
6258
- this.trigger('fileOpened', fileOpened);
6259
+ if (this.isImageLoaded && this.element.style.opacity !== '0.5') {
6260
+ this.trigger('fileOpened', fileOpened);
6261
+ }
6259
6262
  if (this.zoomSettings.zoomFactor !== 1 || !isNullOrUndefined(this.zoomSettings.zoomPoint)) {
6260
6263
  this.zoom(this.zoomSettings.zoomFactor, this.zoomSettings.zoomPoint);
6261
6264
  }
@@ -6500,10 +6503,33 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6500
6503
  };
6501
6504
  ImageEditor.prototype.fileSelect = function (inputElement, args) {
6502
6505
  if (!this.disabled) {
6503
- showSpinner(this.element);
6504
- this.element.style.opacity = '0.5';
6505
6506
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6506
6507
  var filesData = args.target.files[0];
6508
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6509
+ var fileData = filesData;
6510
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6511
+ !isNullOrUndefined(fileData.name.split('.')[1]) &&
6512
+ fileData.name.split('.')[1].toLowerCase() !== 'jpg' &&
6513
+ fileData.name.split('.')[1].toLowerCase() !== 'jpeg' &&
6514
+ fileData.name.split('.')[1].toLowerCase() !== 'png' &&
6515
+ fileData.name.split('.')[1].toLowerCase() !== 'svg') {
6516
+ return;
6517
+ }
6518
+ showSpinner(this.element);
6519
+ this.element.style.opacity = '0.5';
6520
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6521
+ !isNullOrUndefined(fileData.name.split('.')[1])) {
6522
+ var fileType = this.toPascalCase(fileData.name.split('.')[1]);
6523
+ if (fileType === 'JPG' || fileType === 'Jpg') {
6524
+ this.fileType = 'Jpeg';
6525
+ }
6526
+ else {
6527
+ this.fileType = fileType;
6528
+ }
6529
+ }
6530
+ else {
6531
+ this.fileType = null;
6532
+ }
6507
6533
  if (this.isImageLoaded) {
6508
6534
  this.isImageLoaded = false;
6509
6535
  this.reset();
@@ -8134,17 +8160,19 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
8134
8160
  if (this.degree === 0 || this.degree === 180) {
8135
8161
  if (!isNullOrUndefined(this.activeObj.shape)) {
8136
8162
  this.setZoomDimension(-0.1, this.activeObj);
8137
- if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8138
- this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8139
- this.activeObj.activePoint.endY) {
8140
- zoomOut.classList.add('e-disabled');
8141
- zoomOut.parentElement.classList.add('e-overlay');
8142
- isDisabled = true;
8143
- }
8144
- else {
8145
- zoomOut.classList.remove('e-disabled');
8146
- zoomOut.parentElement.classList.remove('e-overlay');
8147
- isDisabled = false;
8163
+ if (!isNullOrUndefined(zoomOut)) {
8164
+ if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8165
+ this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8166
+ this.activeObj.activePoint.endY) {
8167
+ zoomOut.classList.add('e-disabled');
8168
+ zoomOut.parentElement.classList.add('e-overlay');
8169
+ isDisabled = true;
8170
+ }
8171
+ else {
8172
+ zoomOut.classList.remove('e-disabled');
8173
+ zoomOut.parentElement.classList.remove('e-overlay');
8174
+ isDisabled = false;
8175
+ }
8148
8176
  }
8149
8177
  }
8150
8178
  else {
@@ -13327,10 +13355,24 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
13327
13355
  else {
13328
13356
  this.fileName = 'ImageEditor';
13329
13357
  }
13358
+ if (!isNullOrUndefined(data.split('.')) &&
13359
+ !isNullOrUndefined(data.split('.')[2])) {
13360
+ var fileType = this.toPascalCase(data.split('.')[2]);
13361
+ if (fileType === 'JPG' || fileType === 'Jpg') {
13362
+ this.fileType = 'Jpeg';
13363
+ }
13364
+ else {
13365
+ this.fileType = fileType;
13366
+ }
13367
+ }
13368
+ else {
13369
+ this.fileType = null;
13370
+ }
13330
13371
  this.imageOnLoad(data);
13331
13372
  }
13332
13373
  else {
13333
13374
  this.fileName = 'ImageEditor';
13375
+ this.fileType = null;
13334
13376
  this.lowerCanvas = document.querySelector('#' + this.element.id + '_lowerCanvas');
13335
13377
  this.upperCanvas = document.querySelector('#' + this.element.id + '_upperCanvas');
13336
13378
  this.lowerContext = this.lowerCanvas.getContext('2d');
@@ -13480,7 +13522,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
13480
13522
  if (!isNullOrUndefined(document.getElementById(this.element.id + '_quickAccessToolbarArea'))) {
13481
13523
  document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
13482
13524
  }
13525
+ this.isImageLoaded = false;
13483
13526
  this.updateCanvas();
13527
+ this.isImageLoaded = true;
13484
13528
  this.refreshDropDownBtn(false);
13485
13529
  this.enableDisableToolbarBtn();
13486
13530
  }