@syncfusion/ej2-image-editor 27.1.50 → 27.1.52

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.
@@ -2021,7 +2021,7 @@ var Draw = /** @__PURE__ @class */ (function () {
2021
2021
  }
2022
2022
  this.drawArrowHead(canvasDraw, true);
2023
2023
  this.drawArrowHead(canvasDraw, false);
2024
- if (actObj.end === 'none') {
2024
+ if (actObj.end === 'none' && actObj.start !== 'circle' && actObj.start !== 'square') {
2025
2025
  this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
2026
2026
  }
2027
2027
  canvasDraw.fillStyle = tempFillStyle;
@@ -2425,9 +2425,10 @@ var Draw = /** @__PURE__ @class */ (function () {
2425
2425
  var isStartArrow = actObj.start === 'arrow';
2426
2426
  var isEndArrow = actObj.end === 'arrow';
2427
2427
  var isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
2428
+ var isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
2428
2429
  if ((start && actObj.triangleDirection === 'left' || actObj.triangleDirection === 'right') &&
2429
- ((isStartArrow && actObj.end === 'none') || (isStartArrow && !isEndCircleOrSquare)) ||
2430
- (!start && (isEndArrow && actObj.start === 'none' || !isStartArrow && !isEndCircleOrSquare))) {
2430
+ ((isStartArrow && actObj.end === 'none') || (isStartArrow && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
2431
+ (!start && (isEndArrow && actObj.start === 'none' || !isStartArrow && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
2431
2432
  this.shapeLine(canvasDraw, startX, startY, endX, endY);
2432
2433
  }
2433
2434
  if ((start && actObj.triangleDirection === 'left') || (!start && actObj.triangleDirection === 'right')) {
@@ -2462,9 +2463,10 @@ var Draw = /** @__PURE__ @class */ (function () {
2462
2463
  var angle = Math.atan2(this.dy, this.dx);
2463
2464
  var isStartArrowSolid = actObj.start === 'arrowSolid';
2464
2465
  var isEndArrowSolid = actObj.end === 'arrowSolid';
2466
+ var isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
2465
2467
  var isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
2466
- if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare)) ||
2467
- (!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare))) {
2468
+ if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
2469
+ (!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
2468
2470
  this.shapeLine(canvasDraw, startX, startY, endX, endY);
2469
2471
  }
2470
2472
  if ((start && actObj.triangleDirection === 'left') || (!start && actObj.triangleDirection === 'right')) {
@@ -3031,12 +3033,7 @@ var Draw = /** @__PURE__ @class */ (function () {
3031
3033
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3032
3034
  var coll = actObj.rotateFlipColl[i];
3033
3035
  if (typeof (coll) === 'number') {
3034
- if (actObj.shapeDegree === 0) {
3035
- tempDegree = coll;
3036
- }
3037
- else {
3038
- tempDegree = coll - actObj.shapeDegree;
3039
- }
3036
+ tempDegree = coll;
3040
3037
  if (tempDegree === -450) {
3041
3038
  tempDegree = -90;
3042
3039
  }
@@ -3134,12 +3131,7 @@ var Draw = /** @__PURE__ @class */ (function () {
3134
3131
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3135
3132
  var coll = actObj.rotateFlipColl[i];
3136
3133
  if (typeof (coll) === 'number') {
3137
- if (actObj.shapeDegree === 0) {
3138
- tempDegree = coll;
3139
- }
3140
- else {
3141
- tempDegree = coll - actObj.shapeDegree;
3142
- }
3134
+ tempDegree = coll;
3143
3135
  if (tempDegree === -450) {
3144
3136
  tempDegree = -90;
3145
3137
  }
@@ -7347,7 +7339,7 @@ var Filter = /** @__PURE__ @class */ (function () {
7347
7339
  Filter.prototype.parseFilterString = function (filterString) {
7348
7340
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
7349
7341
  var filterArray = [];
7350
- if (filterString !== 'none') {
7342
+ if (filterString && filterString !== 'none') {
7351
7343
  filterArray = filterString.split(' ').map(function (filter) {
7352
7344
  var _a = filter.match(/([a-z-]+)\(([^)]+)\)/).slice(1, 3), name = _a[0], value = _a[1];
7353
7345
  return { filter: name, value: value };
@@ -12066,6 +12058,7 @@ var Selection = /** @__PURE__ @class */ (function () {
12066
12058
  this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
12067
12059
  parent.activeObj.activePoint = activePoint;
12068
12060
  parent.isShapeDrawing = true;
12061
+ this.tempActiveObj = extend({}, parent.activeObj, {}, true);
12069
12062
  return;
12070
12063
  }
12071
12064
  parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
@@ -21562,12 +21555,22 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
21562
21555
  var parent = this.parent;
21563
21556
  for (var i = 0; i < parent.objColl.length; i++) {
21564
21557
  var obj = parent.objColl[i];
21558
+ var isUpdated = false;
21565
21559
  if (obj.shape === 'line' || obj.shape === 'arrow') {
21566
21560
  if (obj.activePoint.width < 0) {
21567
21561
  obj.activePoint.width = Math.abs(obj.activePoint.width);
21562
+ isUpdated = true;
21568
21563
  }
21569
21564
  if (obj.activePoint.height < 0) {
21570
21565
  obj.activePoint.height = Math.abs(obj.activePoint.height);
21566
+ isUpdated = true;
21567
+ }
21568
+ if (isUpdated) {
21569
+ var activeObj = extend({}, parent.activeObj, {}, true);
21570
+ parent.activeObj = obj;
21571
+ parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
21572
+ obj = parent.activeObj;
21573
+ parent.activeObj = activeObj;
21571
21574
  }
21572
21575
  }
21573
21576
  }
@@ -27782,6 +27785,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27782
27785
  zOrderElement.classList.remove('e-overlay');
27783
27786
  }
27784
27787
  }
27788
+ if (zOrderElement && (parent.shapeColl.length === 0 || (obj['freehandDrawSelectedId'] && parent.shapeColl.length === 1))) {
27789
+ zOrderElement.classList.add('e-overlay');
27790
+ }
27785
27791
  };
27786
27792
  ToolbarModule.prototype.renderStraightenSlider = function () {
27787
27793
  var parent = this.parent;
@@ -28014,7 +28020,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28014
28020
  qualityOptionDiv.appendChild(parent.createElement('button', { id: id + '_qualitybuttonIcon', className: 'e-ie-img-icon-button', attrs: { type: 'button' } }));
28015
28021
  qualityNameDiv.appendChild(qualityOptionDiv);
28016
28022
  if (Browser.isDevice) {
28017
- qualityNameDiv.appendChild(parent.createElement('span', {
28023
+ dialogRightContent.appendChild(parent.createElement('span', {
28018
28024
  id: id + '_qualitySize', className: 'e-ie-img-quality-size'
28019
28025
  }));
28020
28026
  }
@@ -28251,11 +28257,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28251
28257
  fileSize = Math.floor(blob.size / 1024);
28252
28258
  if (fileSize > 1000) {
28253
28259
  var megabytes = fileSize / 1024;
28254
- imageNameLabel.innerHTML = 'Image size: ' + megabytes.toFixed(2) + ' MB';
28260
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28255
28261
  fileSize = +megabytes.toFixed(2);
28256
28262
  }
28257
28263
  else {
28258
- imageNameLabel.innerHTML = 'Image size: ' + fileSize.toFixed(2) + ' KB';
28264
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
28259
28265
  fileSize = +fileSize.toFixed(2);
28260
28266
  }
28261
28267
  if (Browser.isDevice) {
@@ -28273,6 +28279,46 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28273
28279
  this.fileSize = fileSize;
28274
28280
  }).bind(this), 'image/jpeg', quality);
28275
28281
  }
28282
+ else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
28283
+ ctx.drawImage(tempCanvas, 0, 0);
28284
+ tempCanvas.toBlob((function (blob) {
28285
+ fileSize = Math.floor(blob.size / 1024);
28286
+ if (fileSize > 1000) {
28287
+ var megabytes = fileSize / 1024;
28288
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28289
+ fileSize = +megabytes.toFixed(2);
28290
+ }
28291
+ else {
28292
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize.toFixed(2) + ' KB';
28293
+ fileSize = +fileSize.toFixed(2);
28294
+ }
28295
+ if (Browser.isDevice) {
28296
+ canvas.style.display = 'none';
28297
+ }
28298
+ this.fileSize = fileSize;
28299
+ }).bind(this), 'image/png', 1);
28300
+ }
28301
+ else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
28302
+ ctx.drawImage(tempCanvas, 0, 0);
28303
+ var svgDataUrl = tempCanvas.toDataURL('image/svg+xml');
28304
+ var base64Data = svgDataUrl.split(',')[1];
28305
+ var binaryStringLength = base64Data.length;
28306
+ var rawByteSize = binaryStringLength;
28307
+ var fileSize_1 = Math.floor(rawByteSize / 1024); // KB
28308
+ if (fileSize_1 > 1000) {
28309
+ var megabytes = fileSize_1 / 1024; // Convert to MB
28310
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + megabytes.toFixed(2) + ' MB';
28311
+ fileSize_1 = +megabytes.toFixed(2);
28312
+ }
28313
+ else {
28314
+ imageNameLabel.innerHTML = this.l10n.getConstant('ImageSize') + ': ' + fileSize_1.toFixed(2) + ' KB';
28315
+ fileSize_1 = +fileSize_1.toFixed(2);
28316
+ }
28317
+ if (Browser.isDevice) {
28318
+ canvas.style.display = 'none';
28319
+ }
28320
+ this.fileSize = fileSize_1;
28321
+ }
28276
28322
  else {
28277
28323
  if (Browser.isDevice) {
28278
28324
  canvas.style.display = 'none';