@syncfusion/ej2-image-editor 24.1.43 → 24.1.45

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/ej2-image-editor.umd.min.js +2 -2
  4. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es2015.js +74 -38
  6. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-image-editor.es5.js +74 -38
  8. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  9. package/dist/global/ej2-image-editor.min.js +2 -2
  10. package/dist/global/ej2-image-editor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +9 -9
  13. package/src/image-editor/action/draw.js +29 -18
  14. package/src/image-editor/action/selection.js +8 -0
  15. package/src/image-editor/action/transform.js +5 -7
  16. package/src/image-editor/action/undo-redo.js +11 -1
  17. package/src/image-editor/renderer/toolbar.js +21 -12
  18. package/styles/bootstrap-dark.css +29 -2
  19. package/styles/bootstrap.css +29 -2
  20. package/styles/bootstrap4.css +29 -2
  21. package/styles/bootstrap5-dark.css +29 -2
  22. package/styles/bootstrap5.css +29 -2
  23. package/styles/fabric-dark.css +29 -2
  24. package/styles/fabric.css +29 -2
  25. package/styles/fluent-dark.css +29 -2
  26. package/styles/fluent.css +29 -2
  27. package/styles/highcontrast-light.css +29 -2
  28. package/styles/highcontrast.css +29 -2
  29. package/styles/image-editor/_bootstrap-dark-definition.scss +2 -0
  30. package/styles/image-editor/_bootstrap-definition.scss +2 -0
  31. package/styles/image-editor/_bootstrap4-definition.scss +2 -0
  32. package/styles/image-editor/_bootstrap5-definition.scss +2 -0
  33. package/styles/image-editor/_fabric-dark-definition.scss +2 -0
  34. package/styles/image-editor/_fabric-definition.scss +2 -0
  35. package/styles/image-editor/_fluent-definition.scss +2 -0
  36. package/styles/image-editor/_highcontrast-definition.scss +2 -0
  37. package/styles/image-editor/_highcontrast-light-definition.scss +2 -0
  38. package/styles/image-editor/_layout.scss +37 -6
  39. package/styles/image-editor/_material-dark-definition.scss +3 -1
  40. package/styles/image-editor/_material-definition.scss +3 -1
  41. package/styles/image-editor/_material3-definition.scss +2 -0
  42. package/styles/image-editor/_tailwind-definition.scss +2 -0
  43. package/styles/image-editor/bootstrap-dark.css +29 -2
  44. package/styles/image-editor/bootstrap.css +29 -2
  45. package/styles/image-editor/bootstrap4.css +29 -2
  46. package/styles/image-editor/bootstrap5-dark.css +29 -2
  47. package/styles/image-editor/bootstrap5.css +29 -2
  48. package/styles/image-editor/fabric-dark.css +29 -2
  49. package/styles/image-editor/fabric.css +29 -2
  50. package/styles/image-editor/fluent-dark.css +29 -2
  51. package/styles/image-editor/fluent.css +29 -2
  52. package/styles/image-editor/highcontrast-light.css +29 -2
  53. package/styles/image-editor/highcontrast.css +29 -2
  54. package/styles/image-editor/material-dark.css +30 -3
  55. package/styles/image-editor/material.css +30 -3
  56. package/styles/image-editor/material3-dark.css +27 -2
  57. package/styles/image-editor/material3.css +27 -2
  58. package/styles/image-editor/tailwind-dark.css +29 -2
  59. package/styles/image-editor/tailwind.css +29 -2
  60. package/styles/material-dark.css +30 -3
  61. package/styles/material.css +30 -3
  62. package/styles/material3-dark.css +27 -2
  63. package/styles/material3.css +27 -2
  64. package/styles/tailwind-dark.css +29 -2
  65. package/styles/tailwind.css +29 -2
@@ -1096,7 +1096,7 @@ class Draw {
1096
1096
  this.updateCanvas();
1097
1097
  break;
1098
1098
  case 'performCancel':
1099
- this.performCancel(args.value['isContextualToolbar']);
1099
+ this.performCancel(args.value['isContextualToolbar'], args.value['isUndoRedo']);
1100
1100
  break;
1101
1101
  case 'updateFlipPan':
1102
1102
  this.updateFlipPan(args.value['tempSelectionObj']);
@@ -1588,13 +1588,11 @@ class Draw {
1588
1588
  if (destTop < 0) {
1589
1589
  height += destTop;
1590
1590
  }
1591
- if (parent.currObjType.shape.toLowerCase() !== 'crop-square' && parent.currObjType.shape.toLowerCase() !== 'crop-circle') {
1592
- if (destLeft + destWidth > parent.lowerCanvas.width) {
1593
- width -= (destLeft + destWidth - parent.lowerCanvas.width);
1594
- }
1595
- if (destTop + destHeight > parent.lowerCanvas.height) {
1596
- height -= (destTop + destHeight - parent.lowerCanvas.height);
1597
- }
1591
+ if (destLeft + destWidth > parent.lowerCanvas.width) {
1592
+ width -= (destLeft + destWidth - parent.lowerCanvas.width);
1593
+ }
1594
+ if (destTop + destHeight > parent.lowerCanvas.height) {
1595
+ height -= (destTop + destHeight - parent.lowerCanvas.height);
1598
1596
  }
1599
1597
  }
1600
1598
  switch (parent.currObjType.shape.toLowerCase()) {
@@ -3216,7 +3214,7 @@ class Draw {
3216
3214
  parent.img.destHeight = maxDimension.width;
3217
3215
  }
3218
3216
  parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.height) / 2;
3219
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.width + 1) / 2;
3217
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.width) / 2;
3220
3218
  parent.img.destWidth = maxDimension.height;
3221
3219
  parent.img.destHeight = maxDimension.width;
3222
3220
  }
@@ -3232,7 +3230,12 @@ class Draw {
3232
3230
  parent.img.destHeight = maxDimension.height;
3233
3231
  }
3234
3232
  parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
3235
- parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
3233
+ if (degree === 0) {
3234
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
3235
+ }
3236
+ else {
3237
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
3238
+ }
3236
3239
  parent.img.destWidth = maxDimension.width;
3237
3240
  parent.img.destHeight = maxDimension.height;
3238
3241
  }
@@ -3546,14 +3549,14 @@ class Draw {
3546
3549
  parent.cancelCropSelection = null;
3547
3550
  }
3548
3551
  }
3549
- performCancel(isContextualToolbar) {
3552
+ performCancel(isContextualToolbar, isUndoRedo) {
3550
3553
  const parent = this.parent;
3551
3554
  const straightenObj = { bool: parent.isStraightening };
3552
3555
  isContextualToolbar = isContextualToolbar ? isContextualToolbar : false;
3553
3556
  const obj = { bool: false };
3554
3557
  parent.allowDownScale = true;
3555
3558
  parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
3556
- if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
3559
+ if (isNullOrUndefined(isUndoRedo) && JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
3557
3560
  extend(parent.frameObj, parent.tempFrameObj);
3558
3561
  this.renderImage(null, null, true);
3559
3562
  }
@@ -3627,11 +3630,19 @@ class Draw {
3627
3630
  if (!isBlazor()) {
3628
3631
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
3629
3632
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
3633
+ if (parent.activeObj.shape && parent.activeObj.shape === 'image') {
3634
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
3635
+ }
3630
3636
  }
3631
3637
  else {
3632
3638
  parent.updateToolbar(parent.element, 'imageLoaded');
3639
+ if (parent.activeObj.shape && parent.activeObj.shape === 'image') {
3640
+ parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
3641
+ }
3633
3642
  }
3634
3643
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'cancel' } });
3644
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
3645
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3635
3646
  }
3636
3647
  else {
3637
3648
  if (isContextualToolbar && (!Browser.isDevice || (Browser.isDevice && !straightenObj['bool']))) {
@@ -4316,16 +4327,16 @@ class Draw {
4316
4327
  setClientTransDim(isPreventDimension) {
4317
4328
  const parent = this.parent;
4318
4329
  if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
4319
- parent.img.destLeft = (parent.lowerCanvas.width - parent.img.destHeight) / 2;
4320
- parent.img.destTop = (parent.lowerCanvas.height - parent.img.destWidth) / 2;
4330
+ parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destHeight) / 2;
4331
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destWidth + 1) / 2;
4321
4332
  const temp = parent.img.destWidth;
4322
4333
  parent.img.destWidth = parent.img.destHeight;
4323
4334
  parent.img.destHeight = temp;
4324
4335
  }
4325
4336
  else {
4326
4337
  if (isNullOrUndefined(isPreventDimension)) {
4327
- parent.img.destLeft = (parent.lowerCanvas.width - parent.img.destWidth) / 2;
4328
- parent.img.destTop = (parent.lowerCanvas.height - parent.img.destHeight) / 2;
4338
+ parent.img.destLeft = (parent.lowerCanvas.clientWidth - parent.img.destWidth) / 2;
4339
+ parent.img.destTop = (parent.lowerCanvas.clientHeight - parent.img.destHeight + 1) / 2;
4329
4340
  }
4330
4341
  }
4331
4342
  }
@@ -5039,9 +5050,9 @@ class Draw {
5039
5050
  }
5040
5051
  }
5041
5052
  }
5042
- const panX = (parent.lowerCanvas.clientWidth / 2) - Math.floor(currObj.activePoint.startX +
5053
+ const panX = (parent.lowerCanvas.clientWidth / 2) - (currObj.activePoint.startX +
5043
5054
  (currObj.activePoint.width / 2));
5044
- const panY = (parent.lowerCanvas.clientHeight / 2) - Math.floor(currObj.activePoint.startY +
5055
+ const panY = ((parent.lowerCanvas.clientHeight + 1) / 2) - (currObj.activePoint.startY +
5045
5056
  (currObj.activePoint.height / 2));
5046
5057
  if (isNullOrUndefined(parent.activeObj.shape)) {
5047
5058
  parent.activeObj = extend({}, activeObj, {}, true);
@@ -12613,7 +12624,15 @@ class Selection {
12613
12624
  this.getCurrentFlipState();
12614
12625
  }
12615
12626
  else {
12627
+ const totalPannedInternalPoint = extend({}, parent.panPoint.totalPannedInternalPoint, {}, true);
12628
+ const destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
12629
+ height: parent.img.destHeight };
12616
12630
  parent.notify('draw', { prop: 'callUpdateCurrTransState', onPropertyChange: false });
12631
+ parent.panPoint.totalPannedInternalPoint = totalPannedInternalPoint;
12632
+ parent.img.destLeft = destPoints.startX;
12633
+ parent.img.destTop = destPoints.startY;
12634
+ parent.img.destWidth = destPoints.width;
12635
+ parent.img.destHeight = destPoints.height;
12617
12636
  parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
12618
12637
  value: { context: this.lowerContext, points: null } });
12619
12638
  }
@@ -17814,11 +17833,11 @@ class Transform {
17814
17833
  if (parent.img.destTop > 0) {
17815
17834
  parent.img.destTop = 0;
17816
17835
  }
17817
- if (parent.img.destLeft + maxDimension.width < parent.lowerCanvas.width) {
17818
- parent.img.destLeft = parent.lowerCanvas.width - parent.img.destWidth;
17836
+ if (parent.img.destLeft + maxDimension.width < parent.lowerCanvas.clientWidth) {
17837
+ parent.img.destLeft = parent.lowerCanvas.clientWidth - parent.img.destWidth;
17819
17838
  }
17820
- if (parent.img.destTop + maxDimension.height < parent.lowerCanvas.height) {
17821
- parent.img.destTop = parent.lowerCanvas.height - parent.img.destHeight;
17839
+ if (parent.img.destTop + maxDimension.height < parent.lowerCanvas.clientHeight) {
17840
+ parent.img.destTop = parent.lowerCanvas.clientHeight - parent.img.destHeight;
17822
17841
  }
17823
17842
  }
17824
17843
  return maxDimension;
@@ -19042,9 +19061,7 @@ class Transform {
19042
19061
  parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
19043
19062
  }
19044
19063
  parent.setStraighten(degree, true);
19045
- if ((isBlazor() && parent.events && parent.events.straightening.hasDelegate === false) || !isBlazor()) {
19046
- parent.okBtn();
19047
- }
19064
+ parent.okBtn();
19048
19065
  }
19049
19066
  }
19050
19067
 
@@ -19431,7 +19448,7 @@ class UndoRedo {
19431
19448
  this.tempCurrSelPoint = extend({}, parent.currSelectionPoint, {}, true);
19432
19449
  parent.currSelectionPoint = null;
19433
19450
  }
19434
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
19451
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null, isUndoRedo: true } });
19435
19452
  parent.currObjType.isActiveObj = false;
19436
19453
  if (parent.transform.straighten !== 0) {
19437
19454
  parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
@@ -19994,6 +20011,16 @@ class UndoRedo {
19994
20011
  this.parent.notify('draw', { prop: 'getArrowDimension', onPropertyChange: false, value: { obj: arrowObj } });
19995
20012
  const tempArrowObj = extend({}, arrowObj['arrowDimension'], {}, true);
19996
20013
  if (parent.transform.zoomFactor > 0 && (obj.length > 0 || point.length > 0)) {
20014
+ if (obj.length > 0) {
20015
+ for (let i = 0; i < obj.length; i++) {
20016
+ if (obj[i].currIndex) {
20017
+ continue;
20018
+ }
20019
+ else {
20020
+ obj[i].currIndex = 'shape_' + (i + 1);
20021
+ }
20022
+ }
20023
+ }
19997
20024
  parent.objColl = obj;
19998
20025
  parent.pointColl = point;
19999
20026
  const isUndoRedo = parent.isUndoRedo;
@@ -24274,7 +24301,7 @@ class ToolbarModule {
24274
24301
  this.createLeftToolbarControls();
24275
24302
  const mToolbar = document.getElementById(id + '_toolbar');
24276
24303
  if (toolbar) {
24277
- this.toolbarHeight = mToolbar.scrollHeight;
24304
+ this.toolbarHeight = mToolbar.clientHeight;
24278
24305
  }
24279
24306
  }
24280
24307
  else {
@@ -24575,10 +24602,10 @@ class ToolbarModule {
24575
24602
  }
24576
24603
  if (!isBlazor()) {
24577
24604
  if (parent.toolbarTemplate) {
24578
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').offsetHeight;
24605
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
24579
24606
  }
24580
24607
  else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
24581
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').offsetHeight;
24608
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
24582
24609
  }
24583
24610
  parent.toolbarHeight = this.toolbarHeight;
24584
24611
  }
@@ -24589,7 +24616,7 @@ class ToolbarModule {
24589
24616
  cHt = cusWrapper.offsetHeight + 2;
24590
24617
  }
24591
24618
  const ht = parent.element.querySelector('#' + id + '_canvasWrapper').offsetHeight;
24592
- contextualToolbarArea.style.top = this.toolbarHeight + ht - cHt + 'px';
24619
+ contextualToolbarArea.style.top = this.toolbarHeight + 1 + ht - cHt + 'px';
24593
24620
  if (cType === 'straighten') {
24594
24621
  parent.isStraightening = true;
24595
24622
  const ctxToolbar = parent.element.querySelector('#' + id + '_contextualToolbarArea');
@@ -24606,7 +24633,7 @@ class ToolbarModule {
24606
24633
  }
24607
24634
  }
24608
24635
  else {
24609
- contextualToolbarArea.style.top = this.toolbarHeight + 'px';
24636
+ contextualToolbarArea.style.top = this.toolbarHeight + 1 + 'px';
24610
24637
  }
24611
24638
  }
24612
24639
  processToolbar(position) {
@@ -25426,8 +25453,8 @@ class ToolbarModule {
25426
25453
  }
25427
25454
  const slider = parent.element.querySelector('#' + id + '_straightenSlider');
25428
25455
  if ((isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Straightening') > -1))
25429
- && slider && slider.parentElement.scrollHeight > this.toolbarHeight) {
25430
- this.toolbarHeight = parent.toolbarHeight = slider.parentElement.scrollHeight;
25456
+ && slider && slider.parentElement.clientHeight > this.toolbarHeight) {
25457
+ this.toolbarHeight = parent.toolbarHeight = slider.parentElement.clientHeight;
25431
25458
  }
25432
25459
  this.enableDisableTbrBtn();
25433
25460
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
@@ -27461,6 +27488,9 @@ class ToolbarModule {
27461
27488
  qtArea.style.top = point.startY - (height + (height / 1.5)) + 'px';
27462
27489
  }
27463
27490
  }
27491
+ if (parseFloat(qtArea.style.top) < 0) {
27492
+ qtArea.style.top = '0px';
27493
+ }
27464
27494
  }
27465
27495
  }
27466
27496
  refreshDropDownBtn(isDisabled) {
@@ -28311,20 +28341,23 @@ class ToolbarModule {
28311
28341
  if (type === 'transparency') {
28312
28342
  labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
28313
28343
  id: id + '_labelWrapper',
28314
- styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
28315
- : 'position: absolute; top: 25%; left: calc(50% - 250px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
28344
+ className: 'e-ie-finetune-slider-label',
28345
+ styles: Browser.isDevice ? 'position: absolute; top: 31%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
28346
+ : 'position: absolute; top: 31%; left: calc(50% - 220px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
28316
28347
  }));
28317
28348
  }
28318
28349
  else {
28319
28350
  labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
28320
28351
  id: id + '_labelWrapper',
28321
- styles: Browser.isDevice ? ('position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;')
28352
+ className: 'e-ie-finetune-slider-label',
28353
+ styles: Browser.isDevice ? ('position: absolute; top: 31%; left: calc(50% - 160px); font-size: 15px; text-transform: capitalize; font-weight: 400;')
28322
28354
  : 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
28323
28355
  }));
28324
28356
  }
28325
28357
  labelWrapper.textContent = this.l10n.getConstant(parent.toPascalCase(type === 'transparency' ? 'opacity' : type));
28326
28358
  const sliderWrapper = hdrWrapper.appendChild(parent.createElement('div', {
28327
28359
  id: id + '_sliderWrapper',
28360
+ className: 'e-ie-finetune-slider-wrap',
28328
28361
  styles: 'position: absolute'
28329
28362
  }));
28330
28363
  let value = parent.getCurrAdjustmentValue(type);
@@ -28403,8 +28436,8 @@ class ToolbarModule {
28403
28436
  if (type === 'straighten' && Browser.isDevice) {
28404
28437
  const sLabelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
28405
28438
  id: id + '_sLabelWrapper',
28406
- className: 'e-ie-straighten-value-span',
28407
- styles: 'position: absolute; top: 25%; margin-left: 20px; font-size: 15px; text-transform: capitalize; font-weight: 400;'
28439
+ className: 'e-ie-straighten-value-span e-ie-finetune-value-span',
28440
+ styles: 'position: absolute; top: 31%; margin-left: 20px; font-size: 15px; text-transform: capitalize; font-weight: 400;'
28408
28441
  }));
28409
28442
  sLabelWrapper.innerHTML = parent.transform.straighten.toString() + '&#176';
28410
28443
  sliderWrapper.parentElement.classList.add('e-straighten-slider');
@@ -28417,6 +28450,9 @@ class ToolbarModule {
28417
28450
  'position: absolute; top: 25%; left: calc(50% + 190px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
28418
28451
  }));
28419
28452
  sliderWrapper.parentElement.classList.add('e-finetune-slider');
28453
+ if (type === 'transparency' && Browser.isDevice) {
28454
+ sliderWrapper.parentElement.classList.add('e-ie-device-transparency-slider');
28455
+ }
28420
28456
  this.updateFinetuneSpan(type);
28421
28457
  }
28422
28458
  }