@syncfusion/ej2-image-editor 24.2.3 → 24.2.5

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.
@@ -4761,7 +4761,8 @@ var Draw = /** @__PURE__ @class */ (function () {
4761
4761
  if (!isBlazor()) {
4762
4762
  parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
4763
4763
  if (obj['defToolbarItems'].length === 0 &&
4764
- (isNullOrUndefined(document.getElementById(id + '_toolbar')))) {
4764
+ (isNullOrUndefined(document.getElementById(id + '_toolbar'))) &&
4765
+ parent.element.querySelector('#' + id + '_toolbarArea')) {
4765
4766
  var height = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
4766
4767
  parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
4767
4768
  }
@@ -8321,6 +8322,8 @@ var Selection = /** @__PURE__ @class */ (function () {
8321
8322
  this.isImageClarity = true;
8322
8323
  this.isPinching = false;
8323
8324
  this.isSliding = false;
8325
+ this.mouseDown = '';
8326
+ this.isSliderActive = false;
8324
8327
  this.parent = parent;
8325
8328
  this.addEventListener();
8326
8329
  }
@@ -8563,6 +8566,12 @@ var Selection = /** @__PURE__ @class */ (function () {
8563
8566
  case 'setSliding':
8564
8567
  this.isSliding = args.value['bool'];
8565
8568
  break;
8569
+ case 'setSliderActive':
8570
+ this.isSliderActive = args.value['bool'];
8571
+ break;
8572
+ case 'getArrowType':
8573
+ args.value['obj']['type'] = this.getArrowType(args.value['type']);
8574
+ break;
8566
8575
  }
8567
8576
  };
8568
8577
  Selection.prototype.getModuleName = function () {
@@ -8609,6 +8618,8 @@ var Selection = /** @__PURE__ @class */ (function () {
8609
8618
  this.currentDrawingShape = '';
8610
8619
  this.initialPrevObj = {};
8611
8620
  this.resizedElement = '';
8621
+ this.mouseDown = '';
8622
+ this.isSliderActive = false;
8612
8623
  };
8613
8624
  Selection.prototype.performTabAction = function () {
8614
8625
  var parent = this.parent;
@@ -11027,6 +11038,8 @@ var Selection = /** @__PURE__ @class */ (function () {
11027
11038
  Selection.prototype.mouseDownEventHandler = function (e) {
11028
11039
  var _this = this;
11029
11040
  var parent = this.parent;
11041
+ this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
11042
+ 'canvas' : '';
11030
11043
  if (e.type === 'touchstart') {
11031
11044
  this.isTouch = true;
11032
11045
  }
@@ -11464,267 +11477,273 @@ var Selection = /** @__PURE__ @class */ (function () {
11464
11477
  && !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
11465
11478
  return;
11466
11479
  }
11467
- if (e.type === 'touchstart') {
11468
- this.isTouch = false;
11469
- }
11470
- else if (e.type === 'touchend') {
11471
- e.stopImmediatePropagation();
11472
- }
11473
- e.preventDefault();
11474
- if (parent.togglePan) {
11475
- this.canvasMouseUpHandler(e);
11476
- }
11477
- var x;
11478
- var y;
11479
- if (e.type === 'mouseup') {
11480
- x = e.clientX;
11481
- y = e.clientY;
11482
- }
11483
- else {
11484
- x = this.touchEndPoint.x;
11485
- y = this.touchEndPoint.y;
11486
- }
11487
- var bbox = parent.lowerCanvas.getBoundingClientRect();
11488
- x -= bbox.left;
11489
- y -= bbox.top;
11490
- if (e.type === 'touchend') {
11491
- this.startTouches = this.tempTouches = [];
11492
- this.isFirstMove = false;
11493
- if (parent.textArea.style.display === 'none') {
11494
- this.timer = 0;
11480
+ if (this.mouseDown === 'canvas' || this.isSliderActive ||
11481
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11482
+ e.target.closest('.e-image-editor') || e.target.closest('.e-ie-ddb-popup')) {
11483
+ if (e.type === 'touchstart') {
11484
+ this.isTouch = false;
11495
11485
  }
11496
- if (this.isPinching) {
11497
- this.isPinching = false;
11498
- parent.notify('draw', { prop: 'redrawDownScale' });
11499
- if (parent.isCropTab || parent.activeObj.shape) {
11500
- parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
11501
- parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
11502
- }
11503
- if (parent.isStraightening) {
11504
- parent.notify('draw', { prop: 'resetStraightenDestPoints' });
11505
- parent.notify('draw', { prop: 'setDestForStraighten' });
11506
- }
11507
- return;
11486
+ else if (e.type === 'touchend') {
11487
+ e.stopImmediatePropagation();
11508
11488
  }
11509
- }
11510
- var isCropSelection = false;
11511
- var splitWords;
11512
- if (parent.activeObj.shape !== undefined) {
11513
- splitWords = parent.activeObj.shape.split('-');
11514
- }
11515
- if (splitWords !== undefined && splitWords[0] === 'crop') {
11516
- isCropSelection = true;
11517
- }
11518
- if (isBlazor() && parent.eventType) {
11519
- if (parent.eventType === 'pan') {
11520
- if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
11521
- parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
11522
- }
11489
+ e.preventDefault();
11490
+ if (parent.togglePan) {
11491
+ this.canvasMouseUpHandler(e);
11523
11492
  }
11524
- else if (parent.eventType === 'resize') {
11525
- if (!this.isCropSelection && parent.events && parent.events.onShapeResizeEnd.hasDelegate === true) {
11526
- this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11527
- this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
11528
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11529
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then(function (shapeResizingArgs) {
11530
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11531
- value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
11532
- });
11533
- }
11534
- else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
11535
- parent.events.onSelectionResizeEnd.hasDelegate === true) {
11536
- var currentSelectionSettings = { type: parent.activeObj.shape,
11537
- startX: this.shapeResizingArgs.currentShapeSettings.startX,
11538
- startY: this.shapeResizingArgs.currentShapeSettings.startY,
11539
- width: this.shapeResizingArgs.currentShapeSettings.width,
11540
- height: this.shapeResizingArgs.currentShapeSettings.height };
11541
- this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
11542
- this.selectionResizingArgs.action = 'resize-end';
11543
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11544
- parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then(function (selectionResizingArgs) {
11545
- parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
11546
- value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
11547
- });
11548
- }
11493
+ var x = void 0;
11494
+ var y = void 0;
11495
+ if (e.type === 'mouseup') {
11496
+ x = e.clientX;
11497
+ y = e.clientY;
11549
11498
  }
11550
11499
  else {
11551
- if (this.shapeMovingArgs && parent.events && parent.events.onShapeDragEnd.hasDelegate === true) {
11552
- this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11553
- this.shapeMovingArgs.action = 'drag-end';
11554
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11555
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragEnd', this.shapeMovingArgs, null).then(function (shapeMovingArgs) {
11556
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11557
- value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
11558
- });
11500
+ x = this.touchEndPoint.x;
11501
+ y = this.touchEndPoint.y;
11502
+ }
11503
+ var bbox = parent.lowerCanvas.getBoundingClientRect();
11504
+ x -= bbox.left;
11505
+ y -= bbox.top;
11506
+ if (e.type === 'touchend') {
11507
+ this.startTouches = this.tempTouches = [];
11508
+ this.isFirstMove = false;
11509
+ if (parent.textArea.style.display === 'none') {
11510
+ this.timer = 0;
11511
+ }
11512
+ if (this.isPinching) {
11513
+ this.isPinching = false;
11514
+ parent.notify('draw', { prop: 'redrawDownScale' });
11515
+ if (parent.isCropTab || parent.activeObj.shape) {
11516
+ parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
11517
+ parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
11518
+ }
11519
+ if (parent.isStraightening) {
11520
+ parent.notify('draw', { prop: 'resetStraightenDestPoints' });
11521
+ parent.notify('draw', { prop: 'setDestForStraighten' });
11522
+ }
11523
+ return;
11559
11524
  }
11560
11525
  }
11561
- this.shapeResizingArgs = null;
11562
- this.shapeMovingArgs = null;
11563
- parent.panEventArgs = null;
11564
- parent.eventType = null;
11565
- }
11566
- if (this.currentDrawingShape === 'path') {
11567
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11568
- var elem = e.srcElement;
11569
- var elemId = elem.parentElement.id;
11570
- var id_1 = parent.element.id;
11571
- if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
11572
- (elem.classList.contains('e-upload-icon') || elemId === id_1 + '_zoomIn' ||
11573
- elemId === id_1 + '_zoomOut' || elemId === id_1 + '_annotationBtn' ||
11574
- elemId === id_1 + '_borderColorBtn' || elemId === id_1 + '_borderWidthBtn' || elemId === id_1 + '_saveBtn')) {
11575
- parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
11576
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
11577
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
11578
- points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
11526
+ var isCropSelection = false;
11527
+ var splitWords = void 0;
11528
+ if (parent.activeObj.shape !== undefined) {
11529
+ splitWords = parent.activeObj.shape.split('-');
11579
11530
  }
11580
- return;
11581
- }
11582
- if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
11583
- this.pathAdjustedIndex = null;
11584
- if (this.currentDrawingShape !== '') {
11585
- if (this.currentDrawingShape === 'text') {
11586
- var prevCropObj_1 = extend({}, parent.cropObj, {}, true);
11587
- parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11588
- value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11589
- previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11590
- previousCropObj: prevCropObj_1, previousText: null,
11591
- currentText: null, previousFilter: null, isCircleCrop: null } });
11531
+ if (splitWords !== undefined && splitWords[0] === 'crop') {
11532
+ isCropSelection = true;
11533
+ }
11534
+ if (isBlazor() && parent.eventType) {
11535
+ if (parent.eventType === 'pan') {
11536
+ if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
11537
+ parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
11538
+ }
11592
11539
  }
11593
- else {
11594
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11595
- }
11596
- this.isShapeInserted = true;
11597
- this.currentDrawingShape = '';
11598
- if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
11599
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
11600
- }
11601
- var previousShapeSettings = this.updatePrevShapeSettings();
11602
- var shapeResizingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: previousShapeSettings };
11603
- var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
11604
- this.shapeResizingArgs = shapeResizingArgs;
11605
- this.shapeMovingArgs = shapeMovingArgs;
11606
- this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
11607
- }
11608
- this.adjustActObjForLineArrow();
11609
- this.updPtCollForShpRot();
11610
- parent.currObjType.shape = parent.currObjType.shape.toLowerCase();
11611
- var prevCropObj = extend({}, parent.cropObj, {}, true);
11612
- var object = { currObj: {} };
11613
- parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11614
- var prevObj = object['currObj'];
11615
- prevObj.objColl = extend([], parent.objColl, [], true);
11616
- prevObj.pointColl = extend([], parent.pointColl, [], true);
11617
- prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11618
- var selPointCollObj = { selPointColl: null };
11619
- parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11620
- value: { obj: selPointCollObj } });
11621
- prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11622
- if (!parent.togglePen && !isCropSelection) {
11623
- if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
11624
- parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
11625
- parent.objColl.push(parent.activeObj);
11626
- if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
11627
- parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11628
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
11629
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
11630
- previousCropObj: prevCropObj, previousText: null,
11631
- currentText: null, previousFilter: null, isCircleCrop: null } });
11540
+ else if (parent.eventType === 'resize') {
11541
+ if (!this.isCropSelection && parent.events && parent.events.onShapeResizeEnd.hasDelegate === true) {
11542
+ this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11543
+ this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
11544
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11545
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then(function (shapeResizingArgs) {
11546
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11547
+ value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
11548
+ });
11549
+ }
11550
+ else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
11551
+ parent.events.onSelectionResizeEnd.hasDelegate === true) {
11552
+ var currentSelectionSettings = { type: parent.activeObj.shape,
11553
+ startX: this.shapeResizingArgs.currentShapeSettings.startX,
11554
+ startY: this.shapeResizingArgs.currentShapeSettings.startY,
11555
+ width: this.shapeResizingArgs.currentShapeSettings.width,
11556
+ height: this.shapeResizingArgs.currentShapeSettings.height };
11557
+ this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
11558
+ this.selectionResizingArgs.action = 'resize-end';
11559
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11560
+ parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then(function (selectionResizingArgs) {
11561
+ parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
11562
+ value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
11563
+ });
11632
11564
  }
11633
- this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
11634
- this.tempObjColl = undefined;
11635
11565
  }
11636
- if (!this.isFhdEditing) {
11637
- this.applyCurrActObj(x, y);
11638
- parent.currObjType.isResize = false;
11639
- if (!isBlazor()) {
11640
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11566
+ else {
11567
+ if (this.shapeMovingArgs && parent.events && parent.events.onShapeDragEnd.hasDelegate === true) {
11568
+ this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11569
+ this.shapeMovingArgs.action = 'drag-end';
11570
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11571
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragEnd', this.shapeMovingArgs, null).then(function (shapeMovingArgs) {
11572
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11573
+ value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
11574
+ });
11641
11575
  }
11642
11576
  }
11577
+ this.shapeResizingArgs = null;
11578
+ this.shapeMovingArgs = null;
11579
+ parent.panEventArgs = null;
11580
+ parent.eventType = null;
11643
11581
  }
11644
- if (parent.activeObj) {
11645
- var isCropSelection_1 = false;
11646
- var splitWords_1;
11647
- if (parent.activeObj.shape !== undefined) {
11648
- splitWords_1 = parent.activeObj.shape.split('-');
11649
- }
11650
- if (splitWords_1 === undefined && (parent.currObjType.isCustomCrop || parent.togglePen)) {
11651
- isCropSelection_1 = true;
11582
+ if (this.currentDrawingShape === 'path') {
11583
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11584
+ var elem = e.srcElement;
11585
+ var elemId = elem.parentElement.id;
11586
+ var id_1 = parent.element.id;
11587
+ if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
11588
+ (elem.classList.contains('e-upload-icon') || elemId === id_1 + '_zoomIn' ||
11589
+ elemId === id_1 + '_zoomOut' || elemId === id_1 + '_annotationBtn' ||
11590
+ elemId === id_1 + '_borderColorBtn' || elemId === id_1 + '_borderWidthBtn' || elemId === id_1 + '_saveBtn')) {
11591
+ parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
11592
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
11593
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
11594
+ points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
11652
11595
  }
11653
- else if (splitWords_1 !== undefined && splitWords_1[0] === 'crop') {
11654
- isCropSelection_1 = true;
11596
+ return;
11597
+ }
11598
+ if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
11599
+ this.pathAdjustedIndex = null;
11600
+ if (this.currentDrawingShape !== '') {
11601
+ if (this.currentDrawingShape === 'text') {
11602
+ var prevCropObj_1 = extend({}, parent.cropObj, {}, true);
11603
+ parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11604
+ value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11605
+ previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11606
+ previousCropObj: prevCropObj_1, previousText: null,
11607
+ currentText: null, previousFilter: null, isCircleCrop: null } });
11608
+ }
11609
+ else {
11610
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11611
+ }
11612
+ this.isShapeInserted = true;
11613
+ this.currentDrawingShape = '';
11614
+ if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
11615
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
11616
+ }
11617
+ var previousShapeSettings = this.updatePrevShapeSettings();
11618
+ var shapeResizingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: previousShapeSettings };
11619
+ var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
11620
+ this.shapeResizingArgs = shapeResizingArgs;
11621
+ this.shapeMovingArgs = shapeMovingArgs;
11622
+ this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
11623
+ }
11624
+ this.adjustActObjForLineArrow();
11625
+ this.updPtCollForShpRot();
11626
+ parent.currObjType.shape = parent.currObjType.shape.toLowerCase();
11627
+ var prevCropObj = extend({}, parent.cropObj, {}, true);
11628
+ var object = { currObj: {} };
11629
+ parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11630
+ var prevObj = object['currObj'];
11631
+ prevObj.objColl = extend([], parent.objColl, [], true);
11632
+ prevObj.pointColl = extend([], parent.pointColl, [], true);
11633
+ prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11634
+ var selPointCollObj = { selPointColl: null };
11635
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11636
+ value: { obj: selPointCollObj } });
11637
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11638
+ if (!parent.togglePen && !isCropSelection) {
11639
+ if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
11640
+ parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
11641
+ parent.objColl.push(parent.activeObj);
11642
+ if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
11643
+ parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11644
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
11645
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
11646
+ previousCropObj: prevCropObj, previousText: null,
11647
+ currentText: null, previousFilter: null, isCircleCrop: null } });
11648
+ }
11649
+ this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
11650
+ this.tempObjColl = undefined;
11651
+ }
11652
+ if (!this.isFhdEditing) {
11653
+ this.applyCurrActObj(x, y);
11654
+ parent.currObjType.isResize = false;
11655
+ if (!isBlazor()) {
11656
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11657
+ }
11658
+ }
11655
11659
  }
11656
- var shape = parent.activeObj.shape;
11657
- if (!isBlazor()) {
11658
- var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
11659
- if (shapeColl.indexOf(shape) > -1) {
11660
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11661
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11660
+ if (parent.activeObj) {
11661
+ var isCropSelection_1 = false;
11662
+ var splitWords_1;
11663
+ if (parent.activeObj.shape !== undefined) {
11664
+ splitWords_1 = parent.activeObj.shape.split('-');
11662
11665
  }
11663
- else if (shape === 'text') {
11664
- if (parent.textArea.style.display === 'none') {
11665
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11666
+ if (splitWords_1 === undefined && (parent.currObjType.isCustomCrop || parent.togglePen)) {
11667
+ isCropSelection_1 = true;
11668
+ }
11669
+ else if (splitWords_1 !== undefined && splitWords_1[0] === 'crop') {
11670
+ isCropSelection_1 = true;
11671
+ }
11672
+ var shape = parent.activeObj.shape;
11673
+ if (!isBlazor()) {
11674
+ var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
11675
+ if (shapeColl.indexOf(shape) > -1) {
11676
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11666
11677
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11667
11678
  }
11679
+ else if (shape === 'text') {
11680
+ if (parent.textArea.style.display === 'none') {
11681
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11682
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11683
+ }
11684
+ }
11685
+ else if (this.isFhdEditing) {
11686
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
11687
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11688
+ }
11689
+ else if (!isCropSelection_1) {
11690
+ var eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
11691
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
11692
+ }
11693
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11668
11694
  }
11669
- else if (this.isFhdEditing) {
11670
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
11671
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11695
+ else {
11696
+ var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image'];
11697
+ if (shapeColl.indexOf(shape) > -1) {
11698
+ parent.updateToolbar(parent.element, parent.activeObj.shape);
11699
+ }
11700
+ else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
11701
+ parent.updateToolbar(parent.element, 'text');
11702
+ }
11672
11703
  }
11673
- else if (!isCropSelection_1) {
11674
- var eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
11675
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
11704
+ }
11705
+ }
11706
+ if (parent.activeObj.shape !== undefined) {
11707
+ splitWords = parent.activeObj.shape.split('-');
11708
+ }
11709
+ if (splitWords !== undefined && splitWords[0] === 'crop') {
11710
+ isCropSelection = true;
11711
+ }
11712
+ if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
11713
+ parent.textArea.style.display === 'none') {
11714
+ if (parent.activeObj.shape === 'text') {
11715
+ if (!isBlazor()) {
11716
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11717
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11676
11718
  }
11677
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11678
11719
  }
11679
11720
  else {
11680
- var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image'];
11681
- if (shapeColl.indexOf(shape) > -1) {
11682
- parent.updateToolbar(parent.element, parent.activeObj.shape);
11683
- }
11684
- else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
11685
- parent.updateToolbar(parent.element, 'text');
11721
+ if (!isBlazor()) {
11722
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11723
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11686
11724
  }
11687
11725
  }
11688
- }
11689
- }
11690
- if (parent.activeObj.shape !== undefined) {
11691
- splitWords = parent.activeObj.shape.split('-');
11692
- }
11693
- if (splitWords !== undefined && splitWords[0] === 'crop') {
11694
- isCropSelection = true;
11695
- }
11696
- if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
11697
- parent.textArea.style.display === 'none') {
11698
- if (parent.activeObj.shape === 'text') {
11699
11726
  if (!isBlazor()) {
11700
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11701
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11727
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11728
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11702
11729
  }
11703
- }
11704
- else {
11705
- if (!isBlazor()) {
11706
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11707
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11730
+ else {
11731
+ parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
11708
11732
  }
11709
11733
  }
11710
- if (!isBlazor()) {
11711
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11712
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11734
+ if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
11735
+ parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
11736
+ value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
11713
11737
  }
11714
11738
  else {
11715
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
11739
+ parent.currObjType.shape = '';
11716
11740
  }
11741
+ this.dragElement = '';
11742
+ this.mouseDown = '';
11743
+ this.isSliderActive = false;
11744
+ parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11745
+ this.selMouseUpEvent();
11717
11746
  }
11718
- if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
11719
- parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
11720
- value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
11721
- }
11722
- else {
11723
- parent.currObjType.shape = '';
11724
- }
11725
- this.dragElement = '';
11726
- parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11727
- this.selMouseUpEvent();
11728
11747
  };
