@syncfusion/ej2-image-editor 27.1.50 → 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')) {
@@ -21493,13 +21495,23 @@ class UndoRedo {
21493
21495
  updateObjColl() {
21494
21496
  const parent = this.parent;
21495
21497
  for (let i = 0; i < parent.objColl.length; i++) {
21496
- const obj = parent.objColl[i];
21498
+ let obj = parent.objColl[i];
21499
+ let isUpdated = false;
21497
21500
  if (obj.shape === 'line' || obj.shape === 'arrow') {
21498
21501
  if (obj.activePoint.width < 0) {
21499
21502
  obj.activePoint.width = Math.abs(obj.activePoint.width);
21503
+ isUpdated = true;
21500
21504
  }
21501
21505
  if (obj.activePoint.height < 0) {
21502
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;
21503
21515
  }
21504
21516
  }
21505
21517
  }
@@ -27668,6 +27680,9 @@ class ToolbarModule {
27668
27680
  zOrderElement.classList.remove('e-overlay');
27669
27681
  }
27670
27682
  }
27683
+ if (zOrderElement && (parent.shapeColl.length === 0 || (obj['freehandDrawSelectedId'] && parent.shapeColl.length === 1))) {
27684
+ zOrderElement.classList.add('e-overlay');
27685
+ }
27671
27686
  }
27672
27687
  renderStraightenSlider() {
27673
27688
  const parent = this.parent;
@@ -28132,11 +28147,11 @@ class ToolbarModule {
28132
28147
  fileSize = Math.floor(blob.size / 1024);
28133
28148
  if (fileSize > 1000) {
28134
28149
  const megabytes = fileSize / 1024;
28135
- imageNameLabel.innerHTML = 'Image size: ' + megabytes.toFixed(2) + ' MB';
28150
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28136
28151
  fileSize = +megabytes.toFixed(2);
28137
28152
  }
28138
28153
  else {
28139
- imageNameLabel.innerHTML = 'Image size: ' + fileSize.toFixed(2) + ' KB';
28154
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
28140
28155
  fileSize = +fileSize.toFixed(2);
28141
28156
  }
28142
28157
  if (Browser.isDevice) {
@@ -28154,6 +28169,50 @@ class ToolbarModule {
28154
28169
  this.fileSize = fileSize;
28155
28170
  }).bind(this), 'image/jpeg', quality);
28156
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
+ }
28157
28216
  else {
28158
28217
  if (Browser.isDevice) {
28159
28218
  canvas.style.display = 'none';