@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.
@@ -11065,6 +11065,10 @@ class Selection {
11065
11065
  performEnterAction(e) {
11066
11066
  const parent = this.parent;
11067
11067
  if (parent.isResize) {
11068
+ const isValue = this.isValueUpdated();
11069
+ if (!isValue) {
11070
+ return;
11071
+ }
11068
11072
  const point = this.getNumTextValue();
11069
11073
  const aspectRatioElement = this.parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
11070
11074
  const blrAspRatElem = this.parent.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
@@ -11094,15 +11098,19 @@ class Selection {
11094
11098
  const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
11095
11099
  const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
11096
11100
  if (isNullOrUndefined(aspectRatioElement)) {
11097
- let elem = getComponent(aspectRatioHeight, 'numerictextbox');
11098
- if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11099
- elem.value = parseFloat(elem.placeholder);
11100
- aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11101
- }
11102
- elem = getComponent(aspectRatioWidth, 'numerictextbox');
11103
- if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11104
- elem.value = parseFloat(elem.placeholder);
11105
- aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11101
+ if (aspectRatioHeight) {
11102
+ const elem = getComponent(aspectRatioHeight, 'numerictextbox');
11103
+ if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11104
+ elem.value = parseFloat(elem.placeholder);
11105
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11106
+ }
11107
+ }
11108
+ if (aspectRatioWidth) {
11109
+ const elem = getComponent(aspectRatioWidth, 'numerictextbox');
11110
+ if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11111
+ elem.value = parseFloat(elem.placeholder);
11112
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11113
+ }
11106
11114
  }
11107
11115
  }
11108
11116
  }
@@ -12078,6 +12086,25 @@ class Selection {
12078
12086
  }
12079
12087
  return { x: width, y: height };
12080
12088
  }
12089
+ isValueUpdated() {
12090
+ let isValue = true;
12091
+ let widthElement;
12092
+ let heightElement;
12093
+ if (!isBlazor()) {
12094
+ widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
12095
+ heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
12096
+ }
12097
+ else {
12098
+ widthElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
12099
+ heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
12100
+ }
12101
+ if (widthElement && heightElement) {
12102
+ if (heightElement.value.replace(/,/g, '') === '' && widthElement.value.replace(/,/g, '') === '') {
12103
+ isValue = false;
12104
+ }
12105
+ }
12106
+ return isValue;
12107
+ }
12081
12108
  }
12082
12109
 
