@syncfusion/ej2-image-editor 24.1.41 → 24.1.43

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.
@@ -1550,7 +1550,7 @@ var Draw = /** @__PURE__ @class */ (function () {
1550
1550
  var width;
1551
1551
  var height;
1552
1552
  var canvasWidth = parent.lowerCanvas.clientWidth;
1553
- var canvasHeight = parent.lowerCanvas.clientHeight;
1553
+ var canvasHeight = parent.lowerCanvas.clientHeight + 1;
1554
1554
  var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
1555
1555
  if (parent.transform.zoomFactor > 0 && this.currSelPoint) {
1556
1556
  var activeObj = extend({}, parent.activeObj, {}, true);
@@ -3426,6 +3426,7 @@ var Draw = /** @__PURE__ @class */ (function () {
3426
3426
  hideSpinner(parent.element);
3427
3427
  parent.element.style.opacity = '1';
3428
3428
  proxy.updateBaseImgCanvas();
3429
+ var fileOpened = { fileName: _this.fileName, fileType: _this.fileType, isValidImage: true };
3429
3430
  proxy.updateCanvas();
3430
3431
  if (parent.currObjType.isUndoZoom) {
3431
3432
  parent.currObjType.isUndoZoom = false;
@@ -3455,6 +3456,14 @@ var Draw = /** @__PURE__ @class */ (function () {
3455
3456
  - parent.toolbarHeight * 2) - 1 + 'px';
3456
3457
  }
3457
3458
  }
3459
+ if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3460
+ if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3461
+ parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3462
+ }
3463
+ else {
3464
+ parent.trigger('fileOpened', fileOpened);
3465
+ }
3466
+ }
3458
3467
  };
3459
3468
  parent.baseImg.onerror = function () {
3460
3469
  hideSpinner(parent.element);
@@ -3480,7 +3489,6 @@ var Draw = /** @__PURE__ @class */ (function () {
3480
3489
  };
3481
3490
  Draw.prototype.updateCanvas = function () {
3482
3491
  var parent = this.parent;
3483
- var fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
3484
3492
  parent.img.srcWidth = parent.baseImgCanvas.width;
3485
3493
  parent.img.srcHeight = parent.baseImgCanvas.height;
3486
3494
  var obj = { width: 0, height: 0 };
@@ -3516,14 +3524,6 @@ var Draw = /** @__PURE__ @class */ (function () {
3516
3524
  if (parent.disabled) {
3517
3525
  parent.element.setAttribute('class', 'e-disabled');
3518
3526
  }
3519
- if (parent.isImageLoaded && parent.element.style.opacity !== '0.5') {
3520
- if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
3521
- parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
3522
- }
3523
- else {
3524
- parent.trigger('fileOpened', fileOpened);
3525
- }
3526
- }
3527
3527
  if (parent.zoomSettings.zoomFactor !== 1 || parent.zoomSettings.zoomPoint) {
3528
3528
  parent.zoom(parent.zoomSettings.zoomFactor, parent.zoomSettings.zoomPoint);
3529
3529
  }
@@ -15157,12 +15157,14 @@ var Shape = /** @__PURE__ @class */ (function () {
15157
15157
  return;
15158
15158
  }
15159
15159
  else if (e.type === 'dblclick') {
15160
+ var activeObj = extend({}, parent.activeObj, {}, true);
15160
15161
  var objColl = extend([], parent.objColl, [], true);
15161
15162
  var obj = { bool: null };
15162
15163
  parent.notify('selection', { prop: 'findTargetObj', onPropertyChange: false,
15163
15164
  value: { x: e.clientX, y: e.clientY, isCrop: false, obj: obj } });
15164
15165
  parent.objColl = objColl;
15165
15166
  if (!obj['bool'] || parent.activeObj.shape !== 'text') {
15167
+ parent.activeObj = extend({}, activeObj, {}, true);
15166
15168
  return;
15167
15169
  }
15168
15170
  }
@@ -19065,12 +19067,16 @@ var Transform = /** @__PURE__ @class */ (function () {
19065
19067
  };
19066
19068
  Transform.prototype.straightenImage = function (degree) {
19067
19069
  var parent = this.parent;
19070
+ if (parent.toolbar && parent.toolbar.length === 0) {
19071
+ parent.notify('draw', { prop: 'select', onPropertyChange: false,
19072
+ value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
19073
+ }
19068
19074
  if (isBlazor()) {
19069
19075
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
19070
19076
  parent.performCropClick();
19071
19077
  }
19072
19078
  else {
19073
- parent.notify('toolbar', { prop: 'performCropTransformClick' });
19079
+ parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19074
19080
  }
19075
19081
  parent.setStraighten(degree, true);
19076
19082
  if ((isBlazor() && parent.events && parent.events.straightening.hasDelegate === false) || !isBlazor()) {
@@ -21247,6 +21253,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
21247
21253
  *
21248
21254
  */
21249
21255
  ImageEditor.prototype.select = function (type, startX, startY, width, height) {
21256
+ this.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: 'crop-' + type } });
21250
21257
  this.notify('draw', { prop: 'select', onPropertyChange: false,
21251
21258
  value: { type: type, startX: startX, startY: startY, width: width, height: height } });
21252
21259
  this.notify('draw', { prop: 'select', onPropertyChange: false,
@@ -23437,7 +23444,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23437
23444
  this.initializeThemeColl();
23438
23445
  };
23439
23446
  ImageEditor.prototype.initializeZoomSettings = function () {
23440
- if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
23447
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
23448
+ if (isNullOrUndefined(this.zoomSettings.zoomTrigger) || this.zoomSettings.zoomTrigger === 0) {
23441
23449
  this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar | ZoomTrigger.Commands);
23442
23450
  }
23443
23451
  if (isNullOrUndefined(this.selectionSettings.strokeColor)) {
@@ -24231,7 +24239,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24231
24239
  this.frameToolbarClick();
24232
24240
  break;
24233
24241
  case 'performCropTransformClick':
24234
- this.performCropTransformClick();
24242
+ this.performCropTransformClick(args.value['shape']);
24235
24243
  break;
24236
24244
  case 'duplicateShape':
24237
24245
  this.duplicateShape(args.value['isPreventUndoRedo'], true);
@@ -24425,6 +24433,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24425
24433
  else {
24426
24434
  this.defToolbarItems = leftItem.concat(mainItem, rightItem, zoomItem);
24427
24435
  }
24436
+ var args = { toolbarType: 'main', toolbarItems: this.defToolbarItems };
24437
+ parent.trigger('toolbarUpdating', args);
24438
+ this.defToolbarItems = args.toolbarItems;
24428
24439
  var toolbarObj = new Toolbar({
24429
24440
  width: '100%',
24430
24441
  items: this.defToolbarItems,
@@ -24459,6 +24470,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24459
24470
  var id = parent.element.id;
24460
24471
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
24461
24472
  var items = this.getMainToolbarItem();
24473
+ var args = { toolbarType: 'bottom-toolbar', toolbarItems: items };
24474
+ parent.trigger('toolbarUpdating', args);
24475
+ items = args.toolbarItems;
24462
24476
  var toolbarObj = new Toolbar({ items: items, width: '100%',
24463
24477
  created: function () {
24464
24478
  _this.renderAnnotationBtn();
@@ -24883,6 +24897,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
24883
24897
  else {
24884
24898
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
24885
24899
  }
24900
+ var args = { toolbarType: 'resize', toolbarItems: this.defToolbarItems };
24901
+ parent.trigger('toolbarUpdating', args);
24902
+ this.defToolbarItems = args.toolbarItems;
24886
24903
  var toolbar = new Toolbar({
24887
24904
  width: '100%',
24888
24905
  items: this.defToolbarItems,
@@ -25184,7 +25201,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25184
25201
  }
25185
25202
  }
25186
25203
  };
25187
- ToolbarModule.prototype.renderCropBtn = function () {
25204
+ ToolbarModule.prototype.renderCropBtn = function (shapeString) {
25188
25205
  var _this = this;
25189
25206
  var parent = this.parent;
25190
25207
  var items = [];
@@ -25221,7 +25238,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25221
25238
  }
25222
25239
  var iconCss;
25223
25240
  var shape;
25224
- if (parent.activeObj.shape) {
25241
+ if (shapeString) {
25242
+ iconCss = this.getCurrentShapeIcon(shapeString);
25243
+ shape = shapeString;
25244
+ }
25245
+ else if (parent.activeObj.shape) {
25225
25246
  iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
25226
25247
  shape = parent.activeObj.shape;
25227
25248
  }
@@ -25431,7 +25452,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25431
25452
  }
25432
25453
  return toolbarItems;
25433
25454
  };
25434
- ToolbarModule.prototype.initCropTransformToolbar = function () {
25455
+ ToolbarModule.prototype.initCropTransformToolbar = function (shape) {
25435
25456
  var _this = this;
25436
25457
  var parent = this.parent;
25437
25458
  var id = parent.element.id;
@@ -25445,12 +25466,15 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25445
25466
  else {
25446
25467
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
25447
25468
  }
25469
+ var args = { toolbarType: 'crop-transform', toolbarItems: this.defToolbarItems };
25470
+ parent.trigger('toolbarUpdating', args);
25471
+ this.defToolbarItems = args.toolbarItems;
25448
25472
  var toolbar = new Toolbar({
25449
25473
  width: '100%',
25450
25474
  items: this.defToolbarItems,
25451
25475
  clicked: this.defToolbarClicked.bind(this),
25452
25476
  created: function () {
25453
- _this.renderCropBtn();
25477
+ _this.renderCropBtn(shape);
25454
25478
  _this.renderStraightenSlider();
25455
25479
  _this.wireZoomBtnEvents();
25456
25480
  if (!Browser.isDevice) {
@@ -25492,8 +25516,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25492
25516
  && slider && slider.parentElement.scrollHeight > this.toolbarHeight) {
25493
25517
  this.toolbarHeight = parent.toolbarHeight = slider.parentElement.scrollHeight;
25494
25518
  }
25495
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25496
- toolbar.refreshOverflow();
25497
25519
  this.enableDisableTbrBtn();
25498
25520
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
25499
25521
  };
@@ -25553,6 +25575,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25553
25575
  else {
25554
25576
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
25555
25577
  }
25578
+ var args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25579
+ toolbarItems: this.defToolbarItems };
25580
+ parent.trigger('toolbarUpdating', args);
25581
+ this.defToolbarItems = args.toolbarItems;
25556
25582
  var toolbar = new Toolbar({
25557
25583
  width: '100%',
25558
25584
  items: this.defToolbarItems,
@@ -25959,6 +25985,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25959
25985
  else {
25960
25986
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
25961
25987
  }
25988
+ var args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
25989
+ parent.trigger('toolbarUpdating', args);
25990
+ this.defToolbarItems = args.toolbarItems;
25962
25991
  var toolbar = new Toolbar({
25963
25992
  width: '100%',
25964
25993
  items: this.defToolbarItems,
@@ -26083,8 +26112,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26083
26112
  else {
26084
26113
  fontFamily = parent.activeObj.textSettings.fontFamily;
26085
26114
  }
26086
- args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase()
26087
- + '"' + ']').classList.add('e-selected-btn');
26115
+ var elem = args.element.querySelector('[id *= ' + '"' + fontFamily.toLowerCase() + '"' + ']');
26116
+ if (elem) {
26117
+ elem.classList.add('e-selected-btn');
26118
+ }
26088
26119
  },
26089
26120
  select: function (args) {
26090
26121
  spanElem_2.textContent = args.item.text;
@@ -26122,14 +26153,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26122
26153
  fontSizeBtn_1.appendTo('#' + id + '_fontSizeBtn');
26123
26154
  }
26124
26155
  };
26125
- ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType) {
26156
+ ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType, shape) {
26126
26157
  var parent = this.parent;
26127
26158
  var id = parent.element.id;
26128
26159
  if (!parent.isImageLoaded || parent.isCropToolbar) {
26129
26160
  return;
26130
26161
  }
26131
- var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
26132
- var args = { toolbarType: item };
26162
+ var args = {};
26133
26163
  var aspectIcon;
26134
26164
  var nonAspectIcon;
26135
26165
  if (type !== 'filter' && type !== 'color') {
@@ -26195,7 +26225,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26195
26225
  else {
26196
26226
  args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
26197
26227
  }
26198
- parent.trigger('toolbarUpdating', args);
26199
26228
  this.initShapesToolbarItem(args.toolbarItems);
26200
26229
  break;
26201
26230
  case 'text':
@@ -26203,7 +26232,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26203
26232
  this.initMainToolbar(false, true, true);
26204
26233
  }
26205
26234
  args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
26206
- parent.trigger('toolbarUpdating', args);
26207
26235
  this.initTextToolbarItem(args.toolbarItems);
26208
26236
  break;
26209
26237
  case 'pen':
@@ -26211,7 +26239,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26211
26239
  this.initMainToolbar(false, true, true);
26212
26240
  }
26213
26241
  args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove', 'transparency'];
26214
- parent.trigger('toolbarUpdating', args);
26215
26242
  this.initPenToolbarItem(args.toolbarItems);
26216
26243
  break;
26217
26244
  case 'adjustment':
@@ -26253,7 +26280,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26253
26280
  this.initMainToolbar(false, true, true);
26254
26281
  }
26255
26282
  parent.updateCropTransformItems();
26256
- this.initCropTransformToolbar();
26283
+ this.initCropTransformToolbar(shape);
26257
26284
  if (Browser.isDevice) {
26258
26285
  this.updateContextualToolbar('color', 'straighten', true);
26259
26286
  }
@@ -26280,7 +26307,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26280
26307
  this.currToolbar = type;
26281
26308
  this.refreshDropDownBtn(isCropping);
26282
26309
  };
26283
- ToolbarModule.prototype.performCropTransformClick = function () {
26310
+ ToolbarModule.prototype.performCropTransformClick = function (shape) {
26284
26311
  var parent = this.parent;
26285
26312
  parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
26286
26313
  parent.tempStraighten = parent.transform.straighten;
@@ -26288,7 +26315,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26288
26315
  parent.okBtn();
26289
26316
  }
26290
26317
  parent.isStraightening = true;
26291
- this.refreshToolbar('croptransform');
26318
+ this.refreshToolbar('croptransform', null, null, null, null, shape);
26292
26319
  parent.notify('draw', { prop: 'setDestForStraighten' });
26293
26320
  parent.notify('draw', { prop: 'setTempDestForStraighten' });
26294
26321
  };
@@ -26481,6 +26508,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26481
26508
  else {
26482
26509
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
26483
26510
  }
26511
+ var args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26512
+ parent.trigger('toolbarUpdating', args);
26513
+ this.defToolbarItems = args.toolbarItems;
26484
26514
  var toolbar = new Toolbar({
26485
26515
  width: '100%',
26486
26516
  items: this.defToolbarItems,
@@ -26649,6 +26679,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26649
26679
  else {
26650
26680
  this.defToolbarItems = leftItem.concat(zoomItem, mainItem, rightItem);
26651
26681
  }
26682
+ var args = { toolbarType: 'finetune', toolbarItems: this.defToolbarItems };
26683
+ parent.trigger('toolbarUpdating', args);
26684
+ this.defToolbarItems = args.toolbarItems;
26652
26685
  var toolbar = new Toolbar({
26653
26686
  width: '100%',
26654
26687
  items: this.defToolbarItems,
@@ -26700,6 +26733,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26700
26733
  styles: 'position: absolute'
26701
26734
  }));
26702
26735
  var mainItem = this.getFrameToolbarItem();
26736
+ var args = { toolbarType: 'frame', toolbarItems: mainItem };
26737
+ parent.trigger('toolbarUpdating', args);
26738
+ mainItem = args.toolbarItems;
26703
26739
  var toolbar = new Toolbar({
26704
26740
  width: '100%',
26705
26741
  items: mainItem,
@@ -27325,6 +27361,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27325
27361
  var parent = this.parent;
27326
27362
  var id = parent.element.id;
27327
27363
  var mainItem = this.getFilterToolbarItem();
27364
+ var args = { toolbarType: 'filter', toolbarItems: mainItem };
27365
+ parent.trigger('toolbarUpdating', args);
27366
+ mainItem = args.toolbarItems;
27328
27367
  if (document.querySelector('#' + id + '_contextualToolbar').classList.contains('e-control')) {
27329
27368
  getComponent(document.getElementById(id + '_contextualToolbar'), 'toolbar').destroy();
27330
27369
  }