@syncfusion/ej2-image-editor 27.1.48 → 27.1.50

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.
@@ -3463,11 +3463,19 @@ var Draw = /** @__PURE__ @class */ (function () {
3463
3463
  parent.notify('filter', { prop: 'update-finetunes', onPropertyChange: false });
3464
3464
  }
3465
3465
  proxy.lowerContext.drawImage(parent.baseImg, 0, 0, proxy.parent.lowerCanvas.width, proxy.parent.lowerCanvas.height);
3466
+ var isCropped = false;
3467
+ var isSameDimension = false;
3468
+ if (parent.isImageUpdated) {
3469
+ var _a = parent.img, srcWidth = _a.srcWidth, srcHeight = _a.srcHeight;
3470
+ var _b = parent.baseImgCanvas, width = _b.width, height = _b.height;
3471
+ isCropped = srcWidth !== width || srcHeight !== height;
3472
+ isSameDimension = parent.baseImg.width === width && parent.baseImg.height === height;
3473
+ }
3466
3474
  hideSpinner(parent.element);
3467
3475
  parent.element.style.opacity = '1';
3468
3476
  proxy.updateBaseImgCanvas();
3469
3477
  var fileOpened = { fileName: _this.fileName, fileType: _this.fileType, isValidImage: true };
3470
- proxy.updateCanvas();
3478
+ proxy.updateCanvas(isCropped, isSameDimension);
3471
3479
  if (parent.currObjType.isUndoZoom) {
3472
3480
  parent.currObjType.isUndoZoom = false;
3473
3481
  proxy.parent.lowerCanvas.style.display = 'block';
@@ -3509,12 +3517,26 @@ var Draw = /** @__PURE__ @class */ (function () {
3509
3517
  parent.baseImgCanvas.height = parent.baseImg.height;
3510
3518
  parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0);
3511
3519
  };
3512
- Draw.prototype.updateCanvas = function () {
3520
+ Draw.prototype.updateCanvas = function (isCropped, isSameDimension) {
3513
3521
  var parent = this.parent;
3514
- if (!parent.isImageUpdated) {
3522
+ if (!parent.isImageUpdated || !isCropped) {
3515
3523
  parent.img.srcWidth = parent.baseImgCanvas.width;
3516
3524
  parent.img.srcHeight = parent.baseImgCanvas.height;
3517
3525
  }
3526
+ else if (!isSameDimension && isCropped) {
3527
+ parent.img.srcLeft = 0;
3528
+ parent.img.srcTop = 0;
3529
+ parent.img.srcWidth = parent.baseImgCanvas.width;
3530
+ parent.img.srcHeight = parent.baseImgCanvas.height;
3531
+ parent.currSelectionPoint = null;
3532
+ parent.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
3533
+ totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
3534
+ degree: 0, currFlipState: '', straighten: 0, destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
3535
+ srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
3536
+ zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none', straightenZoom: 0,
3537
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
3538
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
3539
+ }
3518
3540
  var obj = { width: 0, height: 0 };
3519
3541
  parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
3520
3542
  value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj, isImgShape: null } });
@@ -8818,6 +8840,9 @@ var Selection = /** @__PURE__ @class */ (function () {
8818
8840
  this.isSliderActive = false;
8819
8841
  this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
8820
8842
  this.isTouchDblClick = false;
8843
+ this.isMouseDown = false;
8844
+ this.isMouseUp = false;
8845
+ this.mouseWheel = 0;
8821
8846
  this.parent = parent;
8822
8847
  this.addEventListener();
8823
8848
  }
@@ -9128,6 +9153,7 @@ var Selection = /** @__PURE__ @class */ (function () {
9128
9153
  this.isPreventDragging = false;
9129
9154
  this.timer = undefined;
9130
9155
  this.tempObjColl = undefined;
9156
+ this.mouseWheel = 0;
9131
9157
  this.textRow = 1;
9132
9158
  this.mouseDownPoint = { x: 0, y: 0 };
9133
9159
  this.previousPoint = { x: 0, y: 0 };
@@ -9148,6 +9174,7 @@ var Selection = /** @__PURE__ @class */ (function () {
9148
9174
  this.mouseDown = '';
9149
9175
  this.isSliderActive = false;
9150
9176
  this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
9177
+ this.isMouseDown = this.isMouseUp = false;
9151
9178
  };
9152
9179
  Selection.prototype.performTabAction = function () {
9153
9180
  var parent = this.parent;
@@ -10147,6 +10174,12 @@ var Selection = /** @__PURE__ @class */ (function () {
10147
10174
  parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false, value: { shapeSettings: shapeResizingArgs.currentShapeSettings, allowShapeOverflow: shapeResizingArgs.allowShapeOverflow } });
10148
10175
  }
10149
10176
  else {
10177
+ if (this.isMouseDown) {
10178
+ shapeResizingArgs.action = 'resize-start';
10179
+ }
10180
+ else if (this.isMouseUp) {
10181
+ shapeResizingArgs.action = 'resize-end';
10182
+ }
10150
10183
  var selectionResizingArgs = { action: shapeResizingArgs.action,
10151
10184
  previousSelectionSettings: { type: parent.getSelectionType(parent.activeObj.shape),
10152
10185
  startX: shapeResizingArgs.previousShapeSettings.startX,
@@ -11940,6 +11973,8 @@ var Selection = /** @__PURE__ @class */ (function () {
11940
11973
  }
11941
11974
  var imageEditorClickEventArgs = { point: this.setXYPoints(e) };
11942
11975
  parent.trigger('click', imageEditorClickEventArgs);
11976
+ this.isMouseDown = true;
11977
+ this.isMouseUp = false;
11943
11978
  this.clickEvent(imageEditorClickEventArgs, e);
11944
11979
  };
11945
11980
  Selection.prototype.getImagePoints = function (x, y) {
@@ -12301,6 +12336,7 @@ var Selection = /** @__PURE__ @class */ (function () {
12301
12336
  }
12302
12337
  }
12303
12338
  if (type !== '') {
12339
+ parent.isZoomBtnClick = true;
12304
12340
  parent.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
12305
12341
  value: { x: center.x, y: center.y, type: type, isResize: null } });
12306
12342
  }
@@ -12383,11 +12419,14 @@ var Selection = /** @__PURE__ @class */ (function () {
12383
12419
  this.dragCanvas = parent.togglePan = true;
12384
12420
  }
12385
12421
  }
12422
+ this.isMouseDown = false;
12423
+ this.isMouseUp = false;
12386
12424
  };
12387
12425
  Selection.prototype.mouseUpEventHandler = function (e) {
12388
12426
  var parent = this.parent;
12389
12427
  var id = parent.element.id;
12390
- parent.isKBDNavigation = false;
12428
+ parent.isKBDNavigation = this.isMouseDown = false;
12429
+ this.isMouseUp = true;
12391
12430
  if (!Browser.isDevice && ((parent.element.querySelector('#' + id + '_contextualToolbar') &&
12392
12431
  !parent.element.querySelector('#' + id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
12393
12432
  (parent.element.querySelector('#' + id + '_headWrapper')
@@ -12557,6 +12596,11 @@ var Selection = /** @__PURE__ @class */ (function () {
12557
12596
  parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
12558
12597
  }
12559
12598
  }
12599
+ else if (isCropSelection && this.isMouseUp && parent.cursor.indexOf('resize') > -1) {
12600
+ var previousShapeSettings = this.updatePrevShapeSettings();
12601
+ var shapeResizingArgs = { cancel: false, action: 'resize-end', previousShapeSettings: previousShapeSettings };
12602
+ this.triggerShapeChange(shapeResizingArgs, shapeResizingArgs, 'resize');
12603
+ }
12560
12604
  if (parent.activeObj) {
12561
12605
  var isCropSelection_1 = false;
12562
12606
  var splitWords_1;
@@ -12676,6 +12720,7 @@ var Selection = /** @__PURE__ @class */ (function () {
12676
12720
  parent.isShapeDrawing = false;
12677
12721
  parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
12678
12722
  }
12723
+ this.isMouseUp = false;
12679
12724
  };
12680
12725
  Selection.prototype.adjustActObjForLineArrow = function (obj) {
12681
12726
  var isAdjusted = false;
@@ -13131,6 +13176,7 @@ var Selection = /** @__PURE__ @class */ (function () {
13131
13176
  case (e.ctrlKey && '+'):
13132
13177
  if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
13133
13178
  this.zoomType = 'Commands';
13179
+ parent.isZoomBtnClick = true;
13134
13180
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
13135
13181
  value: { zoomFactor: .1, zoomPoint: null }, isResize: null });
13136
13182
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -13147,6 +13193,7 @@ var Selection = /** @__PURE__ @class */ (function () {
13147
13193
  case (e.ctrlKey && '-'):
13148
13194
  if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
13149
13195
  this.zoomType = 'Commands';
13196
+ parent.isZoomBtnClick = true;
13150
13197
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
13151
13198
  value: { zoomFactor: -.1, zoomPoint: null }, isResize: null });
13152
13199
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -13283,6 +13330,11 @@ var Selection = /** @__PURE__ @class */ (function () {
13283
13330
  e.stopImmediatePropagation();
13284
13331
  };
13285
13332
  Selection.prototype.handleScroll = function (e) {
13333
+ this.mouseWheel++;
13334
+ if (this.mouseWheel === 2) {
13335
+ this.mouseWheel = 0;
13336
+ return;
13337
+ }
13286
13338
  var parent = this.parent;
13287
13339
  var x;
13288
13340
  var y;
@@ -13318,6 +13370,7 @@ var Selection = /** @__PURE__ @class */ (function () {
13318
13370
  }
13319
13371
  }
13320
13372
  if (type !== '') {
13373
+ parent.isZoomBtnClick = true;
13321
13374
  parent.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
13322
13375
  value: { x: x, y: y, type: type, isResize: null } });
13323
13376
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -13682,6 +13735,12 @@ var Selection = /** @__PURE__ @class */ (function () {
13682
13735
  parent.editCompleteArgs = shapeChangingArgs;
13683
13736
  }
13684
13737
  else {
13738
+ if (this.isMouseDown) {
13739
+ shapeChangingArgs.action = 'resize-start';
13740
+ }
13741
+ else if (this.isMouseUp) {
13742
+ shapeChangingArgs.action = 'resize-end';
13743
+ }
13685
13744
  var selectionChangingArgs = { action: shapeChangingArgs.action,
13686
13745
  previousSelectionSettings: { type: parent.getSelectionType(parent.activeObj.shape),
13687
13746
  startX: shapeChangingArgs.previousShapeSettings.startX,
@@ -14703,6 +14762,10 @@ var Shape = /** @__PURE__ @class */ (function () {
14703
14762
  parent.activeObj.opacity = opacity;
14704
14763
  }
14705
14764
  strokeSettings.strokeWidth = strokeWidth ? strokeWidth : strokeSettings.strokeWidth;
14765
+ var shape = parent.activeObj.shape;
14766
+ if ((shape === 'rectangle' || shape === 'ellipse') && strokeWidth === 0) {
14767
+ strokeSettings.strokeWidth = 0;
14768
+ }
14706
14769
  strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
14707
14770
  strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
14708
14771
  strokeSettings.radius = radius ? radius : strokeSettings.radius;
@@ -22292,6 +22355,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22292
22355
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: browseObj } });
22293
22356
  var supportObj = { key: 'SupportText' };
22294
22357
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
22358
+ var andObj = { key: 'And' };
22359
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
22295
22360
  var dropAreaElement = this.createElement('div', { id: this.element.id + '_dropArea', className: 'e-ie-drop-area', attrs: { style: 'position: relative;' } });
22296
22361
  var dropIconElement = this.createElement('span', { className: 'e-ie-drop-icon e-icons e-image', attrs: { style: 'position: absolute;' } });
22297
22362
  var dropContentElement = this.createElement('span', { className: 'e-ie-drop-content', attrs: { style: 'position: absolute; display: none;' } });
@@ -22307,7 +22372,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22307
22372
  dropAnchorElement.href = '';
22308
22373
  minDropAnchorElem.href = '';
22309
22374
  var dropInfoElement = this.createElement('span', { className: 'e-ie-drop-info', attrs: { position: 'absolute' } });
22310
- dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, and JPG';
22375
+ dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, ' + andObj['value'] + ' JPG';
22311
22376
  var dropUploader = dropAreaElement.appendChild(this.createElement('input', {
22312
22377
  id: this.element.id + '_dropfileUpload', className: 'e-fileUpload e-image-upload'
22313
22378
  }));
@@ -22551,7 +22616,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22551
22616
  this.notify('draw', { prop: 'open', value: { data: data } });
22552
22617
  }
22553
22618
  else {
22554
- this.updateImage(data, imageSettings.backgroundColor);
22619
+ this.updateImage(data, imageSettings ? imageSettings.backgroundColor : null);
22555
22620
  }
22556
22621
  };
22557
22622
  /**
@@ -23777,7 +23842,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23777
23842
  };
23778
23843
  ImageEditor.prototype.updateImage = function (data, imageBackgroundColor) {
23779
23844
  var _this = this;
23780
- if (data || imageBackgroundColor) {
23845
+ if (data || imageBackgroundColor || imageBackgroundColor === '') {
23781
23846
  var prevCropObj_1 = extend({}, this.cropObj, {}, true);
23782
23847
  var object = { currObj: {} };
23783
23848
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23819,7 +23884,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23819
23884
  }
23820
23885
  }, 100);
23821
23886
  }
23822
- if (imageBackgroundColor) {
23887
+ if (imageBackgroundColor || imageBackgroundColor === '') {
23823
23888
  this.notify('draw', { prop: 'imageBackgroundColor', onPropertyChange: false, value: { color: imageBackgroundColor } });
23824
23889
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
23825
23890
  if (!data) {
@@ -26528,7 +26593,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26528
26593
  BorderRadius: 'Border Radius',
26529
26594
  TextOutlineColor: 'Outline Color',
26530
26595
  TextOutlineWidth: 'Outline Width',
26531
- PixelSize: 'Pixel Size'
26596
+ PixelSize: 'Pixel Size',
26597
+ And: 'and'
26532
26598
  };
26533
26599
  this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
26534
26600
  };
@@ -27196,13 +27262,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27196
27262
  zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
27197
27263
  zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
27198
27264
  zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
27199
- zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
27200
27265
  }
27201
27266
  if (zoomOut) {
27202
27267
  zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
27203
27268
  zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
27204
27269
  zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
27205
- zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
27206
27270
  }
27207
27271
  };
27208
27272
  ToolbarModule.prototype.widthPress = function (e) {
@@ -31754,6 +31818,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
31754
31818
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
31755
31819
  parent.isFrameBtnClick = true;
31756
31820
  parent.curFrameObjEvent = { previousFrameSetting: parent.tempFrameObj, currentFrameSetting: parent.frameObj };
31821
+ parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: parent.tempFrameObj, obj: { frameChangeEventArgs: null } } });
31757
31822
  break;
31758
31823
  case 'redact':
31759
31824
  parent.currObjType.isRedact = true;
@@ -31880,6 +31945,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
31880
31945
  parent.img.destTop += (parent.cxtTbarHeight / 2);
31881
31946
  }
31882
31947
  this.callFrameToolbar();
31948
+ parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: parent.frameObj, obj: { frameChangeEventArgs: null } } });
31883
31949
  }
31884
31950
  };
31885
31951
  ToolbarModule.prototype.zoomToFrameRange = function () {