@syncfusion/ej2-image-editor 23.2.5 → 23.2.7

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.
@@ -7119,8 +7119,14 @@ class FreehandDrawing {
7119
7119
  if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
7120
7120
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
7121
7121
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then((shapeChangingArgs) => {
7122
- parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7123
7122
  this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
7123
+ if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
7124
+ parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7125
+ const penColorElement = parent.element.querySelector('.e-ie-toolbar-e-pen-color .e-dropdownbtn-preview');
7126
+ if (penColorElement) {
7127
+ penColorElement.style.background = shapeChangingArgs.currentShapeSettings.strokeColor;
7128
+ }
7129
+ }
7124
7130
  if (this.fhdSelID) {
7125
7131
  parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7126
7132
  parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
@@ -7135,8 +7141,11 @@ class FreehandDrawing {
7135
7141
  }
7136
7142
  else {
7137
7143
  parent.trigger('shapeChanging', shapeChangingArgs);
7138
- parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7139
7144
  this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
7145
+ if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
7146
+ parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7147
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
7148
+ }
7140
7149
  if (this.fhdSelID) {
7141
7150
  parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
7142
7151
  parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
@@ -11065,6 +11074,10 @@ class Selection {
11065
11074
  performEnterAction(e) {
11066
11075
  const parent = this.parent;
11067
11076
  if (parent.isResize) {
11077
+ const isValue = this.isValueUpdated();
11078
+ if (!isValue) {
11079
+ return;
11080
+ }
11068
11081
  const point = this.getNumTextValue();
11069
11082
  const aspectRatioElement = this.parent.element.querySelector('#' + this.parent.element.id + '_aspectratio');
11070
11083
  const blrAspRatElem = this.parent.element.querySelector('.e-ie-toolbar-aspect-ratio-btn');
@@ -11094,15 +11107,19 @@ class Selection {
11094
11107
  const aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
11095
11108
  const aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
11096
11109
  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';
11110
+ if (aspectRatioHeight) {
11111
+ const elem = getComponent(aspectRatioHeight, 'numerictextbox');
11112
+ if (aspectRatioHeight && isNullOrUndefined(elem.value)) {
11113
+ elem.value = parseFloat(elem.placeholder);
11114
+ aspectRatioHeight.value = Math.floor(parent.img.destHeight).toString() + ' px';
11115
+ }
11116
+ }
11117
+ if (aspectRatioWidth) {
11118
+ const elem = getComponent(aspectRatioWidth, 'numerictextbox');
11119
+ if (aspectRatioWidth && isNullOrUndefined(elem.value)) {
11120
+ elem.value = parseFloat(elem.placeholder);
11121
+ aspectRatioWidth.value = Math.floor(parent.img.destWidth).toString() + ' px';
11122
+ }
11106
11123
  }
11107
11124
  }
11108
11125
  }
@@ -12078,6 +12095,25 @@ class Selection {
12078
12095
  }
12079
12096
  return { x: width, y: height };
12080
12097
  }
12098
+ isValueUpdated() {
12099
+ let isValue = true;
12100
+ let widthElement;
12101
+ let heightElement;
12102
+ if (!isBlazor()) {
12103
+ widthElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeWidth');
12104
+ heightElement = this.parent.element.querySelector('#' + this.parent.element.id + '_resizeHeight');
12105
+ }
12106
+ else {
12107
+ widthElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-numerictextbox');
12108
+ heightElement = this.parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-numerictextbox');
12109
+ }
12110
+ if (widthElement && heightElement) {
12111
+ if (heightElement.value.replace(/,/g, '') === '' && widthElement.value.replace(/,/g, '') === '') {
12112
+ isValue = false;
12113
+ }
12114
+ }
12115
+ return isValue;
12116
+ }
12081
12117
  }
12082
12118
 
12083
12119
  class Shape {
@@ -16605,7 +16641,8 @@ class Transform {
16605
16641
  }
16606
16642
  }
16607
16643
  getCurrentZoomFactor(zoomFactor) {
16608
- return (zoomFactor - this.prevZoomValue) * 0.1;
16644
+ return zoomFactor >= 1 ? (this.prevZoomValue < 1 ? (zoomFactor - this.prevZoomValue) : (zoomFactor - this.prevZoomValue) * 0.1) :
16645
+ (zoomFactor - this.prevZoomValue);
16609
16646
  }
16610
16647
  setCurrPanRegion(region, type, obj) {
16611
16648
  let panRegion = region;
@@ -19215,6 +19252,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
19215
19252
  this.currentFilter = '';
19216
19253
  this.tempFrameZoomLevel = null;
19217
19254
  this.cxtTbarHeight = null;
19255
+ this.aspectWidth = this.aspectHeight = null;
19218
19256
  const obj = { initialZoomValue: false };
19219
19257
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj } });
19220
19258
  if (obj['initialZoomValue']) {
@@ -22342,13 +22380,17 @@ class ToolbarModule {
22342
22380
  getResizeToolbarItem() {
22343
22381
  const toolbarItems = [];
22344
22382
  const isResize = this.parent.aspectWidth && this.parent.aspectHeight ? true : false;
22383
+ const width = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
22384
+ Math.ceil(this.parent.img.srcHeight).toString() : Math.ceil(this.parent.img.srcWidth).toString();
22385
+ const height = this.parent.transform.degree % 90 === 0 && this.parent.transform.degree % 180 !== 0 ?
22386
+ Math.ceil(this.parent.img.srcWidth).toString() : Math.ceil(this.parent.img.srcHeight).toString();
22345
22387
  const spanWidth = document.createElement('span');
22346
22388
  spanWidth.innerHTML = this.l10n.getConstant('W');
22347
22389
  toolbarItems.push({ id: this.parent.element.id + '_width', cssClass: 'e-ie-resize-width', template: spanWidth, align: 'Center' });
22348
22390
  toolbarItems.push({ id: this.parent.element.id + '_resizeWidth', prefixIcon: 'e-icons e-anti-clock-wise',
22349
22391
  tooltipText: this.l10n.getConstant('Width'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22350
22392
  showSpinButton: false, value: isResize ? this.parent.aspectWidth : null,
22351
- placeholder: isResize ? null : Math.ceil(this.parent.img.srcWidth).toString(), format: '###.## px' })
22393
+ placeholder: isResize ? null : width, format: '###.## px' })
22352
22394
  });
22353
22395
  const spanHeight = document.createElement('span');
22354
22396
  spanHeight.innerHTML = this.l10n.getConstant('H');
@@ -22356,7 +22398,7 @@ class ToolbarModule {
22356
22398
  toolbarItems.push({ id: this.parent.element.id + '_resizeHeight', prefixIcon: 'e-icons e-clock-wise',
22357
22399
  tooltipText: this.l10n.getConstant('Height'), align: 'Center', type: 'Input', template: new NumericTextBox({ width: 75, htmlAttributes: { maxLength: "4" },
22358
22400
  showSpinButton: false, value: isResize ? this.parent.aspectHeight : null,
22359
- placeholder: isResize ? null : Math.ceil(this.parent.img.srcHeight).toString(), format: '###.## px' })
22401
+ placeholder: isResize ? null : height, format: '###.## px' })
22360
22402
  });
22361
22403
  if (!this.isAspectRatio) {
22362
22404
  toolbarItems.push({ id: this.parent.element.id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });