@syncfusion/ej2-image-editor 27.1.48 → 27.1.51

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.
@@ -1992,7 +1992,7 @@ class Draw {
1992
1992
  }
1993
1993
  this.drawArrowHead(canvasDraw, true);
1994
1994
  this.drawArrowHead(canvasDraw, false);
1995
- if (actObj.end === 'none') {
1995
+ if (actObj.end === 'none' && actObj.start !== 'circle' && actObj.start !== 'square') {
1996
1996
  this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
1997
1997
  }
1998
1998
  canvasDraw.fillStyle = tempFillStyle;
@@ -2396,9 +2396,10 @@ class Draw {
2396
2396
  const isStartArrow = actObj.start === 'arrow';
2397
2397
  const isEndArrow = actObj.end === 'arrow';
2398
2398
  const isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
2399
+ const isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
2399
2400
  if ((start && actObj.triangleDirection === 'left' || actObj.triangleDirection === 'right') &&
2400
- ((isStartArrow && actObj.end === 'none') || (isStartArrow && !isEndCircleOrSquare)) ||
2401
- (!start && (isEndArrow && actObj.start === 'none' || !isStartArrow && !isEndCircleOrSquare))) {
2401
+ ((isStartArrow && actObj.end === 'none') || (isStartArrow && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
2402
+ (!start && (isEndArrow && actObj.start === 'none' || !isStartArrow && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
2402
2403
  this.shapeLine(canvasDraw, startX, startY, endX, endY);
2403
2404
  }
2404
2405
  if ((start && actObj.triangleDirection === 'left') || (!start && actObj.triangleDirection === 'right')) {
@@ -2433,9 +2434,10 @@ class Draw {
2433
2434
  const angle = Math.atan2(this.dy, this.dx);
2434
2435
  const isStartArrowSolid = actObj.start === 'arrowSolid';
2435
2436
  const isEndArrowSolid = actObj.end === 'arrowSolid';
2437
+ const isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
2436
2438
  const isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
2437
- if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare)) ||
2438
- (!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare))) {
2439
+ if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
2440
+ (!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
2439
2441
  this.shapeLine(canvasDraw, startX, startY, endX, endY);
2440
2442
  }
2441
2443
  if ((start && actObj.triangleDirection === 'left') || (!start && actObj.triangleDirection === 'right')) {
@@ -3433,11 +3435,19 @@ class Draw {
3433
3435
  parent.notify('filter', { prop: 'update-finetunes', onPropertyChange: false });
3434
3436
  }
3435
3437
  proxy.lowerContext.drawImage(parent.baseImg, 0, 0, proxy.parent.lowerCanvas.width, proxy.parent.lowerCanvas.height);
3438
+ let isCropped = false;
3439
+ let isSameDimension = false;
3440
+ if (parent.isImageUpdated) {
3441
+ const { srcWidth, srcHeight } = parent.img;
3442
+ const { width, height } = parent.baseImgCanvas;
3443
+ isCropped = srcWidth !== width || srcHeight !== height;
3444
+ isSameDimension = parent.baseImg.width === width && parent.baseImg.height === height;
3445
+ }
3436
3446
  hideSpinner(parent.element);
3437
3447
  parent.element.style.opacity = '1';
3438
3448
  proxy.updateBaseImgCanvas();
3439
3449
  const fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
3440
- proxy.updateCanvas();
3450
+ proxy.updateCanvas(isCropped, isSameDimension);
3441
3451
  if (parent.currObjType.isUndoZoom) {
3442
3452
  parent.currObjType.isUndoZoom = false;
3443
3453
  proxy.parent.lowerCanvas.style.display = 'block';
@@ -3479,12 +3489,26 @@ class Draw {
3479
3489
  parent.baseImgCanvas.height = parent.baseImg.height;
3480
3490
  parent.baseImgCanvas.getContext('2d').drawImage(parent.baseImg, 0, 0);
3481
3491
  }
3482
- updateCanvas() {
3492
+ updateCanvas(isCropped, isSameDimension) {
3483
3493
  const parent = this.parent;
3484
- if (!parent.isImageUpdated) {
3494
+ if (!parent.isImageUpdated || !isCropped) {
3485
3495
  parent.img.srcWidth = parent.baseImgCanvas.width;
3486
3496
  parent.img.srcHeight = parent.baseImgCanvas.height;
3487
3497
  }
3498
+ else if (!isSameDimension && isCropped) {
3499
+ parent.img.srcLeft = 0;
3500
+ parent.img.srcTop = 0;
3501
+ parent.img.srcWidth = parent.baseImgCanvas.width;
3502
+ parent.img.srcHeight = parent.baseImgCanvas.height;
3503
+ parent.currSelectionPoint = null;
3504
+ parent.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
3505
+ totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
3506
+ degree: 0, currFlipState: '', straighten: 0, destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
3507
+ srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
3508
+ zoomFactor: 0, previousZoomValue: 0, aspectWidth: null, aspectHeight: null, frame: 'none', straightenZoom: 0,
3509
+ adjustmentLevel: { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0,
3510
+ exposure: 0, transparency: 100, sharpen: false, bw: false }, currentFilter: '' };
3511
+ }
3488
3512
  const obj = { width: 0, height: 0 };
3489
3513
  parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
3490
3514
  value: { width: parent.img.srcWidth, height: parent.img.srcHeight, obj: obj, isImgShape: null } });
@@ -8758,6 +8782,9 @@ class Selection {
8758
8782
  this.isSliderActive = false;
8759
8783
  this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
8760
8784
  this.isTouchDblClick = false;
8785
+ this.isMouseDown = false;
8786
+ this.isMouseUp = false;
8787
+ this.mouseWheel = 0;
8761
8788
  this.parent = parent;
8762
8789
  this.addEventListener();
8763
8790
  }
@@ -9068,6 +9095,7 @@ class Selection {
9068
9095
  this.isPreventDragging = false;
9069
9096
  this.timer = undefined;
9070
9097
  this.tempObjColl = undefined;
9098
+ this.mouseWheel = 0;
9071
9099
  this.textRow = 1;
9072
9100
  this.mouseDownPoint = { x: 0, y: 0 };
9073
9101
  this.previousPoint = { x: 0, y: 0 };
@@ -9088,6 +9116,7 @@ class Selection {
9088
9116
  this.mouseDown = '';
9089
9117
  this.isSliderActive = false;
9090
9118
  this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
9119
+ this.isMouseDown = this.isMouseUp = false;
9091
9120
  }
9092
9121
  performTabAction() {
9093
9122
  const parent = this.parent;
@@ -10086,6 +10115,12 @@ class Selection {
10086
10115
  parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false, value: { shapeSettings: shapeResizingArgs.currentShapeSettings, allowShapeOverflow: shapeResizingArgs.allowShapeOverflow } });
10087
10116
  }
10088
10117
  else {
10118
+ if (this.isMouseDown) {
10119
+ shapeResizingArgs.action = 'resize-start';
10120
+ }
10121
+ else if (this.isMouseUp) {
10122
+ shapeResizingArgs.action = 'resize-end';
10123
+ }
10089
10124
  const selectionResizingArgs = { action: shapeResizingArgs.action,
10090
10125
  previousSelectionSettings: { type: parent.getSelectionType(parent.activeObj.shape),
10091
10126
  startX: shapeResizingArgs.previousShapeSettings.startX,
@@ -11878,6 +11913,8 @@ class Selection {
11878
11913
  }
11879
11914
  const imageEditorClickEventArgs = { point: this.setXYPoints(e) };
11880
11915
  parent.trigger('click', imageEditorClickEventArgs);
11916
+ this.isMouseDown = true;
11917
+ this.isMouseUp = false;
11881
11918
  this.clickEvent(imageEditorClickEventArgs, e);
11882
11919
  }
11883
11920
  getImagePoints(x, y) {
@@ -12239,6 +12276,7 @@ class Selection {
12239
12276
  }
12240
12277
  }
12241
12278
  if (type !== '') {
12279
+ parent.isZoomBtnClick = true;
12242
12280
  parent.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
12243
12281
  value: { x: center.x, y: center.y, type: type, isResize: null } });
12244
12282
  }
@@ -12321,11 +12359,14 @@ class Selection {
12321
12359
  this.dragCanvas = parent.togglePan = true;
12322
12360
  }
12323
12361
  }
12362
+ this.isMouseDown = false;
12363
+ this.isMouseUp = false;
12324
12364
  }
12325
12365
  mouseUpEventHandler(e) {
12326
12366
  const parent = this.parent;
12327
12367
  const id = parent.element.id;
12328
- parent.isKBDNavigation = false;
12368
+ parent.isKBDNavigation = this.isMouseDown = false;
12369
+ this.isMouseUp = true;
12329
12370
  if (!Browser.isDevice && ((parent.element.querySelector('#' + id + '_contextualToolbar') &&
12330
12371
  !parent.element.querySelector('#' + id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
12331
12372
  (parent.element.querySelector('#' + id + '_headWrapper')
@@ -12495,6 +12536,11 @@ class Selection {
12495
12536
  parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
12496
12537
  }
12497
12538
  }
12539
+ else if (isCropSelection && this.isMouseUp && parent.cursor.indexOf('resize') > -1) {
12540
+ const previousShapeSettings = this.updatePrevShapeSettings();
12541
+ const shapeResizingArgs = { cancel: false, action: 'resize-end', previousShapeSettings: previousShapeSettings };
12542
+ this.triggerShapeChange(shapeResizingArgs, shapeResizingArgs, 'resize');
12543
+ }
12498
12544
  if (parent.activeObj) {
12499
12545
  let isCropSelection = false;
12500
12546
  let splitWords;
@@ -12614,6 +12660,7 @@ class Selection {
12614
12660
  parent.isShapeDrawing = false;
12615
12661
  parent.notify('freehand-draw', { prop: 'resetSelPoints', onPropertyChange: false });
12616
12662
  }
12663
+ this.isMouseUp = false;
12617
12664
  }
12618
12665
  adjustActObjForLineArrow(obj) {
12619
12666
  let isAdjusted = false;
@@ -13069,6 +13116,7 @@ class Selection {
13069
13116
  case (e.ctrlKey && '+'):
13070
13117
  if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
13071
13118
  this.zoomType = 'Commands';
13119
+ parent.isZoomBtnClick = true;
13072
13120
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
13073
13121
  value: { zoomFactor: .1, zoomPoint: null }, isResize: null });
13074
13122
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -13085,6 +13133,7 @@ class Selection {
13085
13133
  case (e.ctrlKey && '-'):
13086
13134
  if ((parent.zoomSettings.zoomTrigger & ZoomTrigger.Commands) === ZoomTrigger.Commands) {
13087
13135
  this.zoomType = 'Commands';
13136
+ parent.isZoomBtnClick = true;
13088
13137
  parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
13089
13138
  value: { zoomFactor: -.1, zoomPoint: null }, isResize: null });
13090
13139
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -13221,6 +13270,11 @@ class Selection {
13221
13270
  e.stopImmediatePropagation();
13222
13271
  }
13223
13272
  handleScroll(e) {
13273
+ this.mouseWheel++;
13274
+ if (this.mouseWheel === 2) {
13275
+ this.mouseWheel = 0;
13276
+ return;
13277
+ }
13224
13278
  const parent = this.parent;
13225
13279
  let x;
13226
13280
  let y;
@@ -13256,6 +13310,7 @@ class Selection {
13256
13310
  }
13257
13311
  }
13258
13312
  if (type !== '') {
13313
+ parent.isZoomBtnClick = true;
13259
13314
  parent.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
13260
13315
  value: { x: x, y: y, type: type, isResize: null } });
13261
13316
  parent.notify('draw', { prop: 'redrawDownScale' });
@@ -13620,6 +13675,12 @@ class Selection {
13620
13675
  parent.editCompleteArgs = shapeChangingArgs;
13621
13676
  }
13622
13677
  else {
13678
+ if (this.isMouseDown) {
13679
+ shapeChangingArgs.action = 'resize-start';
13680
+ }
13681
+ else if (this.isMouseUp) {
13682
+ shapeChangingArgs.action = 'resize-end';
13683
+ }
13623
13684
  const selectionChangingArgs = { action: shapeChangingArgs.action,
13624
13685
  previousSelectionSettings: { type: parent.getSelectionType(parent.activeObj.shape),
13625
13686
  startX: shapeChangingArgs.previousShapeSettings.startX,
@@ -14640,6 +14701,10 @@ class Shape {
14640
14701
  parent.activeObj.opacity = opacity;
14641
14702
  }
14642
14703
  strokeSettings.strokeWidth = strokeWidth ? strokeWidth : strokeSettings.strokeWidth;
14704
+ const shape = parent.activeObj.shape;
14705
+ if ((shape === 'rectangle' || shape === 'ellipse') && strokeWidth === 0) {
14706
+ strokeSettings.strokeWidth = 0;
14707
+ }
14643
14708
  strokeSettings.strokeColor = strokeColor ? strokeColor : strokeSettings.strokeColor;
14644
14709
  strokeSettings.fillColor = fillColor ? fillColor : strokeSettings.fillColor;
14645
14710
  strokeSettings.radius = radius ? radius : strokeSettings.radius;
@@ -21430,13 +21495,23 @@ class UndoRedo {
21430
21495
  updateObjColl() {
21431
21496
  const parent = this.parent;
21432
21497
  for (let i = 0; i < parent.objColl.length; i++) {
21433
- const obj = parent.objColl[i];
21498
+ let obj = parent.objColl[i];
21499
+ let isUpdated = false;
21434
21500
  if (obj.shape === 'line' || obj.shape === 'arrow') {
21435
21501
  if (obj.activePoint.width < 0) {
21436
21502
  obj.activePoint.width = Math.abs(obj.activePoint.width);
21503
+ isUpdated = true;
21437
21504
  }
21438
21505
  if (obj.activePoint.height < 0) {
21439
21506
  obj.activePoint.height = Math.abs(obj.activePoint.height);
21507
+ isUpdated = true;
21508
+ }
21509
+ if (isUpdated) {
21510
+ const activeObj = extend({}, parent.activeObj, {}, true);
21511
+ parent.activeObj = obj;
21512
+ parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
21513
+ obj = parent.activeObj;
21514
+ parent.activeObj = activeObj;
21440
21515
  }
21441
21516
  }
21442
21517
  }
@@ -22186,6 +22261,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22186
22261
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: browseObj } });
22187
22262
  const supportObj = { key: 'SupportText' };
22188
22263
  this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
22264
+ const andObj = { key: 'And' };
22265
+ this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
22189
22266
  const dropAreaElement = this.createElement('div', { id: this.element.id + '_dropArea', className: 'e-ie-drop-area', attrs: { style: 'position: relative;' } });
22190
22267
  const dropIconElement = this.createElement('span', { className: 'e-ie-drop-icon e-icons e-image', attrs: { style: 'position: absolute;' } });
22191
22268
  const dropContentElement = this.createElement('span', { className: 'e-ie-drop-content', attrs: { style: 'position: absolute; display: none;' } });
@@ -22201,7 +22278,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22201
22278
  dropAnchorElement.href = '';
22202
22279
  minDropAnchorElem.href = '';
22203
22280
  const dropInfoElement = this.createElement('span', { className: 'e-ie-drop-info', attrs: { position: 'absolute' } });
22204
- dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, and JPG';
22281
+ dropInfoElement.textContent = supportObj['value'] + ' SVG, PNG, ' + andObj['value'] + ' JPG';
22205
22282
  const dropUploader = dropAreaElement.appendChild(this.createElement('input', {
22206
22283
  id: this.element.id + '_dropfileUpload', className: 'e-fileUpload e-image-upload'
22207
22284
  }));
@@ -22445,7 +22522,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22445
22522
  this.notify('draw', { prop: 'open', value: { data: data } });
22446
22523
  }
22447
22524
  else {
22448
- this.updateImage(data, imageSettings.backgroundColor);
22525
+ this.updateImage(data, imageSettings ? imageSettings.backgroundColor : null);
22449
22526
  }
22450
22527
  }
22451
22528
  /**
@@ -23670,7 +23747,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23670
23747
  }
23671
23748
  }
23672
23749
  updateImage(data, imageBackgroundColor) {
23673
- if (data || imageBackgroundColor) {
23750
+ if (data || imageBackgroundColor || imageBackgroundColor === '') {
23674
23751
  const prevCropObj = extend({}, this.cropObj, {}, true);
23675
23752
  const object = { currObj: {} };
23676
23753
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23712,7 +23789,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23712
23789
  }
23713
23790
  }, 100);
23714
23791
  }
23715
- if (imageBackgroundColor) {
23792
+ if (imageBackgroundColor || imageBackgroundColor === '') {
23716
23793
  this.notify('draw', { prop: 'imageBackgroundColor', onPropertyChange: false, value: { color: imageBackgroundColor } });
23717
23794
  this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
23718
23795
  if (!data) {
@@ -26419,7 +26496,8 @@ class ToolbarModule {
26419
26496
  BorderRadius: 'Border Radius',
26420
26497
  TextOutlineColor: 'Outline Color',
26421
26498
  TextOutlineWidth: 'Outline Width',
26422
- PixelSize: 'Pixel Size'
26499
+ PixelSize: 'Pixel Size',
26500
+ And: 'and'
26423
26501
  };
26424
26502
  this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
26425
26503
  }
@@ -27084,13 +27162,11 @@ class ToolbarModule {
27084
27162
  zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
27085
27163
  zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
27086
27164
  zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
27087
- zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
27088
27165
  }
27089
27166
  if (zoomOut) {
27090
27167
  zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
27091
27168
  zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
27092
27169
  zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
27093
- zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
27094
27170
  }
27095
27171
  }
27096
27172
  widthPress(e) {
@@ -27604,6 +27680,9 @@ class ToolbarModule {
27604
27680
  zOrderElement.classList.remove('e-overlay');
27605
27681
  }
27606
27682
  }
27683
+ if (zOrderElement && (parent.shapeColl.length === 0 || (obj['freehandDrawSelectedId'] && parent.shapeColl.length === 1))) {
27684
+ zOrderElement.classList.add('e-overlay');
27685
+ }
27607
27686
  }
27608
27687
  renderStraightenSlider() {
27609
27688
  const parent = this.parent;
@@ -28068,11 +28147,11 @@ class ToolbarModule {
28068
28147
  fileSize = Math.floor(blob.size / 1024);
28069
28148
  if (fileSize > 1000) {
28070
28149
  const megabytes = fileSize / 1024;
28071
- imageNameLabel.innerHTML = 'Image size: ' + megabytes.toFixed(2) + ' MB';
28150
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28072
28151
  fileSize = +megabytes.toFixed(2);
28073
28152
  }
28074
28153
  else {
28075
- imageNameLabel.innerHTML = 'Image size: ' + fileSize.toFixed(2) + ' KB';
28154
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
28076
28155
  fileSize = +fileSize.toFixed(2);
28077
28156
  }
28078
28157
  if (Browser.isDevice) {
@@ -28090,6 +28169,50 @@ class ToolbarModule {
28090
28169
  this.fileSize = fileSize;
28091
28170
  }).bind(this), 'image/jpeg', quality);
28092
28171
  }
28172
+ else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
28173
+ if (Browser.isDevice) {
28174
+ canvas.style.display = 'none';
28175
+ }
28176
+ else {
28177
+ ctx.drawImage(tempCanvas, 0, 0);
28178
+ tempCanvas.toBlob((function (blob) {
28179
+ fileSize = Math.floor(blob.size / 1024);
28180
+ if (fileSize > 1000) {
28181
+ const megabytes = fileSize / 1024;
28182
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28183
+ fileSize = +megabytes.toFixed(2);
28184
+ }
28185
+ else {
28186
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
28187
+ fileSize = +fileSize.toFixed(2);
28188
+ }
28189
+ this.fileSize = fileSize;
28190
+ }).bind(this), 'image/png', 1);
28191
+ }
28192
+ }
28193
+ else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
28194
+ if (Browser.isDevice) {
28195
+ canvas.style.display = 'none';
28196
+ }
28197
+ else {
28198
+ ctx.drawImage(tempCanvas, 0, 0);
28199
+ const svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
28200
+ const base64Data = svgDataUrl.split(',')[1];
28201
+ const binaryStringLength = base64Data.length;
28202
+ const rawByteSize = binaryStringLength;
28203
+ let fileSize = Math.floor(rawByteSize / 1024); // KB
28204
+ if (fileSize > 1000) {
28205
+ const megabytes = fileSize / 1024; // Convert to MB
28206
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28207
+ fileSize = +megabytes.toFixed(2);
28208
+ }
28209
+ else {
28210
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
28211
+ fileSize = +fileSize.toFixed(2);
28212
+ }
28213
+ }
28214
+ this.fileSize = fileSize;
28215
+ }
28093
28216
  else {
28094
28217
  if (Browser.isDevice) {
28095
28218
  canvas.style.display = 'none';
@@ -31610,6 +31733,7 @@ class ToolbarModule {
31610
31733
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
31611
31734
  parent.isFrameBtnClick = true;
31612
31735
  parent.curFrameObjEvent = { previousFrameSetting: parent.tempFrameObj, currentFrameSetting: parent.frameObj };
31736
+ parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: parent.tempFrameObj, obj: { frameChangeEventArgs: null } } });
31613
31737
  break;
31614
31738
  case 'redact':
31615
31739
  parent.currObjType.isRedact = true;
@@ -31736,6 +31860,7 @@ class ToolbarModule {
31736
31860
  parent.img.destTop += (parent.cxtTbarHeight / 2);
31737
31861
  }
31738
31862
  this.callFrameToolbar();
31863
+ parent.notify('draw', { prop: 'triggerFrameChange', value: { prevFrameSettings: parent.frameObj, obj: { frameChangeEventArgs: null } } });
31739
31864
  }
31740
31865
  }
31741
31866
  zoomToFrameRange() {