@syncfusion/ej2-image-editor 21.1.35 → 21.1.39

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 21.1.35
3
+ * version : 21.1.39
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-image-editor@*",
3
- "_id": "@syncfusion/ej2-image-editor@20.15.0",
3
+ "_id": "@syncfusion/ej2-image-editor@21.1.37",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-Xmh+hp6L+IMvA9vK8dkYMdJ7v7Sr/WmeQuh2NNLhaNdjdEl+6EBY7iU6z7AXM4vJg9cy3Q4JMu0D/rPRDS0kPA==",
5
+ "_integrity": "sha512-NqoCmNu7dG4kLr3t5ln1b/tl1CHhMvwZa3DF8GJjjWvr6UuU+bGi7hmG9bTPgROsYJk4l+5O5NJfeh6jL30DPQ==",
6
6
  "_location": "/@syncfusion/ej2-image-editor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-image-editor",
24
24
  "/@syncfusion/ej2-vue-image-editor"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-image-editor/-/ej2-image-editor-20.15.0.tgz",
27
- "_shasum": "fbc13db02e3a21783e2b81260218e839b609f3e8",
26
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-21.1.37.tgz",
27
+ "_shasum": "480eed2590ef0f57854228517a728f5e54f06522",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
30
30
  "author": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~21.1.35",
36
- "@syncfusion/ej2-buttons": "~21.1.35",
37
- "@syncfusion/ej2-inputs": "~21.1.35",
38
- "@syncfusion/ej2-navigations": "~21.1.35",
39
- "@syncfusion/ej2-popups": "~21.1.35",
40
- "@syncfusion/ej2-splitbuttons": "~21.1.35"
35
+ "@syncfusion/ej2-base": "~21.1.39",
36
+ "@syncfusion/ej2-buttons": "~21.1.37",
37
+ "@syncfusion/ej2-inputs": "~21.1.39",
38
+ "@syncfusion/ej2-navigations": "~21.1.39",
39
+ "@syncfusion/ej2-popups": "~21.1.37",
40
+ "@syncfusion/ej2-splitbuttons": "~21.1.37"
41
41
  },
42
42
  "deprecated": false,
43
43
  "description": "Essential JS 2 ImageEditor",
@@ -67,7 +67,7 @@
67
67
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
68
68
  },
69
69
  "typings": "index.d.ts",
70
- "version": "21.1.35",
70
+ "version": "21.1.39",
71
71
  "sideEffects": false,
72
72
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
73
73
  }
@@ -326,6 +326,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
326
326
  private isShapeInserted;
327
327
  private isInitialTextEdited;
328
328
  private isShapeTextInserted;
329
+ private isErrorImage;
329
330
  /**
330
331
  * Defines one or more CSS classes that can be used to customize the appearance of an Image Editor component.
331
332
  *
@@ -756,6 +757,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
756
757
  private renderSaveBtn;
757
758
  private cropSelect;
758
759
  private transformSelect;
760
+ private resetZoom;
759
761
  private performTransformation;
760
762
  private updateTransform;
761
763
  private getShapesToolbarItem;
@@ -1189,6 +1191,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
1189
1191
  *
1190
1192
  */
1191
1193
  select(type: string, startX?: number, startY?: number, width?: number, height?: number): void;
1194
+ private updateSelectionInsert;
1192
1195
  /**
1193
1196
  * Enable or disable a freehand drawing option in an Image Editor.
1194
1197
  *
@@ -225,6 +225,7 @@ var ImageEditor = /** @class */ (function (_super) {
225
225
  _this.isShapeInserted = false;
226
226
  _this.isInitialTextEdited = false;
227
227
  _this.isShapeTextInserted = false;
228
+ _this.isErrorImage = false;
228
229
  return _this;
229
230
  }
230
231
  ImageEditor_1 = ImageEditor;
@@ -430,7 +431,8 @@ var ImageEditor = /** @class */ (function (_super) {
430
431
  this.zoomSettings.zoomTrigger = newProperties.zoomSettings.zoomTrigger;
431
432
  }
432
433
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
433
- this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar | ZoomTrigger.Commands);
434
+ this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
435
+ ZoomTrigger.Commands);
434
436
  this.refreshToolbar('main');