11729
11748
  Selection.prototype.adjustActObjForLineArrow = function (obj) {
11730
11749
  var isAdjusted = false;
@@ -13147,7 +13166,7 @@ var Selection = /** @__PURE__ @class */ (function () {
13147
13166
  fontStyle.push('underline');
13148
13167
  }
13149
13168
  }
13150
- var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, width = _a.width, height = _a.height;
13169
+ var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY, width = _a.width, height = _a.height;
13151
13170
  var _b = parent.activeObj, keyHistory = _b.keyHistory, currIndex = _b.currIndex, shape = _b.shape, textSettings = _b.textSettings, strokeSettings = _b.strokeSettings, rotatedAngle = _b.rotatedAngle, imageElement = _b.imageElement, opacity = _b.opacity;
13152
13171
  var shapeSettingsObj = {
13153
13172
  id: !isNullOrUndefined(currIndex) ? currIndex : null,
@@ -13163,15 +13182,27 @@ var Selection = /** @__PURE__ @class */ (function () {
13163
13182
  fontFamily: shape === 'text' ? (textSettings ? textSettings.fontFamily : null) : null,
13164
13183
  fontStyle: shape === 'text' ? fontStyle : null,
13165
13184
  color: shape === 'text' ? (strokeSettings ? strokeSettings.strokeColor : null) : null,
13166
- degree: shape === 'ellipse' || shape === 'rectangle' || shape === 'image' ? rotatedAngle * (180 / Math.PI) : null,
13185
+ degree: shape === 'ellipse' || shape === 'rectangle' || shape === 'image' || shape === 'text' ? rotatedAngle * (180 / Math.PI) : null,
13167
13186
  imageData: shape === 'image' ? imageElement.src : null,
13168
- opacity: shape === 'image' ? opacity : null
13187
+ opacity: shape === 'image' ? opacity : null,
13188
+ radiusX: shape === 'ellipse' ? width / 2 : null,
13189
+ radiusY: shape === 'ellipse' ? height / 2 : null,
13190
+ endX: shape === 'line' || shape === 'arrow' ? endX : null,
13191
+ endY: shape === 'line' || shape === 'arrow' ? endY : null,
13192
+ arrowHead: shape === 'arrow' ? this.getArrowType(parent.activeObj.start) : null,
13193
+ arrowTail: shape === 'arrow' ? this.getArrowType(parent.activeObj.end) : null,
13194
+ points: shape === 'path' ? parent.activeObj.pointColl : null
13169
13195
  };
13170
13196
  if (obj) {
13171
13197
  obj['shapeSettingsObj'] = shapeSettingsObj;
13172
13198
  }
13173
13199
  return shapeSettingsObj;
13174
13200
  };
13201
+ Selection.prototype.getArrowType = function (type) {
13202
+ var typeToArrowType = { 'none': 'None', 'arrow': 'Arrow', 'arrowSolid': 'SolidArrow',
13203
+ 'circle': 'Circle', 'circleSolid': 'SolidCircle', 'square': 'Square', 'squareSolid': 'SolidSquare', 'bar': 'Bar' };
13204
+ return typeToArrowType["" + type];
13205
+ };
13175
13206
  Selection.prototype.getRectanglePoints = function (rectX, rectY, rectWidth, rectHeight, rectAngle, pointX, pointY) {
13176
13207
  var centerX = rectX + rectWidth / 2;
13177
13208
  var centerY = rectY + rectHeight / 2;
@@ -14096,13 +14127,22 @@ var Shape = /** @__PURE__ @class */ (function () {
14096
14127
  }
14097
14128
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.strokeColor;
14098
14129
  parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
14130
+ parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
14099
14131
  parent.activeObj.opacity = shapeSettings.opacity;
14100
14132
  if (isNullOrUndefined(shapeSettings.degree)) {
14101
14133
  shapeSettings.degree = 0;
14102
14134
  }
14103
14135
  switch (parent.activeObj.shape) {
14104
14136
  case 'ellipse':
14105
- parent.activeObj.activePoint.width = shapeSettings.radius * 2;
14137
+ if (isBlazor()) {
14138
+ parent.activeObj.activePoint.width = shapeSettings.radius;
14139
+ }
14140
+ else {
14141
+ parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
14142
+ parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
14143
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
14144
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14145
+ }
14106
14146
  if (shapeSettings.degree) {
14107
14147
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14108
14148
  }
@@ -14110,18 +14150,35 @@ var Shape = /** @__PURE__ @class */ (function () {
14110
14150
  case 'line':
14111
14151
  case 'arrow':
14112
14152
  parent.activeObj.activePoint.width = shapeSettings.length;
14153
+ if (!isBlazor()) {
14154
+ parent.activeObj.activePoint.endX = shapeSettings.endX;
14155
+ parent.activeObj.activePoint.endY = shapeSettings.endY;
14156
+ parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
14157
+ parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14158
+ if (parent.activeObj.shape === 'arrow') {
14159
+ parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
14160
+ parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
14161
+ }
14162
+ }
14113
14163
  break;
14114
14164
  case 'text':
14115
14165
  parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
14116
14166
  parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
14117
14167
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
14118
14168
  parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
14169
+ if (shapeSettings.degree) {
14170
+ parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14171
+ }
14119
14172
  break;
14120
14173
  case 'rectangle':
14121
14174
  case 'image':
14122
14175
  if (shapeSettings.degree) {
14123
14176
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14124
14177
  }
14178
+ // Prevented setting image src as it cannot be set in canvas
14179
+ break;
14180
+ case 'path':
14181
+ parent.activeObj.pointColl = shapeSettings.points;
14125
14182
  break;
14126
14183
  }
14127
14184
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
@@ -16156,18 +16213,31 @@ var Shape = /** @__PURE__ @class */ (function () {
16156
16213
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16157
16214
  shapeDetails.fillColor = obj.strokeSettings.fillColor;
16158
16215
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16216
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16159
16217
  break;
16160
16218
  case 'ellipse':
16161
16219
  shapeDetails.radius = obj.activePoint.width / 2;
16162
16220
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16163
16221
  shapeDetails.fillColor = obj.strokeSettings.fillColor;
16164
16222
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16223
+ shapeDetails.radiusX = obj.activePoint.width / 2;
16224
+ shapeDetails.radiusY = obj.activePoint.height / 2;
16225
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16165
16226
  break;
16166
16227
  case 'line':
16167
16228
  case 'arrow':
16168
16229
  shapeDetails.length = obj.activePoint.width;
16169
16230
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16170
16231
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16232
+ shapeDetails.endX = obj.activePoint.endX;
16233
+ shapeDetails.endY = obj.activePoint.endY;
16234
+ if (obj.shape === 'arrow') {
16235
+ var arrowObj = { type: null };
16236
+ parent.notify('selection', { prop: 'getArrowType', onPropertyChange: false, value: { type: obj.start, obj: arrowObj } });
16237
+ shapeDetails.arrowHead = arrowObj['type'];
16238
+ parent.notify('selection', { prop: 'getArrowType', onPropertyChange: false, value: { type: obj.end, obj: arrowObj } });
16239
+ shapeDetails.arrowTail = arrowObj['type'];
16240
+ }
16171
16241
  break;
16172
16242
  case 'text':
16173
16243
  shapeDetails.text = obj.keyHistory;
@@ -16181,10 +16251,26 @@ var Shape = /** @__PURE__ @class */ (function () {
16181
16251
  if (obj.textSettings.italic) {
16182
16252
  shapeDetails.fontStyle.push('italic');
16183
16253
  }
16254
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16184
16255
  break;
16185
16256
  case 'path':
16186
16257
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16187
16258
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16259
+ shapeDetails.points = obj.pointColl;
16260
+ break;
16261
+ case 'image':
16262
+ shapeDetails.imageData = obj.imageCanvas.toDataURL();
16263
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16264
+ shapeDetails.width = obj.activePoint.width;
16265
+ shapeDetails.height = obj.activePoint.height;
16266
+ shapeDetails.opacity = obj.opacity;
16267
+ break;
16268
+ case 'image':
16269
+ shapeDetails.imageData = obj.imageCanvas.toDataURL();
16270
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16271
+ shapeDetails.width = obj.activePoint.width;
16272
+ shapeDetails.height = obj.activePoint.height;
16273
+ shapeDetails.opacity = obj.opacity;
16188
16274
  break;
16189
16275
  }
16190
16276
  return shapeDetails;
@@ -19392,6 +19478,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19392
19478
  UndoRedo.prototype.undo = function () {
19393
19479
  var parent = this.parent;
19394
19480
  this.cancelCropSelection();
19481
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19395
19482
  if (!parent.disabled && parent.isImageLoaded) {
19396
19483
  if (this.undoRedoStep > 0) {
19397
19484
  this.refreshToolbarActions();
@@ -19530,6 +19617,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19530
19617
  UndoRedo.prototype.redo = function () {
19531
19618
  var parent = this.parent;
19532
19619
  this.cancelCropSelection();
19620
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19533
19621
  if (!parent.disabled && parent.isImageLoaded) {
19534
19622
  if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
19535
19623
  this.refreshToolbarActions();
@@ -20886,7 +20974,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
20886
20974
  EventHandler.add(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler, this);
20887
20975
  EventHandler.add(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler, this);
20888
20976
  EventHandler.add(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler, this);
20889
- EventHandler.add(document, 'mouseup', this.canvasMouseUpHandler, this);
20890
20977
  EventHandler.add(this.upperCanvas, 'touchstart', this.touchStartHandler, this);
20891
20978
  EventHandler.add(this.lowerCanvas, 'touchstart', this.touchStartHandler, this);
20892
20979
  EventHandler.add(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll, this);
@@ -20913,7 +21000,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
20913
21000
  EventHandler.remove(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler);
20914
21001
  EventHandler.remove(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler);
20915
21002
  EventHandler.remove(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler);
20916
- EventHandler.remove(document, 'mouseup', this.canvasMouseUpHandler);
20917
21003
  EventHandler.remove(this.upperCanvas, 'touchstart', this.touchStartHandler);
20918
21004
  EventHandler.remove(this.lowerCanvas, 'touchstart', this.touchStartHandler);
20919
21005
  EventHandler.remove(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll);
@@ -20926,7 +21012,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
20926
21012
  this.notify('selection', { prop: 'unWireEvent', onPropertyChange: false });
20927
21013
  };
20928
21014
  ImageEditor.prototype.createCanvas = function () {
20929
- var _this = this;
20930
21015
  this.element.style.boxSizing = 'border-box';
20931
21016
  var obj = { toolbarHeight: 0 };
20932
21017
  this.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj } });
@@ -21012,10 +21097,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
21012
21097
  this.upperCanvas.style.cursor = this.cursor = 'default';
21013
21098
  this.upperCanvas.style.display = 'block';
21014
21099
  this.upperContext = this.upperCanvas.getContext('2d');
21015
- document.getElementById(this.element.id + '_dropBrowse').onclick = function () {
21016
- _this.element.querySelector('#' + _this.element.id + '_dropfileUpload').click();
21100
+ dropAnchorElement.addEventListener('click', function (e) {
21101
+ e.preventDefault();
21102
+ dropUploader.click();
21017
21103
  return false;
21018
- };
21104
+ });
21105
+ minDropAnchorElem.addEventListener('click', function (e) {
21106
+ e.preventDefault();
21107
+ dropUploader.click();
21108
+ return false;
21109
+ });
21019
21110
  };
21020
21111
  ImageEditor.prototype.touchStartHandler = function (e) {
21021
21112
  this.notify('selection', { prop: 'touchStartHandler', onPropertyChange: false, value: { e: e } });
@@ -25662,7 +25753,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25662
25753
  var args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25663
25754
  toolbarItems: this.defToolbarItems };
25664
25755
  parent.trigger('toolbarUpdating', args);
25665
- this.defToolbarItems = args.toolbarItems;
25756
+ if (this.isToolbarString(args.toolbarItems)) {
25757
+ items = args.toolbarItems;
25758
+ this.excludeItems(args.toolbarItems);
25759
+ }
25760
+ else {
25761
+ this.defToolbarItems = args.toolbarItems;
25762
+ }
25666
25763
  var toolbar = new Toolbar({
25667
25764
  width: '100%',
25668
25765
  items: this.defToolbarItems,
@@ -25672,8 +25769,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25672
25769
  _this.createShapeColor(items);
25673
25770
  _this.createShapeBtn(items);
25674
25771
  if (parent.activeObj.shape === 'arrow') {
25675
- _this.createStartBtn();
25676
- _this.createEndBtn();
25772
+ if (items.some(function (item) { return item.toLowerCase().indexOf('start') > -1; })) {
25773
+ _this.createStartBtn();
25774
+ }
25775
+ if (items.some(function (item) { return item.toLowerCase().indexOf('end') > -1; })) {
25776
+ _this.createEndBtn();
25777
+ }
25677
25778
  }
25678
25779
  _this.wireZoomBtnEvents();
25679
25780
  if (!Browser.isDevice) {
@@ -25837,24 +25938,24 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25837
25938
  ToolbarModule.prototype.createShapeBtn = function (items) {
25838
25939
  var parent = this.parent;
25839
25940
  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
25941
  if (items.indexOf('strokeWidth') > -1) {
25942
+ var strokeWidthItems = [
25943
+ { id: '1', text: this.l10n.getConstant('XSmall') },
25944
+ { id: '2', text: this.l10n.getConstant('Small') },
25945
+ { id: '3', text: this.l10n.getConstant('Medium') },
25946
+ { id: '4', text: this.l10n.getConstant('Large') },
25947
+ { id: '5', text: this.l10n.getConstant('XLarge') }
25948
+ ];
25949
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25950
+ strokeWidthItems = [
25951
+ { id: '1', text: this.l10n.getConstant('NoOutline') },
25952
+ { id: '2', text: this.l10n.getConstant('XSmall') },
25953
+ { id: '3', text: this.l10n.getConstant('Small') },
25954
+ { id: '4', text: this.l10n.getConstant('Medium') },
25955
+ { id: '5', text: this.l10n.getConstant('Large') },
25956
+ { id: '6', text: this.l10n.getConstant('XLarge') }
25957
+ ];
25958
+ }
25858
25959
  var strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
25859
25960
  var spanElem_1 = document.createElement('span');
25860
25961
  spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
@@ -26071,7 +26172,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26071
26172
  }
26072
26173
  var args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
26073
26174
  parent.trigger('toolbarUpdating', args);
26074
- this.defToolbarItems = args.toolbarItems;
26175
+ if (this.isToolbarString(args.toolbarItems)) {
26176
+ items = args.toolbarItems;
26177
+ this.excludeItems(args.toolbarItems);
26178
+ }
26179
+ else {
26180
+ this.defToolbarItems = args.toolbarItems;
26181
+ }
26075
26182
  var toolbar = new Toolbar({
26076
26183
  width: '100%',
26077
26184
  items: this.defToolbarItems,
@@ -26557,7 +26664,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26557
26664
  template: '<button id="' + id + '_penColorBtn"></button>' });
26558
26665
  }
26559
26666
  if (items.indexOf('strokeWidth') > -1) {
26560
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
26667
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokewidth',
26668
+ cssClass: 'top-icon e-size',
26561
26669
  tooltipText: this.l10n.getConstant('StrokeWidth'),
26562
26670
  align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
26563
26671
  }
@@ -26594,7 +26702,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26594
26702
  }
26595
26703
  var args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26596
26704
  parent.trigger('toolbarUpdating', args);
26597
- this.defToolbarItems = args.toolbarItems;
26705
+ if (this.isToolbarString(args.toolbarItems)) {
26706
+ items = args.toolbarItems;
26707
+ this.excludeItems(args.toolbarItems);
26708
+ }
26709
+ else {
26710
+ this.defToolbarItems = args.toolbarItems;
26711
+ }
26598
26712
  var toolbar = new Toolbar({
26599
26713
  width: '100%',
26600
26714
  items: this.defToolbarItems,
@@ -27736,6 +27850,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27736
27850
  var ctx = void 0;
27737
27851
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
27738
27852
  var type = args.item.id.replace(id + '_', '').toLowerCase();
27853
+ var left = void 0;
27854
+ var right = void 0;
27739
27855
  switch (type) {
27740
27856
  case 'duplicate':
27741
27857
  if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
@@ -27785,8 +27901,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27785
27901
  break;
27786
27902
  case 'rotleft':
27787
27903
  case 'rotright':
27788
- if (!parent.element.querySelector('#' + id + '_rotLeft').classList.contains('e-disabled') ||
27789
- !parent.element.querySelector('#' + id + '_rotRight').classList.contains('e-disabled')) {
27904
+ left = parent.element.querySelector('#' + id + '_rotLeft');
27905
+ right = parent.element.querySelector('#' + id + '_rotRight');
27906
+ if ((left && !left.classList.contains('e-disabled')) ||
27907
+ (right && !right.classList.contains('e-disabled'))) {
27790
27908
  parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
27791
27909
  }
27792
27910
  break;
@@ -28618,6 +28736,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28618
28736
  step: step, width: Browser.isDevice ? '180px' : (type === 'straighten' ? '200px' : '300px'),
28619
28737
  cssClass: 'e-slider',
28620
28738
  change: function (args) {
28739
+ parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: true } });
28621
28740
  if (type === 'transparency') {
28622
28741
  if (parent.activeObj.shape) {
28623
28742
  var prevCropObj = void 0;
@@ -28670,6 +28789,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28670
28789
  parent.notify('selection', { prop: 'setSliding', value: { bool: false } });
28671
28790
  parent.notify('draw', { prop: 'redrawDownScale' });
28672
28791
  }
28792
+ parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
28673
28793
  }
28674
28794
  });
28675
28795
  };
@@ -28916,6 +29036,80 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28916
29036
  parent.activeObj.textFlip = parent.transform.currFlipState;
28917
29037
  parent.activeObj.flipObjColl = [];
28918
29038
  };
29039
+ ToolbarModule.prototype.isToolbarString = function (items) {
29040
+ var isString = false;
29041
+ for (var i = 0; i < items.length; i++) {
29042
+ if (typeof (items[i]) === 'string') {
29043
+ isString = true;
29044
+ break;
29045
+ }
29046
+ }
29047
+ return isString;
29048
+ };
29049
+ ToolbarModule.prototype.excludeItems = function (items) {
29050
+ var indexArr = [];
29051
+ for (var i = 0; i < items.length; i++) {
29052
+ var index = this.getIndex(items[i]);
29053
+ if (index !== -1) {
29054
+ indexArr.push(index);
29055
+ }
29056
+ }
29057
+ var negativeIndexArr = [];
29058
+ for (var i = 0; i < this.defToolbarItems.length; i++) {
29059
+ if (this.defToolbarItems[i].align === 'Center' && !this.isSameIndex(indexArr, i) &&
29060
+ this.defToolbarItems[i].id !== this.parent.element.id + '_' + 'annotation') {
29061
+ negativeIndexArr.push(i);
29062
+ }
29063
+ }
29064
+ for (var i = negativeIndexArr.length - 1; i >= 0; i--) {
29065
+ this.defToolbarItems.splice(negativeIndexArr[i], 1);
29066
+ }
29067
+ };
29068
+ ToolbarModule.prototype.isSameIndex = function (indexArr, index) {
29069
+ for (var i = 0; i < indexArr.length; i++) {
29070
+ if (indexArr[i] === index) {
29071
+ return true;
29072
+ }
29073
+ }
29074
+ return false;
29075
+ };
29076
+ ToolbarModule.prototype.getIndex = function (item) {
29077
+ var index = -1;
29078
+ var isFontColor = false;
29079
+ if (item === 'rotateLeft') {
29080
+ item = 'rotLeft';
29081
+ }
29082
+ if (item === 'rotateRight') {
29083
+ item = 'rotRight';
29084
+ }
29085
+ if (item === 'horizontalFlip') {
29086
+ item = 'hflip';
29087
+ }
29088
+ if (item === 'verticalFlip') {
29089
+ item = 'vflip';
29090
+ }
29091
+ if (item === 'arrowStart') {
29092
+ item = 'start';
29093
+ }
29094
+ if (item === 'arrowEnd') {
29095
+ item = 'end';
29096
+ }
29097
+ if (item === 'fontColor') {
29098
+ item = 'strokeColor';
29099
+ isFontColor = true;
29100
+ }
29101
+ for (var i = 0; i < this.defToolbarItems.length; i++) {
29102
+ var id = this.defToolbarItems[i].id;
29103
+ if (id && id.toLowerCase().indexOf(item.toLowerCase()) !== -1) {
29104
+ index = i;
29105
+ break;
29106
+ }
29107
+ }
29108
+ if (isFontColor) {
29109
+ item = 'fontColor';
29110
+ }
29111
+ return index;
29112
+ };
28919
29113
  ToolbarModule.prototype.getModuleName = function () {
28920
29114
  return 'toolbar-module';
28921
29115
  };