@syncfusion/ej2-image-editor 24.2.4 → 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.
@@ -4756,7 +4756,8 @@ class Draw {
4756
4756
  if (!isBlazor()) {
4757
4757
  parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
4758
4758
  if (obj['defToolbarItems'].length === 0 &&
4759
- (isNullOrUndefined(document.getElementById(id + '_toolbar')))) {
4759
+ (isNullOrUndefined(document.getElementById(id + '_toolbar'))) &&
4760
+ parent.element.querySelector('#' + id + '_toolbarArea')) {
4760
4761
  const height = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
4761
4762
  parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
4762
4763
  }
@@ -8303,6 +8304,7 @@ class Selection {
8303
8304
  this.isPinching = false;
8304
8305
  this.isSliding = false;
8305
8306
  this.mouseDown = '';
8307
+ this.isSliderActive = false;
8306
8308
  this.parent = parent;
8307
8309
  this.addEventListener();
8308
8310
  }
@@ -8545,6 +8547,12 @@ class Selection {
8545
8547
  case 'setSliding':
8546
8548
  this.isSliding = args.value['bool'];
8547
8549
  break;
8550
+ case 'setSliderActive':
8551
+ this.isSliderActive = args.value['bool'];
8552
+ break;
8553
+ case 'getArrowType':
8554
+ args.value['obj']['type'] = this.getArrowType(args.value['type']);
8555
+ break;
8548
8556
  }
8549
8557
  }
8550
8558
  getModuleName() {
@@ -8592,6 +8600,7 @@ class Selection {
8592
8600
  this.initialPrevObj = {};
8593
8601
  this.resizedElement = '';
8594
8602
  this.mouseDown = '';
8603
+ this.isSliderActive = false;
8595
8604
  }
8596
8605
  performTabAction() {
8597
8606
  const parent = this.parent;
@@ -11446,272 +11455,273 @@ class Selection {
11446
11455
  && !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
11447
11456
  return;
11448
11457
  }
11449
- else if (e.currentTarget === document && this.mouseDown === '') {
11450
- e.stopImmediatePropagation();
11451
- return;
11452
- }
11453
- if (e.type === 'touchstart') {
11454
- this.isTouch = false;
11455
- }
11456
- else if (e.type === 'touchend') {
11457
- e.stopImmediatePropagation();
11458
- }
11459
- e.preventDefault();
11460
- if (parent.togglePan) {
11461
- this.canvasMouseUpHandler(e);
11462
- }
11463
- let x;
11464
- let y;
11465
- if (e.type === 'mouseup') {
11466
- x = e.clientX;
11467
- y = e.clientY;
11468
- }
11469
- else {
11470
- x = this.touchEndPoint.x;
11471
- y = this.touchEndPoint.y;
11472
- }
11473
- const bbox = parent.lowerCanvas.getBoundingClientRect();
11474
- x -= bbox.left;
11475
- y -= bbox.top;
11476
- if (e.type === 'touchend') {
11477
- this.startTouches = this.tempTouches = [];
11478
- this.isFirstMove = false;
11479
- if (parent.textArea.style.display === 'none') {
11480
- this.timer = 0;
11458
+ if (this.mouseDown === 'canvas' || this.isSliderActive ||
11459
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11460
+ e.target.closest('.e-image-editor') || e.target.closest('.e-ie-ddb-popup')) {
11461
+ if (e.type === 'touchstart') {
11462
+ this.isTouch = false;
11481
11463
  }
11482
- if (this.isPinching) {
11483
- this.isPinching = false;
11484
- parent.notify('draw', { prop: 'redrawDownScale' });
11485
- if (parent.isCropTab || parent.activeObj.shape) {
11486
- parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
11487
- parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
11488
- }
11489
- if (parent.isStraightening) {
11490
- parent.notify('draw', { prop: 'resetStraightenDestPoints' });
11491
- parent.notify('draw', { prop: 'setDestForStraighten' });
11492
- }
11493
- return;
11464
+ else if (e.type === 'touchend') {
11465
+ e.stopImmediatePropagation();
11494
11466
  }
11495
- }
11496
- let isCropSelection = false;
11497
- let splitWords;
11498
- if (parent.activeObj.shape !== undefined) {
11499
- splitWords = parent.activeObj.shape.split('-');
11500
- }
11501
- if (splitWords !== undefined && splitWords[0] === 'crop') {
11502
- isCropSelection = true;
11503
- }
11504
- if (isBlazor() && parent.eventType) {
11505
- if (parent.eventType === 'pan') {
11506
- if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
11507
- parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
11508
- }
11467
+ e.preventDefault();
11468
+ if (parent.togglePan) {
11469
+ this.canvasMouseUpHandler(e);
11509
11470
  }
11510
- else if (parent.eventType === 'resize') {
11511
- if (!this.isCropSelection && parent.events && parent.events.onShapeResizeEnd.hasDelegate === true) {
11512
- this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11513
- this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
11514
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11515
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then((shapeResizingArgs) => {
11516
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11517
- value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
11518
- });
11519
- }
11520
- else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
11521
- parent.events.onSelectionResizeEnd.hasDelegate === true) {
11522
- const currentSelectionSettings = { type: parent.activeObj.shape,
11523
- startX: this.shapeResizingArgs.currentShapeSettings.startX,
11524
- startY: this.shapeResizingArgs.currentShapeSettings.startY,
11525
- width: this.shapeResizingArgs.currentShapeSettings.width,
11526
- height: this.shapeResizingArgs.currentShapeSettings.height };
11527
- this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
11528
- this.selectionResizingArgs.action = 'resize-end';
11529
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11530
- parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then((selectionResizingArgs) => {
11531
- parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
11532
- value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
11533
- });
11534
- }
11471
+ let x;
11472
+ let y;
11473
+ if (e.type === 'mouseup') {
11474
+ x = e.clientX;
11475
+ y = e.clientY;
11535
11476
  }
11536
11477
  else {
11537
- if (this.shapeMovingArgs && parent.events && parent.events.onShapeDragEnd.hasDelegate === true) {
11538
- this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11539
- this.shapeMovingArgs.action = 'drag-end';
11540
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11541
- parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragEnd', this.shapeMovingArgs, null).then((shapeMovingArgs) => {
11542
- parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11543
- value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
11544
- });
11478
+ x = this.touchEndPoint.x;
11479
+ y = this.touchEndPoint.y;
11480
+ }
11481
+ const bbox = parent.lowerCanvas.getBoundingClientRect();
11482
+ x -= bbox.left;
11483
+ y -= bbox.top;
11484
+ if (e.type === 'touchend') {
11485
+ this.startTouches = this.tempTouches = [];
11486
+ this.isFirstMove = false;
11487
+ if (parent.textArea.style.display === 'none') {
11488
+ this.timer = 0;
11489
+ }
11490
+ if (this.isPinching) {
11491
+ this.isPinching = false;
11492
+ parent.notify('draw', { prop: 'redrawDownScale' });
11493
+ if (parent.isCropTab || parent.activeObj.shape) {
11494
+ parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
11495
+ parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
11496
+ }
11497
+ if (parent.isStraightening) {
11498
+ parent.notify('draw', { prop: 'resetStraightenDestPoints' });
11499
+ parent.notify('draw', { prop: 'setDestForStraighten' });
11500
+ }
11501
+ return;
11545
11502
  }
11546
11503
  }
11547
- this.shapeResizingArgs = null;
11548
- this.shapeMovingArgs = null;
11549
- parent.panEventArgs = null;
11550
- parent.eventType = null;
11551
- }
11552
- if (this.currentDrawingShape === 'path') {
11553
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11554
- const elem = e.srcElement;
11555
- const elemId = elem.parentElement.id;
11556
- const id = parent.element.id;
11557
- if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
11558
- (elem.classList.contains('e-upload-icon') || elemId === id + '_zoomIn' ||
11559
- elemId === id + '_zoomOut' || elemId === id + '_annotationBtn' ||
11560
- elemId === id + '_borderColorBtn' || elemId === id + '_borderWidthBtn' || elemId === id + '_saveBtn')) {
11561
- parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
11562
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
11563
- parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
11564
- points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
11504
+ let isCropSelection = false;
11505
+ let splitWords;
11506
+ if (parent.activeObj.shape !== undefined) {
11507
+ splitWords = parent.activeObj.shape.split('-');
11565
11508
  }
11566
- return;
11567
- }
11568
- if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
11569
- this.pathAdjustedIndex = null;
11570
- if (this.currentDrawingShape !== '') {
11571
- if (this.currentDrawingShape === 'text') {
11572
- const prevCropObj = extend({}, parent.cropObj, {}, true);
11573
- parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11574
- value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11575
- previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11576
- previousCropObj: prevCropObj, previousText: null,
11577
- currentText: null, previousFilter: null, isCircleCrop: null } });
11509
+ if (splitWords !== undefined && splitWords[0] === 'crop') {
11510
+ isCropSelection = true;
11511
+ }
11512
+ if (isBlazor() && parent.eventType) {
11513
+ if (parent.eventType === 'pan') {
11514
+ if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
11515
+ parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
11516
+ }
11578
11517
  }
11579
- else {
11580
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11581
- }
11582
- this.isShapeInserted = true;
11583
- this.currentDrawingShape = '';
11584
- if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
11585
- parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
11586
- }
11587
- const previousShapeSettings = this.updatePrevShapeSettings();
11588
- const shapeResizingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: previousShapeSettings };
11589
- const shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
11590
- this.shapeResizingArgs = shapeResizingArgs;
11591
- this.shapeMovingArgs = shapeMovingArgs;
11592
- this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
11593
- }
11594
- this.adjustActObjForLineArrow();
11595
- this.updPtCollForShpRot();
11596
- parent.currObjType.shape = parent.currObjType.shape.toLowerCase();
11597
- const prevCropObj = extend({}, parent.cropObj, {}, true);
11598
- const object = { currObj: {} };
11599
- parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11600
- const prevObj = object['currObj'];
11601
- prevObj.objColl = extend([], parent.objColl, [], true);
11602
- prevObj.pointColl = extend([], parent.pointColl, [], true);
11603
- prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11604
- const selPointCollObj = { selPointColl: null };
11605
- parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11606
- value: { obj: selPointCollObj } });
11607
- prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11608
- if (!parent.togglePen && !isCropSelection) {
11609
- if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
11610
- parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
11611
- parent.objColl.push(parent.activeObj);
11612
- if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
11613
- parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11614
- value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
11615
- previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
11616
- previousCropObj: prevCropObj, previousText: null,
11617
- currentText: null, previousFilter: null, isCircleCrop: null } });
11518
+ else if (parent.eventType === 'resize') {
11519
+ if (!this.isCropSelection && parent.events && parent.events.onShapeResizeEnd.hasDelegate === true) {
11520
+ this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11521
+ this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
11522
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11523
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then((shapeResizingArgs) => {
11524
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11525
+ value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
11526
+ });
11527
+ }
11528
+ else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
11529
+ parent.events.onSelectionResizeEnd.hasDelegate === true) {
11530
+ const currentSelectionSettings = { type: parent.activeObj.shape,
11531
+ startX: this.shapeResizingArgs.currentShapeSettings.startX,
11532
+ startY: this.shapeResizingArgs.currentShapeSettings.startY,
11533
+ width: this.shapeResizingArgs.currentShapeSettings.width,
11534
+ height: this.shapeResizingArgs.currentShapeSettings.height };
11535
+ this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
11536
+ this.selectionResizingArgs.action = 'resize-end';
11537
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11538
+ parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then((selectionResizingArgs) => {
11539
+ parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
11540
+ value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
11541
+ });
11618
11542
  }