435
437
  }
436
438
  else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
@@ -1327,11 +1329,9 @@ var ImageEditor = /** @class */ (function (_super) {
1327
1329
  this.performTransformation(args.item.id);
1328
1330
  this.updateCurrentUndoRedoColl('ok');
1329
1331
  };
1330
- ImageEditor.prototype.performTransformation = function (text) {
1331
- var tempZoomFactor = this.defaultZoomFactor;
1332
- var isUndoRedo = this.isUndoRedo;
1333
- var prevCropObj = extend({}, this.cropObj, {}, true);
1332
+ ImageEditor.prototype.resetZoom = function () {
1334
1333
  if (this.defaultZoomFactor !== 0) {
1334
+ var isUndoRedo = this.isUndoRedo;
1335
1335
  this.transformCurrentObj = this.getCurrentObj();
1336
1336
  this.transformCurrentObj.objColl = extend([], this.objColl, null, true);
1337
1337
  this.transformCurrentObj.pointColl = extend({}, this.pointColl, null, true);
@@ -1345,6 +1345,12 @@ var ImageEditor = /** @class */ (function (_super) {
1345
1345
  }
1346
1346
  this.isUndoRedo = isUndoRedo;
1347
1347
  }
1348
+ };
1349
+ ImageEditor.prototype.performTransformation = function (text) {
1350
+ var tempZoomFactor = this.defaultZoomFactor;
1351
+ var isUndoRedo = this.isUndoRedo;
1352
+ var prevCropObj = extend({}, this.cropObj, {}, true);
1353
+ this.resetZoom();
1348
1354
  this.updateTransform(text);
1349
1355
  if (tempZoomFactor !== 0) {
1350
1356
  this.isUndoRedo = true;
@@ -2328,7 +2334,6 @@ var ImageEditor = /** @class */ (function (_super) {
2328
2334
  isDisabledFilter = true;
2329
2335
  }
2330
2336
  this.enableDisableToolbarBtn();
2331
- var previousObj = void 0;
2332
2337
  var duplicateObj = void 0;
2333
2338
  var objColl = void 0;
2334
2339
  if (!this.disabled) {
@@ -2378,11 +2383,6 @@ var ImageEditor = /** @class */ (function (_super) {
2378
2383
  this.currentToolbar = 'main';
2379
2384
  break;
2380
2385
  case 'crop':
2381
- previousObj = this.getCurrentObj();
2382
- previousObj.objColl = extend([], this.objColl, [], true);
2383
- previousObj.pointColl = extend([], this.pointColl, [], true);
2384
- previousObj.afterCropActions = this.afterCropActions;
2385
- this.previousCropCurrentObj = previousObj;
2386
2386
  if (!isNullOrUndefined(this.currSelectionPoint)) {
2387
2387
  if (this.currObjType.isUndoAction) {
2388
2388
  this.refreshUndoRedoColl();
@@ -4448,48 +4448,63 @@ var ImageEditor = /** @class */ (function (_super) {
4448
4448
  this.inMemoryCanvas.width = imageData.width;
4449
4449
  this.inMemoryCanvas.height = imageData.height;
4450
4450
  this.inMemoryContext.putImageData(imageData, 0, 0);
4451
+ var ctx;
4451
4452
  var noFilter = document.querySelector('#' + this.element.id + '_defaultCanvas');
4452
- var ctx = noFilter.getContext('2d');
4453
- noFilter.style.width = '100px';
4454
- noFilter.style.height = '100px';
4455
- ctx.filter = this.updateAdjustment('default', null, true);
4456
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4453
+ if (!isNullOrUndefined(noFilter)) {
4454
+ ctx = noFilter.getContext('2d');
4455
+ noFilter.style.width = '100px';
4456
+ noFilter.style.height = '100px';
4457
+ ctx.filter = this.updateAdjustment('default', null, true);
4458
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4459
+ }
4457
4460
  var chrome = document.querySelector('#' + this.element.id + '_chromeCanvas');
4458
- ctx = chrome.getContext('2d');
4459
- chrome.style.width = '100px';
4460
- chrome.style.height = '100px';
4461
- ctx.filter = this.updateAdjustment('chrome', null, true);
4462
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4461
+ if (!isNullOrUndefined(chrome)) {
4462
+ ctx = chrome.getContext('2d');
4463
+ chrome.style.width = '100px';
4464
+ chrome.style.height = '100px';
4465
+ ctx.filter = this.updateAdjustment('chrome', null, true);
4466
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4467
+ }
4463
4468
  var cold = document.querySelector('#' + this.element.id + '_coldCanvas');
4464
- ctx = cold.getContext('2d');
4465
- cold.style.width = '100px';
4466
- cold.style.height = '100px';
4467
- ctx.filter = this.updateAdjustment('cold', null, true);
4468
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4469
+ if (!isNullOrUndefined(cold)) {
4470
+ ctx = cold.getContext('2d');
4471
+ cold.style.width = '100px';
4472
+ cold.style.height = '100px';
4473
+ ctx.filter = this.updateAdjustment('cold', null, true);
4474
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4475
+ }
4469
4476
  var warm = document.querySelector('#' + this.element.id + '_warmCanvas');
4470
- ctx = warm.getContext('2d');
4471
- warm.style.width = '100px';
4472
- warm.style.height = '100px';
4473
- ctx.filter = this.updateAdjustment('warm', null, true);
4474
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4477
+ if (!isNullOrUndefined(warm)) {
4478
+ ctx = warm.getContext('2d');
4479
+ warm.style.width = '100px';
4480
+ warm.style.height = '100px';
4481
+ ctx.filter = this.updateAdjustment('warm', null, true);
4482
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4483
+ }
4475
4484
  var grayscale = document.querySelector('#' + this.element.id + '_grayscaleCanvas');
4476
- ctx = grayscale.getContext('2d');
4477
- grayscale.style.width = '100px';
4478
- grayscale.style.height = '100px';
4479
- ctx.filter = this.updateAdjustment('grayscale', null, true);
4480
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4485
+ if (!isNullOrUndefined(grayscale)) {
4486
+ ctx = grayscale.getContext('2d');
4487
+ grayscale.style.width = '100px';
4488
+ grayscale.style.height = '100px';
4489
+ ctx.filter = this.updateAdjustment('grayscale', null, true);
4490
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4491
+ }
4481
4492
  var sepia = document.querySelector('#' + this.element.id + '_sepiaCanvas');
4482
- ctx = sepia.getContext('2d');
4483
- sepia.style.width = '100px';
4484
- sepia.style.height = '100px';
4485
- ctx.filter = this.updateAdjustment('sepia', null, true);
4486
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4493
+ if (!isNullOrUndefined(sepia)) {
4494
+ ctx = sepia.getContext('2d');
4495
+ sepia.style.width = '100px';
4496
+ sepia.style.height = '100px';
4497
+ ctx.filter = this.updateAdjustment('sepia', null, true);
4498
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4499
+ }
4487
4500
  var invert = document.querySelector('#' + this.element.id + '_invertCanvas');
4488
- ctx = invert.getContext('2d');
4489
- invert.style.width = '100px';
4490
- invert.style.height = '100px';
4491
- ctx.filter = this.updateAdjustment('invert', null, true);
4492
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4501
+ if (!isNullOrUndefined(invert)) {
4502
+ ctx = invert.getContext('2d');
4503
+ invert.style.width = '100px';
4504
+ invert.style.height = '100px';
4505
+ ctx.filter = this.updateAdjustment('invert', null, true);
4506
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4507
+ }
4493
4508
  };
4494
4509
  ImageEditor.prototype.callUpdateCurrentTransformedState = function () {
4495
4510
  var tempObjColl = extend([], this.objColl, [], true);
@@ -5127,6 +5142,7 @@ var ImageEditor = /** @class */ (function (_super) {
5127
5142
  this.activeObj.activePoint.height = this.activeObj.activePoint.endY - this.activeObj.activePoint.startY;
5128
5143
  this.updateActiveObject(this.activeObj.activePoint, this.activeObj);
5129
5144
  }
5145
+ this.updateSelectionInsert();
5130
5146
  this.drawObject('duplicate', this.activeObj, null, null, true);
5131
5147
  };
5132
5148
  ImageEditor.prototype.clearOuterCanvas = function (context) {
@@ -6258,7 +6274,7 @@ var ImageEditor = /** @class */ (function (_super) {
6258
6274
  _this.currObjType.isUndoZoom = false;
6259
6275
  _this.lowerCanvas.style.display = 'block';
6260
6276
  }
6261
- _this.isUndoRedo = false;
6277
+ _this.isUndoRedo = _this.isErrorImage = false;
6262
6278
  if (Browser.isDevice) {
6263
6279
  if (_this.isToolbar() && (!isNullOrUndefined(document.getElementById(_this.element.id + '_toolbar'))) &&
6264
6280
  (!isNullOrUndefined(getComponent(document.getElementById(_this.element.id + '_toolbar'), 'toolbar')))) {
@@ -6279,6 +6295,10 @@ var ImageEditor = /** @class */ (function (_super) {
6279
6295
  _this.initToolbarItem(false, false, null);
6280
6296
  }
6281
6297
  };
6298
+ this.baseImg.onerror = function () {
6299
+ hideSpinner(_this.element);
6300
+ _this.isErrorImage = true;
6301
+ };
6282
6302
  };
6283
6303
  ImageEditor.prototype.refreshActiveObj = function () {
6284
6304
  this.activeObj = {};
@@ -6746,7 +6766,8 @@ var ImageEditor = /** @class */ (function (_super) {
6746
6766
  else if (!isShape && !isNullOrUndefined(activeObj.shape)) {
6747
6767
  this.activeObj = activeObj;
6748
6768
  var index = this.getCurrentIndex();
6749
- if ((!isNullOrUndefined(index) && JSON.stringify(this.activeObj.activePoint) === JSON.stringify(this.objColl[index].activePoint))) {
6769
+ if ((!isNullOrUndefined(index) &&
6770
+ JSON.stringify(this.activeObj.activePoint) === JSON.stringify(this.objColl[index].activePoint))) {
6750
6771
  this.objColl.splice(index, 1);
6751
6772
  }
6752
6773
  else if (isNullOrUndefined(this.activeObj.currIndex)) {
@@ -12822,6 +12843,13 @@ var ImageEditor = /** @class */ (function (_super) {
12822
12843
  width: width, height: width };
12823
12844
  }
12824
12845
  this.activeObj.shape = cropShape.toLowerCase();
12846
+ this.updateSelectionInsert();
12847
+ if (this.activeObj.activePoint.startX !== 0 || this.activeObj.activePoint.startY !== 0 ||
12848
+ this.activeObj.activePoint.width !== 0 || this.activeObj.activePoint.height !== 0) {
12849
+ points = { startX: this.activeObj.activePoint.startX, startY: this.activeObj.activePoint.startY,
12850
+ endX: this.activeObj.activePoint.endX, endY: this.activeObj.activePoint.endY,
12851
+ width: this.activeObj.activePoint.width, height: this.activeObj.activePoint.height };
12852
+ }
12825
12853
  this.drawObject('duplicate', null, true, points);
12826
12854
  }
12827
12855
  };
@@ -13245,7 +13273,28 @@ var ImageEditor = /** @class */ (function (_super) {
13245
13273
  * @returns {ImageData}.
13246
13274
  */
13247
13275
  ImageEditor.prototype.getImageData = function () {
13276
+ if (!isNullOrUndefined(this.activeObj.shape)) {
13277
+ this.performCancel();
13278
+ }
13279
+ var currentObj;
13280
+ if (this.defaultZoomFactor > 0) {
13281
+ currentObj = this.getCurrentObj();
13282
+ currentObj.objColl = extend([], this.objColl, [], true);
13283
+ currentObj.pointColl = extend([], this.pointColl, [], true);
13284
+ currentObj.afterCropActions = extend([], this.afterCropActions, [], true);
13285
+ }
13286
+ this.resetZoom();
13248
13287
  var data = this.lowerContext.getImageData(this.destLeft, this.destTop, this.destWidth, this.destHeight);
13288
+ if (!isNullOrUndefined(currentObj)) {
13289
+ this.setCurrentObj(currentObj);
13290
+ this.objColl = extend([], currentObj.objColl, [], true);
13291
+ this.pointColl = extend([], currentObj.pointColl, [], true);
13292
+ this.freehandCounter = this.pointColl.length;
13293
+ this.lowerContext.filter = 'none';
13294
+ this.zoomObjColl();
13295
+ this.zoomFreehandDrawColl();
13296
+ this.lowerContext.filter = currentObj.filter;
13297
+ }
13249
13298
  return data;
13250
13299
  };
13251
13300
  /**
@@ -13268,12 +13317,15 @@ var ImageEditor = /** @class */ (function (_super) {
13268
13317
  }
13269
13318
  if (this.defToolbarItems.length === 0 &&
13270
13319
  (isNullOrUndefined(document.getElementById(this.element.id + '_toolbar')))) {
13271
- this.toolbarHeight = 0;
13272
- }
13273
- if (isNullOrUndefined(this.toolbarTemplate)) {
13274
- this.reset();
13275
- this.update();
13320
+ if (isNullOrUndefined(this.toolbarTemplate)) {
13321
+ this.toolbarHeight = 0;
13322
+ }
13323
+ else if (!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_toolbarArea'))) {
13324
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
13325
+ }
13276
13326
  }
13327
+ this.reset();
13328
+ this.update();
13277
13329
  this.degree = 0;
13278
13330
  this.zoomFactor = 0;
13279
13331
  this.isImageLoaded = false;
@@ -13315,7 +13367,7 @@ var ImageEditor = /** @class */ (function (_super) {
13315
13367
  * @returns {void}.
13316
13368
  */
13317
13369
  ImageEditor.prototype.reset = function () {
13318
- if (!this.disabled) {
13370
+ if (!this.disabled && !this.isErrorImage) {
13319
13371
  this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
13320
13372
  this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.height, this.lowerCanvas.width);
13321
13373
  this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
@@ -13386,7 +13438,7 @@ var ImageEditor = /** @class */ (function (_super) {
13386
13438
  this.rotatedDestPoints = { startX: 0, startY: 0, width: 0, height: 0 };
13387
13439
  this.croppedDegree = 0;
13388
13440
  this.freehandDrawHoveredIndex = this.freehandDrawSelectedIndex = null;
13389
- this.isFreehandDrawingPoint = this.isFreehandDrawEditing = false;
13441
+ this.isFreehandDrawingPoint = this.isFreehandDrawEditing = this.isErrorImage = false;
13390
13442
  this.tempFreeHandDrawEditingStyles = { strokeColor: null, fillColor: null, strokeWidth: null };
13391
13443
  this.totalPannedInternalPoint = { x: 0, y: 0 };
13392
13444
  this.totalPannedClientPoint = { x: 0, y: 0 };
@@ -13541,6 +13593,11 @@ var ImageEditor = /** @class */ (function (_super) {
13541
13593
  */
13542
13594
  ImageEditor.prototype.select = function (type, startX, startY, width, height) {
13543
13595
  if (!this.disabled && this.isImageLoaded) {
13596
+ var previousObj = this.getCurrentObj();
13597
+ previousObj.objColl = extend([], this.objColl, [], true);
13598
+ previousObj.pointColl = extend([], this.pointColl, [], true);
13599
+ previousObj.afterCropActions = this.afterCropActions;
13600
+ this.previousCropCurrentObj = previousObj;
13544
13601
  if (this.zoomFactor > 0 && !isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop' && isNullOrUndefined(this.currentSelectionPoint)) {
13545
13602
  this.currentSelectionPoint = extend({}, this.activeObj, {}, true);
13546
13603
  }
@@ -13597,6 +13654,13 @@ var ImageEditor = /** @class */ (function (_super) {
13597
13654
  }
13598
13655
  }
13599
13656
  };
13657
+ ImageEditor.prototype.updateSelectionInsert = function () {
13658
+ var shapeSettings = this.updatePreviousShapeSettings();
13659
+ var shapeChangingArgs = { action: 'insert', previousShapeSettings: shapeSettings,
13660
+ currentShapeSettings: shapeSettings };
13661
+ this.trigger('shapeChanging', shapeChangingArgs);
13662
+ this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
13663
+ };
13600
13664
  /**
13601
13665
  * Enable or disable a freehand drawing option in an Image Editor.
13602
13666
  *