@syncfusion/ej2-image-editor 23.2.4 → 23.2.6

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.
@@ -11082,6 +11082,10 @@ var Selection = /** @__PURE__ @class */ (function () {
11082
11082
  Selection.prototype.performEnterAction = function (e) {
11083
11083
  var parent = this.parent;
11084
11084
  if (parent.isResize) {
11085
+ var isValue = this.isValueUpdated();
11086
+ if (!isValue) {
11087
+ return;
11088
+ }
11085
11089
  var point = this.getNumTextValue();
11086
11090
  var aspectRatioElement = this.parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
11087
11091
  var blrAspRatElem = this.parent.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
@@ -11111,15 +11115,19 @@ var Selection = /** @__PURE__ @class */ (function () {
11111
11115
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
11112
11116
  var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
11113
11117
  if (isNullOrUndefined(aspectRatioElement)) {
11114
- var elem = getComponent(aspectRatioHeight, 'numerictextbox');
11115
- if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11116
- elem.value = parseFloat(elem.placeholder);
11117
- aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11118
- }
11119
- elem = getComponent(aspectRatioWidth, 'numerictextbox');
11120
- if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11121
- elem.value = parseFloat(elem.placeholder);
11122
- aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11118
+ if (aspectRatioHeight) {
11119
+ var elem = getComponent(aspectRatioHeight, 'numerictextbox');
11120
+ if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11121
+ elem.value = parseFloat(elem.placeholder);
11122
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11123
+ }
11124
+ }
11125
+ if (aspectRatioWidth) {
11126
+ var elem = getComponent(aspectRatioWidth, 'numerictextbox');
11127
+ if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11128
+ elem.value = parseFloat(elem.placeholder);
11129
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11130
+ }
11123
11131
  }
11124
11132
  }
11125
11133
  }
@@ -12096,6 +12104,25 @@ var Selection = /** @__PURE__ @class */ (function () {
12096
12104
  }
12097
12105
  return { x: width, y: height };
12098
12106
  };
12107
+ Selection.prototype.isValueUpdated = function () {
12108
+ var isValue = true;
12109
+ var widthElement;
12110
+ var heightElement;
12111
+ if (!isBlazor()) {
12112
+ widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
12113
+ heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
12114
+ }
12115
+ else {
12116
+ widthElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
12117
+ heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
12118
+ }
12119
+ if (widthElement && heightElement) {
12120
+ if (heightElement.value.replace(/,/g, '') === '' && widthElement.value.replace(/,/g, '') === '') {
12121
+ isValue = false;
12122
+ }
12123
+ }
12124
+ return isValue;
12125
+ };
12099
12126
  return Selection;
12100
12127
  }());
12101
12128
 