11619
- this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
11620
- this.tempObjColl = undefined;
11621
11543
  }
11622
- if (!this.isFhdEditing) {
11623
- this.applyCurrActObj(x, y);
11624
- parent.currObjType.isResize = false;
11625
- if (!isBlazor()) {
11626
- parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11544
+ else {
11545
+ if (this.shapeMovingArgs && parent.events && parent.events.onShapeDragEnd.hasDelegate === true) {
11546
+ this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
11547
+ this.shapeMovingArgs.action = 'drag-end';
11548
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11549
+ parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragEnd', this.shapeMovingArgs, null).then((shapeMovingArgs) => {
11550
+ parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
11551
+ value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
11552
+ });
11627
11553
  }
11628
11554
  }
11555
+ this.shapeResizingArgs = null;
11556
+ this.shapeMovingArgs = null;
11557
+ parent.panEventArgs = null;
11558
+ parent.eventType = null;
11629
11559
  }
11630
- if (parent.activeObj) {
11631
- let isCropSelection = false;
11632
- let splitWords;
11633
- if (parent.activeObj.shape !== undefined) {
11634
- splitWords = parent.activeObj.shape.split('-');
11635
- }
11636
- if (splitWords === undefined && (parent.currObjType.isCustomCrop || parent.togglePen)) {
11637
- isCropSelection = true;
11560
+ if (this.currentDrawingShape === 'path') {
11561
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
11562
+ const elem = e.srcElement;
11563
+ const elemId = elem.parentElement.id;
11564
+ const id = parent.element.id;
11565
+ if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
11566
+ (elem.classList.contains('e-upload-icon') || elemId === id + '_zoomIn' ||
11567
+ elemId === id + '_zoomOut' || elemId === id + '_annotationBtn' ||
11568
+ elemId === id + '_borderColorBtn' || elemId === id + '_borderWidthBtn' || elemId === id + '_saveBtn')) {
11569
+ parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
11570
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
11571
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
11572
+ points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
11638
11573
  }
11639
- else if (splitWords !== undefined && splitWords[0] === 'crop') {
11640
- isCropSelection = true;
11574
+ return;
11575
+ }
11576
+ if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
11577
+ this.pathAdjustedIndex = null;
11578
+ if (this.currentDrawingShape !== '') {
11579
+ if (this.currentDrawingShape === 'text') {
11580
+ const prevCropObj = extend({}, parent.cropObj, {}, true);
11581
+ parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11582
+ value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11583
+ previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11584
+ previousCropObj: prevCropObj, previousText: null,
11585
+ currentText: null, previousFilter: null, isCircleCrop: null } });
11586
+ }
11587
+ else {
11588
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11589
+ }
11590
+ this.isShapeInserted = true;
11591
+ this.currentDrawingShape = '';
11592
+ if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
11593
+ parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
11594
+ }
11595
+ const previousShapeSettings = this.updatePrevShapeSettings();
11596
+ const shapeResizingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: previousShapeSettings };
11597
+ const shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
11598
+ this.shapeResizingArgs = shapeResizingArgs;
11599
+ this.shapeMovingArgs = shapeMovingArgs;
11600
+ this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
11601
+ }
11602
+ this.adjustActObjForLineArrow();
11603
+ this.updPtCollForShpRot();
11604
+ parent.currObjType.shape = parent.currObjType.shape.toLowerCase();
11605
+ const prevCropObj = extend({}, parent.cropObj, {}, true);
11606
+ const object = { currObj: {} };
11607
+ parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
11608
+ const prevObj = object['currObj'];
11609
+ prevObj.objColl = extend([], parent.objColl, [], true);
11610
+ prevObj.pointColl = extend([], parent.pointColl, [], true);
11611
+ prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
11612
+ const selPointCollObj = { selPointColl: null };
11613
+ parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
11614
+ value: { obj: selPointCollObj } });
11615
+ prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
11616
+ if (!parent.togglePen && !isCropSelection) {
11617
+ if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
11618
+ parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
11619
+ parent.objColl.push(parent.activeObj);
11620
+ if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
11621
+ parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11622
+ value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
11623
+ previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
11624
+ previousCropObj: prevCropObj, previousText: null,
11625
+ currentText: null, previousFilter: null, isCircleCrop: null } });
11626
+ }
11627
+ this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
11628
+ this.tempObjColl = undefined;
11629
+ }
11630
+ if (!this.isFhdEditing) {
11631
+ this.applyCurrActObj(x, y);
11632
+ parent.currObjType.isResize = false;
11633
+ if (!isBlazor()) {
11634
+ parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
11635
+ }
11636
+ }
11641
11637
  }
11642
- const shape = parent.activeObj.shape;
11643
- if (!isBlazor()) {
11644
- const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
11645
- if (shapeColl.indexOf(shape) > -1) {
11646
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11647
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11638
+ if (parent.activeObj) {
11639
+ let isCropSelection = false;
11640
+ let splitWords;
11641
+ if (parent.activeObj.shape !== undefined) {
11642
+ splitWords = parent.activeObj.shape.split('-');
11648
11643
  }
11649
- else if (shape === 'text') {
11650
- if (parent.textArea.style.display === 'none') {
11651
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11644
+ if (splitWords === undefined && (parent.currObjType.isCustomCrop || parent.togglePen)) {
11645
+ isCropSelection = true;
11646
+ }
11647
+ else if (splitWords !== undefined && splitWords[0] === 'crop') {
11648
+ isCropSelection = true;
11649
+ }
11650
+ const shape = parent.activeObj.shape;
11651
+ if (!isBlazor()) {
11652
+ const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
11653
+ if (shapeColl.indexOf(shape) > -1) {
11654
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11652
11655
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11653
11656
  }
11657
+ else if (shape === 'text') {
11658
+ if (parent.textArea.style.display === 'none') {
11659
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11660
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11661
+ }
11662
+ }
11663
+ else if (this.isFhdEditing) {
11664
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
11665
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11666
+ }
11667
+ else if (!isCropSelection) {
11668
+ const eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
11669
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
11670
+ }
11671
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11654
11672
  }
11655
- else if (this.isFhdEditing) {
11656
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
11657
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11673
+ else {
11674
+ const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image'];
11675
+ if (shapeColl.indexOf(shape) > -1) {
11676
+ parent.updateToolbar(parent.element, parent.activeObj.shape);
11677
+ }
11678
+ else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
11679
+ parent.updateToolbar(parent.element, 'text');
11680
+ }
11658
11681
  }
11659
- else if (!isCropSelection) {
11660
- const eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
11661
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
11682
+ }
11683
+ }
11684
+ if (parent.activeObj.shape !== undefined) {
11685
+ splitWords = parent.activeObj.shape.split('-');
11686
+ }
11687
+ if (splitWords !== undefined && splitWords[0] === 'crop') {
11688
+ isCropSelection = true;
11689
+ }
11690
+ if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
11691
+ parent.textArea.style.display === 'none') {
11692
+ if (parent.activeObj.shape === 'text') {
11693
+ if (!isBlazor()) {
11694
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11695
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11662
11696
  }
11663
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11664
11697
  }
11665
11698
  else {
11666
- const shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image'];
11667
- if (shapeColl.indexOf(shape) > -1) {
11668
- parent.updateToolbar(parent.element, parent.activeObj.shape);
11669
- }
11670
- else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
11671
- parent.updateToolbar(parent.element, 'text');
11699
+ if (!isBlazor()) {
11700
+ parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11701
+ isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11672
11702
  }
11673
11703
  }
11674
- }
11675
- }
11676
- if (parent.activeObj.shape !== undefined) {
11677
- splitWords = parent.activeObj.shape.split('-');
11678
- }
11679
- if (splitWords !== undefined && splitWords[0] === 'crop') {
11680
- isCropSelection = true;
11681
- }
11682
- if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
11683
- parent.textArea.style.display === 'none') {
11684
- if (parent.activeObj.shape === 'text') {
11685
11704
  if (!isBlazor()) {
11686
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
11687
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11705
+ parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11706
+ parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11688
11707
  }
11689
- }
11690
- else {
11691
- if (!isBlazor()) {
11692
- parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11693
- isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11708
+ else {
11709
+ parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
11694
11710
  }
11695
11711
  }
11696
- if (!isBlazor()) {
11697
- parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11698
- parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
11712
+ if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
11713
+ parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
11714
+ value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
11699
11715
  }
11700
11716
  else {
11701
- parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
11717
+ parent.currObjType.shape = '';
11702
11718
  }
11719
+ this.dragElement = '';
11720
+ this.mouseDown = '';
11721
+ this.isSliderActive = false;
11722
+ parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11723
+ this.selMouseUpEvent();
11703
11724
  }
11704
- if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
11705
- parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
11706
- value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
11707
- }
11708
- else {
11709
- parent.currObjType.shape = '';
11710
- }
11711
- this.dragElement = '';
11712
- this.mouseDown = '';
11713
- parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11714
- this.selMouseUpEvent();
11715
11725
  }
11716
11726
  adjustActObjForLineArrow(obj) {
11717
11727
  let isAdjusted = false;
@@ -13132,7 +13142,7 @@ class Selection {
13132
13142
  fontStyle.push('underline');
13133
13143
  }
13134
13144
  }
13135
- const { startX, startY, width, height } = parent.activeObj.activePoint;
13145
+ const { startX, startY, endX, endY, width, height } = parent.activeObj.activePoint;
13136
13146
  const { keyHistory, currIndex, shape, textSettings, strokeSettings, rotatedAngle, imageElement, opacity } = parent.activeObj;
13137
13147
  const shapeSettingsObj = {
13138
13148
  id: !isNullOrUndefined(currIndex) ? currIndex : null,
@@ -13148,15 +13158,27 @@ class Selection {
13148
13158
  fontFamily: shape === 'text' ? (textSettings ? textSettings.fontFamily : null) : null,
13149
13159
  fontStyle: shape === 'text' ? fontStyle : null,
13150
13160
  color: shape === 'text' ? (strokeSettings ? strokeSettings.strokeColor : null) : null,
13151
- degree: shape === 'ellipse' || shape === 'rectangle' || shape === 'image' ? rotatedAngle * (180 / Math.PI) : null,
13161
+ degree: shape === 'ellipse' || shape === 'rectangle' || shape === 'image' || shape === 'text' ? rotatedAngle * (180 / Math.PI) : null,
13152
13162
  imageData: shape === 'image' ? imageElement.src : null,
13153
- opacity: shape === 'image' ? opacity : null
13163
+ opacity: shape === 'image' ? opacity : null,
13164
+ radiusX: shape === 'ellipse' ? width / 2 : null,
13165
+ radiusY: shape === 'ellipse' ? height / 2 : null,
13166
+ endX: shape === 'line' || shape === 'arrow' ? endX : null,
13167
+ endY: shape === 'line' || shape === 'arrow' ? endY : null,
13168
+ arrowHead: shape === 'arrow' ? this.getArrowType(parent.activeObj.start) : null,
13169
+ arrowTail: shape === 'arrow' ? this.getArrowType(parent.activeObj.end) : null,
13170
+ points: shape === 'path' ? parent.activeObj.pointColl : null
13154
13171
  };
13155
13172
  if (obj) {
13156
13173
  obj['shapeSettingsObj'] = shapeSettingsObj;
13157
13174
  }
13158
13175
  return shapeSettingsObj;
13159
13176
  }
13177
+ getArrowType(type) {
13178
+ const typeToArrowType = { 'none': 'None', 'arrow': 'Arrow', 'arrowSolid': 'SolidArrow',
13179
+ 'circle': 'Circle', 'circleSolid': 'SolidCircle', 'square': 'Square', 'squareSolid': 'SolidSquare', 'bar': 'Bar' };
13180
+ return typeToArrowType[`${type}`];
13181
+ }
13160
13182
  getRectanglePoints(rectX, rectY, rectWidth, rectHeight, rectAngle, pointX, pointY) {
13161
13183
  const centerX = rectX + rectWidth / 2;
13162
13184
  const centerY = rectY + rectHeight / 2;
@@ -14078,13 +14100,22 @@ class Shape {
14078
14100
  }
14079
14101
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.strokeColor;
14080
14102
  parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
14103
+ parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
14081
14104
  parent.activeObj.opacity = shapeSettings.opacity;
14082
14105
  if (isNullOrUndefined(shapeSettings.degree)) {
14083
14106
  shapeSettings.degree = 0;
14084
14107
  }
14085
14108
  switch (parent.activeObj.shape) {
14086
14109
  case 'ellipse':
14087
- parent.activeObj.activePoint.width = shapeSettings.radius * 2;
14110
+ if (isBlazor()) {
14111
+ parent.activeObj.activePoint.width = shapeSettings.radius;
14112
+ }
14113
+ else {
14114
+ parent.activeObj.activePoint.width = shapeSettings.radiusX * 2;
14115
+ parent.activeObj.activePoint.height = shapeSettings.radiusY * 2;
14116
+ parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
14117
+ parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14118
+ }
14088
14119
  if (shapeSettings.degree) {
14089
14120
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14090
14121
  }
@@ -14092,18 +14123,35 @@ class Shape {
14092
14123
  case 'line':
14093
14124
  case 'arrow':
14094
14125
  parent.activeObj.activePoint.width = shapeSettings.length;
14126
+ if (!isBlazor()) {
14127
+ parent.activeObj.activePoint.endX = shapeSettings.endX;
14128
+ parent.activeObj.activePoint.endY = shapeSettings.endY;
14129
+ parent.activeObj.activePoint.width = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
14130
+ parent.activeObj.activePoint.height = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
14131
+ if (parent.activeObj.shape === 'arrow') {
14132
+ parent.activeObj.start = this.getArrowType(shapeSettings.arrowHead);
14133
+ parent.activeObj.end = this.getArrowType(shapeSettings.arrowTail);
14134
+ }
14135
+ }
14095
14136
  break;
14096
14137
  case 'text':
14097
14138
  parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
14098
14139
  parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
14099
14140
  parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
14100
14141
  parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
14142
+ if (shapeSettings.degree) {
14143
+ parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14144
+ }
14101
14145
  break;
14102
14146
  case 'rectangle':
14103
14147
  case 'image':
14104
14148
  if (shapeSettings.degree) {
14105
14149
  parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
14106
14150
  }
14151
+ // Prevented setting image src as it cannot be set in canvas
14152
+ break;
14153
+ case 'path':
14154
+ parent.activeObj.pointColl = shapeSettings.points;
14107
14155
  break;
14108
14156
  }
14109
14157
  if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
@@ -16135,18 +16183,31 @@ class Shape {
16135
16183
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16136
16184
  shapeDetails.fillColor = obj.strokeSettings.fillColor;
16137
16185
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16186
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16138
16187
  break;
16139
16188
  case 'ellipse':
16140
16189
  shapeDetails.radius = obj.activePoint.width / 2;
16141
16190
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16142
16191
  shapeDetails.fillColor = obj.strokeSettings.fillColor;
16143
16192
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16193
+ shapeDetails.radiusX = obj.activePoint.width / 2;
16194
+ shapeDetails.radiusY = obj.activePoint.height / 2;
16195
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16144
16196
  break;
16145
16197
  case 'line':
16146
16198
  case 'arrow':
16147
16199
  shapeDetails.length = obj.activePoint.width;
16148
16200
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16149
16201
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16202
+ shapeDetails.endX = obj.activePoint.endX;
16203
+ shapeDetails.endY = obj.activePoint.endY;
16204
+ if (obj.shape === 'arrow') {
16205
+ const arrowObj = { type: null };
16206
+ parent.notify('selection', { prop: 'getArrowType', onPropertyChange: false, value: { type: obj.start, obj: arrowObj } });
16207
+ shapeDetails.arrowHead = arrowObj['type'];
16208
+ parent.notify('selection', { prop: 'getArrowType', onPropertyChange: false, value: { type: obj.end, obj: arrowObj } });
16209
+ shapeDetails.arrowTail = arrowObj['type'];
16210
+ }
16150
16211
  break;
16151
16212
  case 'text':
16152
16213
  shapeDetails.text = obj.keyHistory;
@@ -16160,10 +16221,26 @@ class Shape {
16160
16221
  if (obj.textSettings.italic) {
16161
16222
  shapeDetails.fontStyle.push('italic');
16162
16223
  }
16224
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16163
16225
  break;
16164
16226
  case 'path':
16165
16227
  shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
16166
16228
  shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
16229
+ shapeDetails.points = obj.pointColl;
16230
+ break;
16231
+ case 'image':
16232
+ shapeDetails.imageData = obj.imageCanvas.toDataURL();
16233
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16234
+ shapeDetails.width = obj.activePoint.width;
16235
+ shapeDetails.height = obj.activePoint.height;
16236
+ shapeDetails.opacity = obj.opacity;
16237
+ break;
16238
+ case 'image':
16239
+ shapeDetails.imageData = obj.imageCanvas.toDataURL();
16240
+ shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
16241
+ shapeDetails.width = obj.activePoint.width;
16242
+ shapeDetails.height = obj.activePoint.height;
16243
+ shapeDetails.opacity = obj.opacity;
16167
16244
  break;
16168
16245
  }
16169
16246
  return shapeDetails;
@@ -20821,7 +20898,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20821
20898
  EventHandler.add(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler, this);
20822
20899
  EventHandler.add(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler, this);
20823
20900
  EventHandler.add(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler, this);
20824
- EventHandler.add(document, 'mouseup', this.canvasMouseUpHandler, this);
20825
20901
  EventHandler.add(this.upperCanvas, 'touchstart', this.touchStartHandler, this);
20826
20902
  EventHandler.add(this.lowerCanvas, 'touchstart', this.touchStartHandler, this);
20827
20903
  EventHandler.add(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll, this);
@@ -20848,7 +20924,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20848
20924
  EventHandler.remove(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler);
20849
20925
  EventHandler.remove(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler);
20850
20926
  EventHandler.remove(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler);
20851
- EventHandler.remove(document, 'mouseup', this.canvasMouseUpHandler);
20852
20927
  EventHandler.remove(this.upperCanvas, 'touchstart', this.touchStartHandler);
20853
20928
  EventHandler.remove(this.lowerCanvas, 'touchstart', this.touchStartHandler);
20854
20929
  EventHandler.remove(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll);
@@ -20946,10 +21021,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20946
21021
  this.upperCanvas.style.cursor = this.cursor = 'default';
20947
21022
  this.upperCanvas.style.display = 'block';
20948
21023
  this.upperContext = this.upperCanvas.getContext('2d');
20949
- document.getElementById(this.element.id + '_dropBrowse').onclick = () => {
20950
- this.element.querySelector('#' + this.element.id + '_dropfileUpload').click();
21024
+ dropAnchorElement.addEventListener('click', function (e) {
21025
+ e.preventDefault();
21026
+ dropUploader.click();
20951
21027
  return false;
20952
- };
21028
+ });
21029
+ minDropAnchorElem.addEventListener('click', function (e) {
21030
+ e.preventDefault();
21031
+ dropUploader.click();
21032
+ return false;
21033
+ });
20953
21034
  }
20954
21035
  touchStartHandler(e) {
20955
21036
  this.notify('selection', { prop: 'touchStartHandler', onPropertyChange: false, value: { e: e } });
@@ -28559,6 +28640,7 @@ class ToolbarModule {
28559
28640
  step: step, width: Browser.isDevice ? '180px' : (type === 'straighten' ? '200px' : '300px'),
28560
28641
  cssClass: 'e-slider',
28561
28642
  change: (args) => {
28643
+ parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: true } });
28562
28644
  if (type === 'transparency') {
28563
28645
  if (parent.activeObj.shape) {
28564
28646
  let prevCropObj;
@@ -28611,6 +28693,7 @@ class ToolbarModule {
28611
28693
  parent.notify('selection', { prop: 'setSliding', value: { bool: false } });
28612
28694
  parent.notify('draw', { prop: 'redrawDownScale' });
28613
28695
  }
28696
+ parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
28614
28697
  }
28615
28698
  });
28616
28699
  }