@syncfusion/ej2-image-editor 25.1.37 → 25.1.39

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.
@@ -7023,6 +7023,9 @@ class FreehandDrawing {
7023
7023
  case 'reset':
7024
7024
  this.reset();
7025
7025
  break;
7026
+ case 'triggerShapeChanging':
7027
+ this.triggerShapeChanging(args.value['shapeChangingArgs']);
7028
+ break;
7026
7029
  }
7027
7030
  }
7028
7031
  updateFhdPvtVar() {
@@ -14971,6 +14974,7 @@ class Shape {
14971
14974
  const shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
14972
14975
  currentShapeSettings: shapeSettings };
14973
14976
  parent.trigger('shapeChanging', shapeChangingArgs);
14977
+ isSelect = isSelect ? isSelect : isSelected;
14974
14978
  this.drawShapeImageEvent(shapeChangingArgs, isSelect);
14975
14979
  if (parent.isPublicMethod && !isSelected) {
14976
14980
  parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
@@ -16256,7 +16260,7 @@ class Transform {
16256
16260
  this.resetZoom();
16257
16261
  break;
16258
16262
  case 'pan':
16259
- this.pan(args.value['value']);
16263
+ this.pan(args.value['value'], args.value['x'], args.value['y']);
16260
16264
  break;
16261
16265
  case 'zoom':
16262
16266
  this.zoom(args.value['zoomFactor'], args.value['zoomPoint']);
@@ -17269,12 +17273,12 @@ class Transform {
17269
17273
  parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
17270
17274
  const panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
17271
17275
  parent.trigger('panning', panEventArgs);
17272
- this.panEvent(panEventArgs, xDiff, yDiff);
17273
- }
17274
- panEvent(panEventArgs, xDiff, yDiff) {
17275
17276
  if (panEventArgs.cancel) {
17276
17277
  return;
17277
17278
  }
17279
+ this.panEvent(xDiff, yDiff);
17280
+ }
17281
+ panEvent(xDiff, yDiff, isPanMethod) {
17278
17282
  const parent = this.parent;
17279
17283
  let isObjCreated = false;
17280
17284
  if (parent.activeObj.shape && parent.activeObj.shape === 'shape') {
@@ -17312,8 +17316,13 @@ class Transform {
17312
17316
  }
17313
17317
  if (parent.transform.degree === 0) {
17314
17318
  let point;
17315
- if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
17316
- point = this.updatePanPoints();
17319
+ if ((isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) || isPanMethod) {
17320
+ if (isPanMethod) {
17321
+ point = this.updatePanPoints(xDiff, yDiff);
17322
+ }
17323
+ else {
17324
+ point = this.updatePanPoints();
17325
+ }
17317
17326
  }
17318
17327
  else {
17319
17328
  point = { x: xDiff, y: yDiff };
@@ -17334,8 +17343,13 @@ class Transform {
17334
17343
  else {
17335
17344
  const tempFlipState = parent.transform.currFlipState;
17336
17345
  parent.isCropTab = true;
17337
- if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
17338
- parent.panPoint.currentPannedPoint = this.updatePanPoints();
17346
+ if ((isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) || isPanMethod) {
17347
+ if (isPanMethod) {
17348
+ parent.panPoint.currentPannedPoint = this.updatePanPoints(xDiff, yDiff);
17349
+ }
17350
+ else {
17351
+ parent.panPoint.currentPannedPoint = this.updatePanPoints();
17352
+ }
17339
17353
  }
17340
17354
  else {
17341
17355
  parent.panPoint.currentPannedPoint = { x: xDiff, y: yDiff };
@@ -17622,7 +17636,7 @@ class Transform {
17622
17636
  parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: actPoint,
17623
17637
  obj: parent.activeObj, isMouseMove: null, x: null, y: null } });
17624
17638
  }
17625
- pan(value) {
17639
+ pan(value, x, y) {
17626
17640
  const parent = this.parent;
17627
17641
  if (!parent.disabled && parent.isImageLoaded) {
17628
17642
  if (value) {
@@ -17632,6 +17646,18 @@ class Transform {
17632
17646
  parent.notify('selection', { prop: 'setDragCanvas', value: { bool: true } });
17633
17647
  parent.lowerCanvas.style.cursor = parent.upperCanvas.style.cursor = parent.cursor = 'grab';
17634
17648
  parent.notify('selection', { prop: 'setPanDown', onPropertyChange: false, value: { panDown: null } });
17649
+ if (x || y) {
17650
+ x = x ? x : 0;
17651
+ y = y ? y : 0;
17652
+ if (isNullOrUndefined(this.panMove)) {
17653
+ this.panMove = { x: x, y: y };
17654
+ }
17655
+ if (isNullOrUndefined(this.tempPanMove)) {
17656
+ this.tempPanMove = { x: this.panMove.x, y: this.panMove.y };
17657
+ }
17658
+ this.panEvent(x, y, true);
17659
+ this.tempPanMove = null;
17660
+ }
17635
17661
  }
17636
17662
  else {
17637
17663
  parent.togglePan = parent.currObjType.isCustomCrop = false;
@@ -17946,6 +17972,9 @@ class Transform {
17946
17972
  const cxtTbar = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
17947
17973
  canvasMaxHeight -= cxtTbar ? cxtTbar.clientHeight : 0;
17948
17974
  }
17975
+ if (!isImgShape && parent.element.clientHeight === 0) {
17976
+ canvasMaxHeight = 0;
17977
+ }
17949
17978
  if (isNullOrUndefined(isImgShape)) {
17950
17979
  if (canvasMaxWidth > 30) {
17951
17980
  canvasMaxWidth -= 30;
@@ -17982,7 +18011,7 @@ class Transform {
17982
18011
  }
17983
18012
  return { width: cssMaxWidth, height: cssMaxHeight };
17984
18013
  }
17985
- updatePanPoints() {
18014
+ updatePanPoints(x, y) {
17986
18015
  const parent = this.parent;
17987
18016
  const tempActObj = extend({}, parent.activeObj, {}, true);
17988
18017
  const tempDestLeft = parent.img.destLeft;
@@ -17992,6 +18021,10 @@ class Transform {
17992
18021
  }
17993
18022
  let xDiff = this.panMove.x - this.tempPanMove.x;
17994
18023
  let yDiff = this.panMove.y - this.tempPanMove.y;
18024
+ if (x || y) {
18025
+ xDiff = x;
18026
+ yDiff = y;
18027
+ }
17995
18028
  parent.img.destLeft += xDiff;
17996
18029
  parent.img.destTop += yDiff;
17997
18030
  this.limitPan();
@@ -20456,14 +20489,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20456
20489
  * Enable or disable a panning on the Image Editor.
20457
20490
  *
20458
20491
  * @param {boolean} value - Specifies a value whether enable or disable panning.
20492
+ * @param {number} x - Optional, Specifies a value to pan the image horizontally.
20493
+ * @param {number} y - Optional, Specifies a value to pan the image vertically.
20459
20494
  *
20460
20495
  * @remarks
20461
20496
  * This option will take into effect once the image's visibility is hidden when zooming an image or selection has been performed.
20462
20497
  *
20463
20498
  * @returns {void}.
20464
20499
  */
20465
- pan(value) {
20466
- this.notify('transform', { prop: 'pan', onPropertyChange: false, value: { value: value } });
20500
+ pan(value, x, y) {
20501
+ this.notify('transform', { prop: 'pan', onPropertyChange: false, value: { value: value, x: x, y: y } });
20467
20502
  }
20468
20503
  /**
20469
20504
  * Zoom in or out on a point in the image editor.
@@ -21445,7 +21480,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21445
21480
  this.notify('toolbar', { prop: 'destroy-qa-toolbar' });
21446
21481
  this.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
21447
21482
  }
21448
- else if ((this.activeObj.activePoint.width !== 0 && this.activeObj.activePoint.height !== 0) ||
21483
+ else if ((this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) ||
21449
21484
  (this.activeObj.shape === 'path' && this.activeObj.pointColl.length > 0)) {
21450
21485
  if (this.activeObj.shape === 'image') {
21451
21486
  this.notify('draw', { prop: 'setImageApply', onPropertyChange: false, value: { bool: true } });
@@ -21606,6 +21641,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21606
21641
  * An string which returns the SelectionType.
21607
21642
  */
21608
21643
  getSelectionType(type) {
21644
+ type = type === 'crop-custom' ? 'CropCustom' : type;
21609
21645
  const typeToSelectionType = { 'CropCustom': 'Custom', 'CropSquare': 'Square', 'CropCircle': 'Circle',
21610
21646
  'Crop3:2': '3:2', 'Crop4:3': '4:3', 'Crop5:4': '5:4', 'Crop7:5': '7:5', 'Crop16:9': '16:9',
21611
21647
  'Crop2:3': '2:3', 'Crop3:4': '3:4', 'Crop4:5': '4:5', 'Crop5:7': '5:7', 'Crop9:16': '9:16' };
@@ -24145,6 +24181,10 @@ class ToolbarModule {
24145
24181
  this.parent.showDialogPopup();
24146
24182
  }
24147
24183
  }
24184
+ triggerTbarClickEvent(args) {
24185
+ const clickEvent = { item: args.item, originalEvent: args.event };
24186
+ this.parent.trigger('toolbarItemClicked', clickEvent);
24187
+ }
24148
24188
  renderAnnotationBtn(isContextualToolbar) {
24149
24189
  const parent = this.parent;
24150
24190
  let isCustomized = false;
@@ -24233,6 +24273,7 @@ class ToolbarModule {
24233
24273
  }
24234
24274
  },
24235
24275
  select: (args) => {
24276
+ this.triggerTbarClickEvent(args);
24236
24277
  parent.okBtn();
24237
24278
  let isCropSelection = false;
24238
24279
  let splitWords;
@@ -24253,6 +24294,9 @@ class ToolbarModule {
24253
24294
  }
24254
24295
  const obj = { currentFreehandDrawIndex: null };
24255
24296
  parent.notify('freehand-draw', { prop: 'getCurrentFreehandDrawIndex', value: { obj: obj } });
24297
+ const prevObj = { shapeSettingsObj: {} };
24298
+ let shapeSettings;
24299
+ let shapeChangingArgs;
24256
24300
  drpDownBtn.iconCss = 'e-icons ' + this.getCurrentShapeIcon(args.item.id);
24257
24301
  switch (args.item.id) {
24258
24302
  case 'pen':
@@ -24260,6 +24304,12 @@ class ToolbarModule {
24260
24304
  parent.notify('draw', { prop: 'setTempCurrentFreehandDrawIndex', value: { tempCurrentFreehandDrawIndex: obj['currentFreehandDrawIndex'] } });
24261
24305
  this.currentToolbar = 'pen';
24262
24306
  parent.freeHandDraw(true);
24307
+ parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: prevObj } });
24308
+ shapeSettings = prevObj['shapeSettingsObj'];
24309
+ shapeSettings.type = ShapeType.FreehandDraw;
24310
+ shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
24311
+ currentShapeSettings: shapeSettings };
24312
+ parent.notify('freehand-draw', { prop: 'triggerShapeChanging', value: { shapeChangingArgs: shapeChangingArgs } });
24263
24313
  break;
24264
24314
  case 'text':
24265
24315
  this.currentToolbar = 'text';
@@ -24269,12 +24319,22 @@ class ToolbarModule {
24269
24319
  this.currentToolbar = 'shapes';
24270
24320
  parent.element.querySelector('#' + id + '_fileUpload').click();
24271
24321
  break;
24272
- default:
24322
+ case 'ellipse':
24323
+ case 'arrow':
24324
+ case 'line':
24325
+ case 'rectangle':
24326
+ case 'path':
24273
24327
  this.currentToolbar = 'shapes';
24274
24328
  this.setInitialShapeSettings(args);
24275
24329
  parent.notify('selection', { prop: 'annotate', value: { shape: args.item.id } });
24276
24330
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
24277
24331
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
24332
+ parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: prevObj } });
24333
+ shapeSettings = prevObj['shapeSettingsObj'];
24334
+ shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
24335
+ currentShapeSettings: shapeSettings };
24336
+ parent.trigger('shapeChanging', shapeChangingArgs);
24337
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', value: { shapeSettings: shapeChangingArgs.currentShapeSettings } });
24278
24338
  break;
24279
24339
  }
24280
24340
  this.updateToolbarItems();
@@ -24379,6 +24439,7 @@ class ToolbarModule {
24379
24439
  },
24380
24440
  items: items,
24381
24441
  select: (args) => {
24442
+ this.triggerTbarClickEvent(args);
24382
24443
  this.cropSelect(args);
24383
24444
  drpDownBtn.iconCss = 'e-icons ' + this.getCurrentShapeIcon('crop-' + args.item.id);
24384
24445
  drpDownBtn.content = Browser.isDevice ? null : parent.toPascalCase(args.item.id);
@@ -24413,7 +24474,11 @@ class ToolbarModule {
24413
24474
  elem.style.display = 'block';
24414
24475
  }
24415
24476
  },
24416
- items: items, select: parent.transformSelect.bind(this),
24477
+ items: items,
24478
+ select: (args) => {
24479
+ this.triggerTbarClickEvent(args);
24480
+ parent.transformSelect.bind(this);
24481
+ },
24417
24482
  iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
24418
24483
  });
24419
24484
  drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
@@ -24431,6 +24496,7 @@ class ToolbarModule {
24431
24496
  // Initialize the DropDownButton component.
24432
24497
  const saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
24433
24498
  select: (args) => {
24499
+ this.triggerTbarClickEvent(args);
24434
24500
  parent.export(args.item.text);
24435
24501
  parent.isChangesSaved = true;
24436
24502
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -24903,6 +24969,7 @@ class ToolbarModule {
24903
24969
  }
24904
24970
  },
24905
24971
  select: (args) => {
24972
+ this.triggerTbarClickEvent(args);
24906
24973
  spanElem.textContent = args.item.text;
24907
24974
  parent.updateStrokeWidth(args.item.id);
24908
24975
  if (Browser.isDevice) {
@@ -24959,6 +25026,7 @@ class ToolbarModule {
24959
25026
  }
24960
25027
  },
24961
25028
  select: (args) => {
25029
+ this.triggerTbarClickEvent(args);
24962
25030
  spanElem.textContent = args.item.text;
24963
25031
  parent.updateArrow('startArrow', args.item.id);
24964
25032
  }
@@ -25000,6 +25068,7 @@ class ToolbarModule {
25000
25068
  }
25001
25069
  },
25002
25070
  select: (args) => {
25071
+ this.triggerTbarClickEvent(args);
25003
25072
  spanElem.textContent = args.item.text;
25004
25073
  parent.updateArrow('endArrow', args.item.id);
25005
25074
  }
@@ -25236,6 +25305,7 @@ class ToolbarModule {
25236
25305
  }
25237
25306
  },
25238
25307
  select: (args) => {
25308
+ this.triggerTbarClickEvent(args);
25239
25309
  spanElem.textContent = args.item.text;
25240
25310
  if (Browser.isDevice) {
25241
25311
  spanElem.setAttribute('style', 'font-family:' + args.item.id);
@@ -25264,6 +25334,7 @@ class ToolbarModule {
25264
25334
  args.element.querySelector('[aria-label *= ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
25265
25335
  },
25266
25336
  select: (args) => {
25337
+ this.triggerTbarClickEvent(args);
25267
25338
  fontSizeSpanElem.textContent = args.item.text;
25268
25339
  parent.updateFontSize(args.item.text);
25269
25340
  }
@@ -25695,6 +25766,7 @@ class ToolbarModule {
25695
25766
  parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
25696
25767
  id: id + '_pen_stroke'
25697
25768
  }));
25769
+ const presentVal = parent.activeObj.strokeSettings.strokeColor;
25698
25770
  const penColor = new ColorPicker({
25699
25771
  modeSwitcher: false, value: '#fff',
25700
25772
  showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
@@ -25720,6 +25792,9 @@ class ToolbarModule {
25720
25792
  }, '#' + id + '_penColorBtn');
25721
25793
  penColor.inline = true;
25722
25794
  penColor.value = penColor.getValue(parent.activeObj.strokeSettings.strokeColor, 'rgba');
25795
+ if (penColor.value === 'null') {
25796
+ penColor.value = presentVal;
25797
+ }
25723
25798
  const obj = { tempFreeHandDrawEditingStyles: null };
25724
25799
  parent.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
25725
25800
  const indexObj = { freehandSelectedIndex: null };
@@ -25768,6 +25843,7 @@ class ToolbarModule {
25768
25843
  args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
25769
25844
  },
25770
25845
  select: (args) => {
25846
+ this.triggerTbarClickEvent(args);
25771
25847
  spanElem.textContent = args.item.text;
25772
25848
  parent.updatePenStrokeWidth(args.item.id);
25773
25849
  if (Browser.isDevice) {
@@ -26075,6 +26151,7 @@ class ToolbarModule {
26075
26151
  }
26076
26152
  },
26077
26153
  select: (args) => {
26154
+ this.triggerTbarClickEvent(args);
26078
26155
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26079
26156
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26080
26157
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26150,6 +26227,7 @@ class ToolbarModule {
26150
26227
  }
26151
26228
  },
26152
26229
  select: (args) => {
26230
+ this.triggerTbarClickEvent(args);
26153
26231
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26154
26232
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26155
26233
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26225,6 +26303,7 @@ class ToolbarModule {
26225
26303
  }
26226
26304
  },
26227
26305
  select: (args) => {
26306
+ this.triggerTbarClickEvent(args);
26228
26307
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26229
26308
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26230
26309
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26301,6 +26380,7 @@ class ToolbarModule {
26301
26380
  }
26302
26381
  },
26303
26382
  select: (args) => {
26383
+ this.triggerTbarClickEvent(args);
26304
26384
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26305
26385
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26306
26386
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26376,6 +26456,7 @@ class ToolbarModule {
26376
26456
  }
26377
26457
  },
26378
26458
  select: (args) => {
26459
+ this.triggerTbarClickEvent(args);
26379
26460
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26380
26461
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26381
26462
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26449,6 +26530,7 @@ class ToolbarModule {
26449
26530
  }
26450
26531
  },
26451
26532
  select: (args) => {
26533
+ this.triggerTbarClickEvent(args);
26452
26534
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26453
26535
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26454
26536
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),