12083
12110
  class Shape {
@@ -15758,7 +15785,9 @@ class Transform {
15758
15785
  const previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
15759
15786
  const zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
15760
15787
  currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
15761
- if (!parent.isCropToolbar && isBlazor() && parent.events && parent.events.zooming.hasDelegate === true) {
15788
+ if (isBlazor() && !parent.isCropToolbar && parent.currentToolbar !== 'resize-toolbar' && parent.currentToolbar !== 'frame-toolbar'
15789
+ && parent.events && parent.events.zooming.hasDelegate === true) {
15790
+ zoomEventArgs.zoomTrigger = parseInt(this.getZoomTriggerType(zoomEventArgs.zoomTrigger));
15762
15791
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
15763
15792
  parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs).then((args) => {
15764
15793
  this.zoomEvent(args, zoomFactor);
@@ -15772,6 +15801,18 @@ class Transform {
15772
15801
  }
15773
15802
  }
15774
15803
  }
15804
+ getZoomTriggerType(type) {
15805
+ switch (type) {
15806
+ case 'MouseWheel':
15807
+ return '1';
15808
+ case 'Pinch':
15809
+ return '2';
15810
+ case 'Commands':
15811
+ return '4';
15812
+ default:
15813
+ return '8';
15814
+ }
15815
+ }
15775
15816
  zoomEvent(zoomEventArgs, zoomFactor) {
15776
15817
  const parent = this.parent;
15777
15818
  if (zoomEventArgs.cancel) {
@@ -16591,7 +16632,8 @@ class Transform {
16591
16632
  }
16592
16633
  }
16593
16634
  getCurrentZoomFactor(zoomFactor) {
16594
- return (zoomFactor - this.prevZoomValue) * 0.1;
16635
+ return zoomFactor >= 1 ? (this.prevZoomValue < 1 ? (zoomFactor - this.prevZoomValue) : (zoomFactor - this.prevZoomValue) * 0.1) :
16636
+ (zoomFactor - this.prevZoomValue);
16595
16637
  }
16596
16638
  setCurrPanRegion(region, type, obj) {
16597
16639
  let panRegion = region;
@@ -17250,7 +17292,9 @@ class Transform {
17250
17292
  resizeEventHandler(args) {
17251
17293
  const parent = this.parent;
17252
17294
  let isRotate;
17295
+ const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
17253
17296
  const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
17297
+ const widthElem = parent.element.querySelector(".e-ie-toolbar-e-resize-width-input .e-numerictextbox");
17254
17298
  const heightElem = parent.element.querySelector(".e-ie-toolbar-e-resize-height-input .e-numerictextbox");
17255
17299
  if (args.isAspectRatio) {
17256
17300
  if (this.resizedImgAngle == null || this.resizedImgAngle !== parent.transform.degree) {
@@ -17263,10 +17307,19 @@ class Transform {
17263
17307
  getComponent(aspectRatioHeight, 'numerictextbox').value = Math.floor(parent.img.destHeight);
17264
17308
  aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
17265
17309
  parent.aspectHeight = Math.floor(parent.img.destHeight);
17310
+ if (aspectRatioWidth && aspectRatioWidth.value === '') {
17311
+ getComponent(aspectRatioWidth, 'numerictextbox').value = Math.floor(parent.img.destWidth);
17312
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
17313
+ parent.aspectWidth = Math.floor(parent.img.destWidth);
17314
+ }
17266
17315
  }
17267
17316
  else if (heightElem) {
17268
17317
  heightElem.value = Math.floor(parent.img.destHeight).toString();
17269
17318
  parent.aspectHeight = Math.floor(parent.img.destHeight);
17319
+ if (widthElem && widthElem.value === '') {
17320
+ widthElem.value = Math.floor(parent.img.destWidth).toString();
17321
+ parent.aspectWidth = Math.floor(parent.img.destWidth);
17322
+ }
17270
17323
  }
17271
17324
  }
17272
17325
  else {
@@ -19190,6 +19243,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
19190
19243
  this.currentFilter = '';
19191
19244
  this.tempFrameZoomLevel = null;
19192
19245
  this.cxtTbarHeight = null;
19246
+ this.aspectWidth = this.aspectHeight = null;
19193
19247
  const obj = { initialZoomValue: false };
19194
19248
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj } });
19195
19249
  if (obj['initialZoomValue']) {
@@ -22317,13 +22371,17 @@ class ToolbarModule {
22317
22371
  getResizeToolbarItem() {
22318
22372
  const toolbarItems = [];
22319
22373
  const isResize = this.parent.aspectWidth && this.parent.aspectHeight ? true : false;
22374
+ const width = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
22375
+ Math.ceil(this.parent.img.srcHeight).toString() : Math.ceil(this.parent.img.srcWidth).toString();
22376
+ const height = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
22377
+ Math.ceil(this.parent.img.srcWidth).toString() : Math.ceil(this.parent.img.srcHeight).toString();
22320
22378
  const spanWidth = document.createElement('span');
22321
22379
  spanWidth.innerHTML = this.l10n.getConstant('W');
22322
22380
  toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
22323
22381
  toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
22324
22382
  tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22325
22383
  showSpinButton: false, value: isResize ? this.parent.aspectWidth : null,
22326
- placeholder: isResize ? null : Math.ceil(this.parent.img.srcWidth).toString(), format: '###.## px' })
22384
+ placeholder: isResize ? null : width, format: '###.## px' })
22327
22385
  });
22328
22386
  const spanHeight = document.createElement('span');
22329
22387
  spanHeight.innerHTML = this.l10n.getConstant('H');
@@ -22331,7 +22389,7 @@ class ToolbarModule {
22331
22389
  toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
22332
22390
  tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22333
22391
  showSpinButton: false, value: isResize ? this.parent.aspectHeight : null,
22334
- placeholder: isResize ? null : Math.ceil(this.parent.img.srcHeight).toString(), format: '###.## px' })
22392
+ placeholder: isResize ? null : height, format: '###.## px' })
22335
22393
  });
22336
22394
  if (!this.isAspectRatio) {
22337
22395
  toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });