@syncfusion/ej2-image-editor 24.2.3 → 24.2.4

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.
@@ -8321,6 +8321,7 @@ var Selection = /** @__PURE__ @class */ (function () {
8321
8321
  this.isImageClarity = true;
8322
8322
  this.isPinching = false;
8323
8323
  this.isSliding = false;
8324
+ this.mouseDown = '';
8324
8325
  this.parent = parent;
8325
8326
  this.addEventListener();
8326
8327
  }
@@ -8609,6 +8610,7 @@ var Selection = /** @__PURE__ @class */ (function () {
8609
8610
  this.currentDrawingShape = '';
8610
8611
  this.initialPrevObj = {};
8611
8612
  this.resizedElement = '';
8613
+ this.mouseDown = '';
8612
8614
  };
8613
8615
  Selection.prototype.performTabAction = function () {
8614
8616
  var parent = this.parent;
@@ -11027,6 +11029,8 @@ var Selection = /** @__PURE__ @class */ (function () {
11027
11029
  Selection.prototype.mouseDownEventHandler = function (e) {
11028
11030
  var _this = this;
11029
11031
  var parent = this.parent;
11032
+ this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
11033
+ 'canvas' : '';
11030
11034
  if (e.type === 'touchstart') {
11031
11035
  this.isTouch = true;
11032
11036
  }
@@ -11464,6 +11468,10 @@ var Selection = /** @__PURE__ @class */ (function () {
11464
11468
  && !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
11465
11469
  return;
11466
11470
  }
11471
+ else if (e.currentTarget === document && this.mouseDown === '') {
11472
+ e.stopImmediatePropagation();
11473
+ return;
11474
+ }
11467
11475
  if (e.type === 'touchstart') {
11468
11476
  this.isTouch = false;
11469
11477
  }
@@ -11723,6 +11731,7 @@ var Selection = /** @__PURE__ @class */ (function () {
11723
11731
  parent.currObjType.shape = '';
11724
11732
  }
11725
11733
  this.dragElement = '';
11734
+ this.mouseDown = '';
11726
11735
  parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11727
11736
  this.selMouseUpEvent();
11728
11737
  };
@@ -19392,6 +19401,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19392
19401
  UndoRedo.prototype.undo = function () {
19393
19402
  var parent = this.parent;
19394
19403
  this.cancelCropSelection();
19404
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19395
19405
  if (!parent.disabled && parent.isImageLoaded) {
19396
19406
  if (this.undoRedoStep > 0) {
19397
19407
  this.refreshToolbarActions();
@@ -19530,6 +19540,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19530
19540
  UndoRedo.prototype.redo = function () {
19531
19541
  var parent = this.parent;
19532
19542
  this.cancelCropSelection();
19543
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19533
19544
  if (!parent.disabled && parent.isImageLoaded) {
19534
19545
  if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
19535
19546
  this.refreshToolbarActions();
@@ -25662,7 +25673,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25662
25673
  var args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25663
25674
  toolbarItems: this.defToolbarItems };
25664
25675
  parent.trigger('toolbarUpdating', args);
25665
- this.defToolbarItems = args.toolbarItems;
25676
+ if (this.isToolbarString(args.toolbarItems)) {
25677
+ items = args.toolbarItems;
25678
+ this.excludeItems(args.toolbarItems);
25679
+ }
25680
+ else {
25681
+ this.defToolbarItems = args.toolbarItems;
25682
+ }
25666
25683
  var toolbar = new Toolbar({
25667
25684
  width: '100%',
25668
25685
  items: this.defToolbarItems,
@@ -25672,8 +25689,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25672
25689
  _this.createShapeColor(items);
25673
25690
  _this.createShapeBtn(items);
25674
25691
  if (parent.activeObj.shape === 'arrow') {
25675
- _this.createStartBtn();
25676
- _this.createEndBtn();
25692
+ if (items.some(function (item) { return item.toLowerCase().indexOf('start') > -1; })) {
25693
+ _this.createStartBtn();
25694
+ }
25695
+ if (items.some(function (item) { return item.toLowerCase().indexOf('end') > -1; })) {
25696
+ _this.createEndBtn();
25697
+ }
25677
25698
  }
25678
25699
  _this.wireZoomBtnEvents();
25679
25700
  if (!Browser.isDevice) {
@@ -25837,24 +25858,24 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25837
25858
  ToolbarModule.prototype.createShapeBtn = function (items) {
25838
25859
  var parent = this.parent;
25839
25860
  var id = parent.element.id;
25840
- var strokeWidthItems = [
25841
- { id: '1', text: this.l10n.getConstant('XSmall') },
25842
- { id: '2', text: this.l10n.getConstant('Small') },
25843
- { id: '3', text: this.l10n.getConstant('Medium') },
25844
- { id: '4', text: this.l10n.getConstant('Large') },
25845
- { id: '5', text: this.l10n.getConstant('XLarge') }
25846
- ];
25847
- if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25848
- strokeWidthItems = [
25849
- { id: '1', text: this.l10n.getConstant('NoOutline') },
25850
- { id: '2', text: this.l10n.getConstant('XSmall') },
25851
- { id: '3', text: this.l10n.getConstant('Small') },
25852
- { id: '4', text: this.l10n.getConstant('Medium') },
25853
- { id: '5', text: this.l10n.getConstant('Large') },
25854
- { id: '6', text: this.l10n.getConstant('XLarge') }
25855
- ];
25856
- }
25857
25861
  if (items.indexOf('strokeWidth') > -1) {
25862
+ var strokeWidthItems = [
25863
+ { id: '1', text: this.l10n.getConstant('XSmall') },
25864
+ { id: '2', text: this.l10n.getConstant('Small') },
25865
+ { id: '3', text: this.l10n.getConstant('Medium') },
25866
+ { id: '4', text: this.l10n.getConstant('Large') },
25867
+ { id: '5', text: this.l10n.getConstant('XLarge') }
25868
+ ];
25869
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25870
+ strokeWidthItems = [
25871
+ { id: '1', text: this.l10n.getConstant('NoOutline') },
25872
+ { id: '2', text: this.l10n.getConstant('XSmall') },
25873
+ { id: '3', text: this.l10n.getConstant('Small') },
25874
+ { id: '4', text: this.l10n.getConstant('Medium') },
25875
+ { id: '5', text: this.l10n.getConstant('Large') },
25876
+ { id: '6', text: this.l10n.getConstant('XLarge') }
25877
+ ];
25878
+ }
25858
25879
  var strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
25859
25880
  var spanElem_1 = document.createElement('span');
25860
25881
  spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
@@ -26071,7 +26092,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26071
26092
  }
26072
26093
  var args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
26073
26094
  parent.trigger('toolbarUpdating', args);
26074
- this.defToolbarItems = args.toolbarItems;
26095
+ if (this.isToolbarString(args.toolbarItems)) {
26096
+ items = args.toolbarItems;
26097
+ this.excludeItems(args.toolbarItems);
26098
+ }
26099
+ else {
26100
+ this.defToolbarItems = args.toolbarItems;
26101
+ }
26075
26102
  var toolbar = new Toolbar({
26076
26103
  width: '100%',
26077
26104
  items: this.defToolbarItems,
@@ -26557,7 +26584,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26557
26584
  template: '<button id="' + id + '_penColorBtn"></button>' });
26558
26585
  }
26559
26586
  if (items.indexOf('strokeWidth') > -1) {
26560
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
26587
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokewidth',
26588
+ cssClass: 'top-icon e-size',
26561
26589
  tooltipText: this.l10n.getConstant('StrokeWidth'),
26562
26590
  align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
26563
26591
  }
@@ -26594,7 +26622,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26594
26622
  }
26595
26623
  var args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26596
26624
  parent.trigger('toolbarUpdating', args);
26597
- this.defToolbarItems = args.toolbarItems;
26625
+ if (this.isToolbarString(args.toolbarItems)) {
26626
+ items = args.toolbarItems;
26627
+ this.excludeItems(args.toolbarItems);
26628
+ }
26629
+ else {
26630
+ this.defToolbarItems = args.toolbarItems;
26631
+ }
26598
26632
  var toolbar = new Toolbar({
26599
26633
  width: '100%',
26600
26634
  items: this.defToolbarItems,
@@ -27736,6 +27770,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27736
27770
  var ctx = void 0;
27737
27771
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
27738
27772
  var type = args.item.id.replace(id + '_', '').toLowerCase();
27773
+ var left = void 0;
27774
+ var right = void 0;
27739
27775
  switch (type) {
27740
27776
  case 'duplicate':
27741
27777
  if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
@@ -27785,8 +27821,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27785
27821
  break;
27786
27822
  case 'rotleft':
27787
27823
  case 'rotright':
27788
- if (!parent.element.querySelector('#' + id + '_rotLeft').classList.contains('e-disabled') ||
27789
- !parent.element.querySelector('#' + id + '_rotRight').classList.contains('e-disabled')) {
27824
+ left = parent.element.querySelector('#' + id + '_rotLeft');
27825
+ right = parent.element.querySelector('#' + id + '_rotRight');
27826
+ if ((left && !left.classList.contains('e-disabled')) ||
27827
+ (right && !right.classList.contains('e-disabled'))) {
27790
27828
  parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
27791
27829
  }
27792
27830
  break;
@@ -28916,6 +28954,80 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28916
28954
  parent.activeObj.textFlip = parent.transform.currFlipState;
28917
28955
  parent.activeObj.flipObjColl = [];
28918
28956
  };
28957
+ ToolbarModule.prototype.isToolbarString = function (items) {
28958
+ var isString = false;
28959
+ for (var i = 0; i < items.length; i++) {
28960
+ if (typeof (items[i]) === 'string') {
28961
+ isString = true;
28962
+ break;
28963
+ }
28964
+ }
28965
+ return isString;
28966
+ };
28967
+ ToolbarModule.prototype.excludeItems = function (items) {
28968
+ var indexArr = [];
28969
+ for (var i = 0; i < items.length; i++) {
28970
+ var index = this.getIndex(items[i]);
28971
+ if (index !== -1) {
28972
+ indexArr.push(index);
28973
+ }
28974
+ }
28975
+ var negativeIndexArr = [];
28976
+ for (var i = 0; i < this.defToolbarItems.length; i++) {
28977
+ if (this.defToolbarItems[i].align === 'Center' && !this.isSameIndex(indexArr, i) &&
28978
+ this.defToolbarItems[i].id !== this.parent.element.id + '_' + 'annotation') {
28979
+ negativeIndexArr.push(i);
28980
+ }
28981
+ }
28982
+ for (var i = negativeIndexArr.length - 1; i >= 0; i--) {
28983
+ this.defToolbarItems.splice(negativeIndexArr[i], 1);
28984
+ }
28985
+ };
28986
+ ToolbarModule.prototype.isSameIndex = function (indexArr, index) {
28987
+ for (var i = 0; i < indexArr.length; i++) {
28988
+ if (indexArr[i] === index) {
28989
+ return true;
28990
+ }
28991
+ }
28992
+ return false;
28993
+ };
28994
+ ToolbarModule.prototype.getIndex = function (item) {
28995
+ var index = -1;
28996
+ var isFontColor = false;
28997
+ if (item === 'rotateLeft') {
28998
+ item = 'rotLeft';
28999
+ }
29000
+ if (item === 'rotateRight') {
29001
+ item = 'rotRight';
29002
+ }
29003
+ if (item === 'horizontalFlip') {
29004
+ item = 'hflip';
29005
+ }
29006
+ if (item === 'verticalFlip') {
29007
+ item = 'vflip';
29008
+ }
29009
+ if (item === 'arrowStart') {
29010
+ item = 'start';
29011
+ }
29012
+ if (item === 'arrowEnd') {
29013
+ item = 'end';
29014
+ }
29015
+ if (item === 'fontColor') {
29016
+ item = 'strokeColor';
29017
+ isFontColor = true;
29018
+ }
29019
+ for (var i = 0; i < this.defToolbarItems.length; i++) {
29020
+ var id = this.defToolbarItems[i].id;
29021
+ if (id && id.toLowerCase().indexOf(item.toLowerCase()) !== -1) {
29022
+ index = i;
29023
+ break;
29024
+ }
29025
+ }
29026
+ if (isFontColor) {
29027
+ item = 'fontColor';
29028
+ }
29029
+ return index;
29030
+ };
28919
29031
  ToolbarModule.prototype.getModuleName = function () {
28920
29032
  return 'toolbar-module';
28921
29033
  };