@@ -15786,7 +15813,9 @@ var Transform = /** @__PURE__ @class */ (function () {
15786
15813
  var previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
15787
15814
  var zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
15788
15815
  currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
15789
- if (!parent.isCropToolbar && isBlazor() && parent.events && parent.events.zooming.hasDelegate === true) {
15816
+ if (isBlazor() && !parent.isCropToolbar && parent.currentToolbar !== 'resize-toolbar' && parent.currentToolbar !== 'frame-toolbar'
15817
+ && parent.events && parent.events.zooming.hasDelegate === true) {
15818
+ zoomEventArgs.zoomTrigger = parseInt(this.getZoomTriggerType(zoomEventArgs.zoomTrigger));
15790
15819
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
15791
15820
  parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs).then(function (args) {
15792
15821
  _this.zoomEvent(args, zoomFactor);
@@ -15800,6 +15829,18 @@ var Transform = /** @__PURE__ @class */ (function () {
15800
15829
  }
15801
15830
  }
15802
15831
  };
15832
+ Transform.prototype.getZoomTriggerType = function (type) {
15833
+ switch (type) {
15834
+ case 'MouseWheel':
15835
+ return '1';
15836
+ case 'Pinch':
15837
+ return '2';
15838
+ case 'Commands':
15839
+ return '4';
15840
+ default:
15841
+ return '8';
15842
+ }
15843
+ };
15803
15844
  Transform.prototype.zoomEvent = function (zoomEventArgs, zoomFactor) {
15804
15845
  var parent = this.parent;
15805
15846
  if (zoomEventArgs.cancel) {
@@ -16620,7 +16661,8 @@ var Transform = /** @__PURE__ @class */ (function () {
16620
16661
  }
16621
16662
  };
16622
16663
  Transform.prototype.getCurrentZoomFactor = function (zoomFactor) {
16623
- return (zoomFactor - this.prevZoomValue) * 0.1;
16664
+ return zoomFactor >= 1 ? (this.prevZoomValue < 1 ? (zoomFactor - this.prevZoomValue) : (zoomFactor - this.prevZoomValue) * 0.1) :
16665
+ (zoomFactor - this.prevZoomValue);
16624
16666
  };
16625
16667
  Transform.prototype.setCurrPanRegion = function (region, type, obj) {
16626
16668
  var panRegion = region;
@@ -17281,7 +17323,9 @@ var Transform = /** @__PURE__ @class */ (function () {
17281
17323
  Transform.prototype.resizeEventHandler = function (args) {
17282
17324
  var parent = this.parent;
17283
17325
  var isRotate;
17326
+ var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
17284
17327
  var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
17328
+ var widthElem = parent.element.querySelector(".e-ie-toolbar-e-resize-width-input .e-numerictextbox");
17285
17329
  var heightElem = parent.element.querySelector(".e-ie-toolbar-e-resize-height-input .e-numerictextbox");
17286
17330
  if (args.isAspectRatio) {
17287
17331
  if (this.resizedImgAngle == null || this.resizedImgAngle !== parent.transform.degree) {
@@ -17294,10 +17338,19 @@ var Transform = /** @__PURE__ @class */ (function () {
17294
17338
  getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(parent.img.destHeight);
17295
17339
  aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
17296
17340
  parent.aspectHeight = Math.floor(parent.img.destHeight);
17341
+ if (aspectRatioWidth && aspectRatioWidth.value === '') {
17342
+ getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(parent.img.destWidth);
17343
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
17344
+ parent.aspectWidth = Math.floor(parent.img.destWidth);
17345
+ }
17297
17346
  }
17298
17347
  else if (heightElem) {
17299
17348
  heightElem.value = Math.floor(parent.img.destHeight).toString();
17300
17349
  parent.aspectHeight = Math.floor(parent.img.destHeight);
17350
+ if (widthElem && widthElem.value === '') {
17351
+ widthElem.value = Math.floor(parent.img.destWidth).toString();
17352
+ parent.aspectWidth = Math.floor(parent.img.destWidth);
17353
+ }
17301
17354
  }
17302
17355
  }
17303
17356
  else {
@@ -19256,6 +19309,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
19256
19309
  this.currentFilter = '';
19257
19310
  this.tempFrameZoomLevel = null;
19258
19311
  this.cxtTbarHeight = null;
19312
+ this.aspectWidth = this.aspectHeight = null;
19259
19313
  var obj_1 = { initialZoomValue: false };
19260
19314
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
19261
19315
  if (obj_1['initialZoomValue']) {
@@ -22389,13 +22443,17 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
22389
22443
  ToolbarModule.prototype.getResizeToolbarItem = function () {
22390
22444
  var toolbarItems = [];
22391
22445
  var isResize = this.parent.aspectWidth && this.parent.aspectHeight ? true : false;
22446
+ var width = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
22447
+ Math.ceil(this.parent.img.srcHeight).toString() : Math.ceil(this.parent.img.srcWidth).toString();
22448
+ var height = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
22449
+ Math.ceil(this.parent.img.srcWidth).toString() : Math.ceil(this.parent.img.srcHeight).toString();
22392
22450
  var spanWidth = document.createElement('span');
22393
22451
  spanWidth.innerHTML = this.l10n.getConstant('W');
22394
22452
  toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
22395
22453
  toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
22396
22454
  tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22397
22455
  showSpinButton: false, value: isResize ? this.parent.aspectWidth : null,
22398
- placeholder: isResize ? null : Math.ceil(this.parent.img.srcWidth).toString(), format: '###.## px' })
22456
+ placeholder: isResize ? null : width, format: '###.## px' })
22399
22457
  });
22400
22458
  var spanHeight = document.createElement('span');
22401
22459
  spanHeight.innerHTML = this.l10n.getConstant('H');
@@ -22403,7 +22461,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
22403
22461
  toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
22404
22462
  tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22405
22463
  showSpinButton: false, value: isResize ? this.parent.aspectHeight : null,
22406
- placeholder: isResize ? null : Math.ceil(this.parent.img.srcHeight).toString(), format: '###.## px' })
22464
+ placeholder: isResize ? null : height, format: '###.## px' })
22407
22465
  });
22408
22466
  if (!this.isAspectRatio) {
22409
22467
  toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });