@syncfusion/ej2-image-editor 25.1.37 → 25.1.38

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() {
@@ -16256,7 +16259,7 @@ class Transform {
16256
16259
  this.resetZoom();
16257
16260
  break;
16258
16261
  case 'pan':
16259
- this.pan(args.value['value']);
16262
+ this.pan(args.value['value'], args.value['x'], args.value['y']);
16260
16263
  break;
16261
16264
  case 'zoom':
16262
16265
  this.zoom(args.value['zoomFactor'], args.value['zoomPoint']);
@@ -17269,12 +17272,12 @@ class Transform {
17269
17272
  parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
17270
17273
  const panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
17271
17274
  parent.trigger('panning', panEventArgs);
17272
- this.panEvent(panEventArgs, xDiff, yDiff);
17273
- }
17274
- panEvent(panEventArgs, xDiff, yDiff) {
17275
17275
  if (panEventArgs.cancel) {
17276
17276
  return;
17277
17277
  }
17278
+ this.panEvent(xDiff, yDiff);
17279
+ }
17280
+ panEvent(xDiff, yDiff, isPanMethod) {
17278
17281
  const parent = this.parent;
17279
17282
  let isObjCreated = false;
17280
17283
  if (parent.activeObj.shape && parent.activeObj.shape === 'shape') {
@@ -17312,8 +17315,13 @@ class Transform {
17312
17315
  }
17313
17316
  if (parent.transform.degree === 0) {
17314
17317
  let point;
17315
- if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
17316
- point = this.updatePanPoints();
17318
+ if ((isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) || isPanMethod) {
17319
+ if (isPanMethod) {
17320
+ point = this.updatePanPoints(xDiff, yDiff);
17321
+ }
17322
+ else {
17323
+ point = this.updatePanPoints();
17324
+ }
17317
17325
  }
17318
17326
  else {
17319
17327
  point = { x: xDiff, y: yDiff };
@@ -17334,8 +17342,13 @@ class Transform {
17334
17342
  else {
17335
17343
  const tempFlipState = parent.transform.currFlipState;
17336
17344
  parent.isCropTab = true;
17337
- if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
17338
- parent.panPoint.currentPannedPoint = this.updatePanPoints();
17345
+ if ((isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) || isPanMethod) {
17346
+ if (isPanMethod) {
17347
+ parent.panPoint.currentPannedPoint = this.updatePanPoints(xDiff, yDiff);
17348
+ }
17349
+ else {
17350
+ parent.panPoint.currentPannedPoint = this.updatePanPoints();
17351
+ }
17339
17352
  }
17340
17353
  else {
17341
17354
  parent.panPoint.currentPannedPoint = { x: xDiff, y: yDiff };
@@ -17622,7 +17635,7 @@ class Transform {
17622
17635
  parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: actPoint,
17623
17636
  obj: parent.activeObj, isMouseMove: null, x: null, y: null } });
17624
17637
  }
17625
- pan(value) {
17638
+ pan(value, x, y) {
17626
17639
  const parent = this.parent;
17627
17640
  if (!parent.disabled && parent.isImageLoaded) {
17628
17641
  if (value) {
@@ -17632,6 +17645,15 @@ class Transform {
17632
17645
  parent.notify('selection', { prop: 'setDragCanvas', value: { bool: true } });
17633
17646
  parent.lowerCanvas.style.cursor = parent.upperCanvas.style.cursor = parent.cursor = 'grab';
17634
17647
  parent.notify('selection', { prop: 'setPanDown', onPropertyChange: false, value: { panDown: null } });
17648
+ if (x || y) {
17649
+ x = x ? x : 0;
17650
+ y = y ? y : 0;
17651
+ if (isNullOrUndefined(this.tempPanMove)) {
17652
+ this.tempPanMove = { x: this.panMove.x, y: this.panMove.y };
17653
+ }
17654
+ this.panEvent(x, y, true);
17655
+ this.tempPanMove = null;
17656
+ }
17635
17657
  }
17636
17658
  else {
17637
17659
  parent.togglePan = parent.currObjType.isCustomCrop = false;
@@ -17946,6 +17968,9 @@ class Transform {
17946
17968
  const cxtTbar = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
17947
17969
  canvasMaxHeight -= cxtTbar ? cxtTbar.clientHeight : 0;
17948
17970
  }
17971
+ if (!isImgShape && parent.element.clientHeight === 0) {
17972
+ canvasMaxHeight = 0;
17973
+ }
17949
17974
  if (isNullOrUndefined(isImgShape)) {
17950
17975
  if (canvasMaxWidth > 30) {
17951
17976
  canvasMaxWidth -= 30;
@@ -17982,7 +18007,7 @@ class Transform {
17982
18007
  }
17983
18008
  return { width: cssMaxWidth, height: cssMaxHeight };
17984
18009
  }
17985
- updatePanPoints() {
18010
+ updatePanPoints(x, y) {
17986
18011
  const parent = this.parent;
17987
18012
  const tempActObj = extend({}, parent.activeObj, {}, true);
17988
18013
  const tempDestLeft = parent.img.destLeft;
@@ -17992,6 +18017,10 @@ class Transform {
17992
18017
  }
17993
18018
  let xDiff = this.panMove.x - this.tempPanMove.x;
17994
18019
  let yDiff = this.panMove.y - this.tempPanMove.y;
18020
+ if (x || y) {
18021
+ xDiff = x;
18022
+ yDiff = y;
18023
+ }
17995
18024
  parent.img.destLeft += xDiff;
17996
18025
  parent.img.destTop += yDiff;
17997
18026
  this.limitPan();
@@ -20456,14 +20485,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20456
20485
  * Enable or disable a panning on the Image Editor.
20457
20486
  *
20458
20487
  * @param {boolean} value - Specifies a value whether enable or disable panning.
20488
+ * @param {number} x - Optional, Specifies a value to pan the image horizontally.
20489
+ * @param {number} y - Optional, Specifies a value to pan the image vertically.
20459
20490
  *
20460
20491
  * @remarks
20461
20492
  * This option will take into effect once the image's visibility is hidden when zooming an image or selection has been performed.
20462
20493
  *
20463
20494
  * @returns {void}.
20464
20495
  */
20465
- pan(value) {
20466
- this.notify('transform', { prop: 'pan', onPropertyChange: false, value: { value: value } });
20496
+ pan(value, x, y) {
20497
+ this.notify('transform', { prop: 'pan', onPropertyChange: false, value: { value: value, x: x, y: y } });
20467
20498
  }
20468
20499
  /**
20469
20500
  * Zoom in or out on a point in the image editor.
@@ -24145,6 +24176,10 @@ class ToolbarModule {
24145
24176
  this.parent.showDialogPopup();
24146
24177
  }
24147
24178
  }
24179
+ triggerTbarClickEvent(args) {
24180
+ const clickEvent = { item: args.item, originalEvent: args.event };
24181
+ this.parent.trigger('toolbarItemClicked', clickEvent);
24182
+ }
24148
24183
  renderAnnotationBtn(isContextualToolbar) {
24149
24184
  const parent = this.parent;
24150
24185
  let isCustomized = false;
@@ -24233,6 +24268,7 @@ class ToolbarModule {
24233
24268
  }
24234
24269
  },
24235
24270
  select: (args) => {
24271
+ this.triggerTbarClickEvent(args);
24236
24272
  parent.okBtn();
24237
24273
  let isCropSelection = false;
24238
24274
  let splitWords;
@@ -24253,6 +24289,9 @@ class ToolbarModule {
24253
24289
  }
24254
24290
  const obj = { currentFreehandDrawIndex: null };
24255
24291
  parent.notify('freehand-draw', { prop: 'getCurrentFreehandDrawIndex', value: { obj: obj } });
24292
+ const prevObj = { shapeSettingsObj: {} };
24293
+ let shapeSettings;
24294
+ let shapeChangingArgs;
24256
24295
  drpDownBtn.iconCss = 'e-icons ' + this.getCurrentShapeIcon(args.item.id);
24257
24296
  switch (args.item.id) {
24258
24297
  case 'pen':
@@ -24260,6 +24299,12 @@ class ToolbarModule {
24260
24299
  parent.notify('draw', { prop: 'setTempCurrentFreehandDrawIndex', value: { tempCurrentFreehandDrawIndex: obj['currentFreehandDrawIndex'] } });
24261
24300
  this.currentToolbar = 'pen';
24262
24301
  parent.freeHandDraw(true);
24302
+ parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: prevObj } });
24303
+ shapeSettings = prevObj['shapeSettingsObj'];
24304
+ shapeSettings.type = ShapeType.FreehandDraw;
24305
+ shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
24306
+ currentShapeSettings: shapeSettings };
24307
+ parent.notify('freehand-draw', { prop: 'triggerShapeChanging', value: { shapeChangingArgs: shapeChangingArgs } });
24263
24308
  break;
24264
24309
  case 'text':
24265
24310
  this.currentToolbar = 'text';
@@ -24269,12 +24314,22 @@ class ToolbarModule {
24269
24314
  this.currentToolbar = 'shapes';
24270
24315
  parent.element.querySelector('#' + id + '_fileUpload').click();
24271
24316
  break;
24272
- default:
24317
+ case 'ellipse':
24318
+ case 'arrow':
24319
+ case 'line':
24320
+ case 'rectangle':
24321
+ case 'path':
24273
24322
  this.currentToolbar = 'shapes';
24274
24323
  this.setInitialShapeSettings(args);
24275
24324
  parent.notify('selection', { prop: 'annotate', value: { shape: args.item.id } });
24276
24325
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
24277
24326
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
24327
+ parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: prevObj } });
24328
+ shapeSettings = prevObj['shapeSettingsObj'];
24329
+ shapeChangingArgs = { cancel: false, action: 'insert', previousShapeSettings: shapeSettings,
24330
+ currentShapeSettings: shapeSettings };
24331
+ parent.trigger('shapeChanging', shapeChangingArgs);
24332
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', value: { shapeSettings: shapeChangingArgs.currentShapeSettings } });
24278
24333
  break;
24279
24334
  }
24280
24335
  this.updateToolbarItems();
@@ -24379,6 +24434,7 @@ class ToolbarModule {
24379
24434
  },
24380
24435
  items: items,
24381
24436
  select: (args) => {
24437
+ this.triggerTbarClickEvent(args);
24382
24438
  this.cropSelect(args);
24383
24439
  drpDownBtn.iconCss = 'e-icons ' + this.getCurrentShapeIcon('crop-' + args.item.id);
24384
24440
  drpDownBtn.content = Browser.isDevice ? null : parent.toPascalCase(args.item.id);
@@ -24413,7 +24469,11 @@ class ToolbarModule {
24413
24469
  elem.style.display = 'block';
24414
24470
  }
24415
24471
  },
24416
- items: items, select: parent.transformSelect.bind(this),
24472
+ items: items,
24473
+ select: (args) => {
24474
+ this.triggerTbarClickEvent(args);
24475
+ parent.transformSelect.bind(this);
24476
+ },
24417
24477
  iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
24418
24478
  });
24419
24479
  drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
@@ -24431,6 +24491,7 @@ class ToolbarModule {
24431
24491
  // Initialize the DropDownButton component.
24432
24492
  const saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
24433
24493
  select: (args) => {
24494
+ this.triggerTbarClickEvent(args);
24434
24495
  parent.export(args.item.text);
24435
24496
  parent.isChangesSaved = true;
24436
24497
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -24903,6 +24964,7 @@ class ToolbarModule {
24903
24964
  }
24904
24965
  },
24905
24966
  select: (args) => {
24967
+ this.triggerTbarClickEvent(args);
24906
24968
  spanElem.textContent = args.item.text;
24907
24969
  parent.updateStrokeWidth(args.item.id);
24908
24970
  if (Browser.isDevice) {
@@ -24959,6 +25021,7 @@ class ToolbarModule {
24959
25021
  }
24960
25022
  },
24961
25023
  select: (args) => {
25024
+ this.triggerTbarClickEvent(args);
24962
25025
  spanElem.textContent = args.item.text;
24963
25026
  parent.updateArrow('startArrow', args.item.id);
24964
25027
  }
@@ -25000,6 +25063,7 @@ class ToolbarModule {
25000
25063
  }
25001
25064
  },
25002
25065
  select: (args) => {
25066
+ this.triggerTbarClickEvent(args);
25003
25067
  spanElem.textContent = args.item.text;
25004
25068
  parent.updateArrow('endArrow', args.item.id);
25005
25069
  }
@@ -25236,6 +25300,7 @@ class ToolbarModule {
25236
25300
  }
25237
25301
  },
25238
25302
  select: (args) => {
25303
+ this.triggerTbarClickEvent(args);
25239
25304
  spanElem.textContent = args.item.text;
25240
25305
  if (Browser.isDevice) {
25241
25306
  spanElem.setAttribute('style', 'font-family:' + args.item.id);
@@ -25264,6 +25329,7 @@ class ToolbarModule {
25264
25329
  args.element.querySelector('[aria-label *= ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
25265
25330
  },
25266
25331
  select: (args) => {
25332
+ this.triggerTbarClickEvent(args);
25267
25333
  fontSizeSpanElem.textContent = args.item.text;
25268
25334
  parent.updateFontSize(args.item.text);
25269
25335
  }
@@ -25695,6 +25761,7 @@ class ToolbarModule {
25695
25761
  parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
25696
25762
  id: id + '_pen_stroke'
25697
25763
  }));
25764
+ const presentVal = parent.activeObj.strokeSettings.strokeColor;
25698
25765
  const penColor = new ColorPicker({
25699
25766
  modeSwitcher: false, value: '#fff',
25700
25767
  showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
@@ -25720,6 +25787,9 @@ class ToolbarModule {
25720
25787
  }, '#' + id + '_penColorBtn');
25721
25788
  penColor.inline = true;
25722
25789
  penColor.value = penColor.getValue(parent.activeObj.strokeSettings.strokeColor, 'rgba');
25790
+ if (penColor.value === 'null') {
25791
+ penColor.value = presentVal;
25792
+ }
25723
25793
  const obj = { tempFreeHandDrawEditingStyles: null };
25724
25794
  parent.notify('freehand-draw', { prop: 'getTempFreeHandDrawEditingStyles', value: { obj: obj } });
25725
25795
  const indexObj = { freehandSelectedIndex: null };
@@ -25768,6 +25838,7 @@ class ToolbarModule {
25768
25838
  args.element.querySelector('[aria-label = ' + '"' + activeBtn + '"' + ']').classList.add('e-selected-btn');
25769
25839
  },
25770
25840
  select: (args) => {
25841
+ this.triggerTbarClickEvent(args);
25771
25842
  spanElem.textContent = args.item.text;
25772
25843
  parent.updatePenStrokeWidth(args.item.id);
25773
25844
  if (Browser.isDevice) {
@@ -26075,6 +26146,7 @@ class ToolbarModule {
26075
26146
  }
26076
26147
  },
26077
26148
  select: (args) => {
26149
+ this.triggerTbarClickEvent(args);
26078
26150
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26079
26151
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26080
26152
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26150,6 +26222,7 @@ class ToolbarModule {
26150
26222
  }
26151
26223
  },
26152
26224
  select: (args) => {
26225
+ this.triggerTbarClickEvent(args);
26153
26226
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26154
26227
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26155
26228
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26225,6 +26298,7 @@ class ToolbarModule {
26225
26298
  }
26226
26299
  },
26227
26300
  select: (args) => {
26301
+ this.triggerTbarClickEvent(args);
26228
26302
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26229
26303
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26230
26304
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26301,6 +26375,7 @@ class ToolbarModule {
26301
26375
  }
26302
26376
  },
26303
26377
  select: (args) => {
26378
+ this.triggerTbarClickEvent(args);
26304
26379
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26305
26380
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26306
26381
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26376,6 +26451,7 @@ class ToolbarModule {
26376
26451
  }
26377
26452
  },
26378
26453
  select: (args) => {
26454
+ this.triggerTbarClickEvent(args);
26379
26455
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26380
26456
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26381
26457
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),
@@ -26449,6 +26525,7 @@ class ToolbarModule {
26449
26525
  }
26450
26526
  },
26451
26527
  select: (args) => {
26528
+ this.triggerTbarClickEvent(args);
26452
26529
  prevFrameSettings = { type: parent.toPascalCase(parent.frameObj.type), color: parent.frameObj.color,
26453
26530
  gradientColor: parent.frameObj.gradientColor, size: parent.frameObj.size, inset: parent.frameObj.inset,
26454
26531
  offset: parent.frameObj.offset, borderRadius: parent.frameObj.radius, frameLineStyle: parent.toPascalCase(parent.frameObj.border),