@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.
- package/CHANGELOG.md +24 -2
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +457 -262
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +457 -263
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/image-editor/action/draw.js +2 -1
- package/src/image-editor/action/selection.d.ts +3 -0
- package/src/image-editor/action/selection.js +260 -230
- package/src/image-editor/action/shape.js +56 -1
- package/src/image-editor/action/undo-redo.js +2 -0
- package/src/image-editor/base/image-editor.js +9 -6
- package/src/image-editor/base/interface.d.ts +26 -2
- package/src/image-editor/renderer/toolbar.d.ts +4 -0
- package/src/image-editor/renderer/toolbar.js +128 -25
|
@@ -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
|
}
|
|
@@ -8302,6 +8303,8 @@ class Selection {
|
|
|
8302
8303
|
this.isImageClarity = true;
|
|
8303
8304
|
this.isPinching = false;
|
|
8304
8305
|
this.isSliding = false;
|
|
8306
|
+
this.mouseDown = '';
|
|
8307
|
+
this.isSliderActive = false;
|
|
8305
8308
|
this.parent = parent;
|
|
8306
8309
|
this.addEventListener();
|
|
8307
8310
|
}
|
|
@@ -8544,6 +8547,12 @@ class Selection {
|
|
|
8544
8547
|
case 'setSliding':
|
|
8545
8548
|
this.isSliding = args.value['bool'];
|
|
8546
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;
|
|
8547
8556
|
}
|
|
8548
8557
|
}
|
|
8549
8558
|
getModuleName() {
|
|
@@ -8590,6 +8599,8 @@ class Selection {
|
|
|
8590
8599
|
this.currentDrawingShape = '';
|
|
8591
8600
|
this.initialPrevObj = {};
|
|
8592
8601
|
this.resizedElement = '';
|
|
8602
|
+
this.mouseDown = '';
|
|
8603
|
+
this.isSliderActive = false;
|
|
8593
8604
|
}
|
|
8594
8605
|
performTabAction() {
|
|
8595
8606
|
const parent = this.parent;
|
|
@@ -11005,6 +11016,8 @@ class Selection {
|
|
|
11005
11016
|
}
|
|
11006
11017
|
mouseDownEventHandler(e) {
|
|
11007
11018
|
const parent = this.parent;
|
|
11019
|
+
this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
|
|
11020
|
+
'canvas' : '';
|
|
11008
11021
|
if (e.type === 'touchstart') {
|
|
11009
11022
|
this.isTouch = true;
|
|
11010
11023
|
}
|
|
@@ -11442,267 +11455,273 @@ class Selection {
|
|
|
11442
11455
|
&& !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
|
|
11443
11456
|
return;
|
|
11444
11457
|
}
|
|
11445
|
-
if (
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
}
|
|
11451
|
-
e.preventDefault();
|
|
11452
|
-
if (parent.togglePan) {
|
|
11453
|
-
this.canvasMouseUpHandler(e);
|
|
11454
|
-
}
|
|
11455
|
-
let x;
|
|
11456
|
-
let y;
|
|
11457
|
-
if (e.type === 'mouseup') {
|
|
11458
|
-
x = e.clientX;
|
|
11459
|
-
y = e.clientY;
|
|
11460
|
-
}
|
|
11461
|
-
else {
|
|
11462
|
-
x = this.touchEndPoint.x;
|
|
11463
|
-
y = this.touchEndPoint.y;
|
|
11464
|
-
}
|
|
11465
|
-
const bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
11466
|
-
x -= bbox.left;
|
|
11467
|
-
y -= bbox.top;
|
|
11468
|
-
if (e.type === 'touchend') {
|
|
11469
|
-
this.startTouches = this.tempTouches = [];
|
|
11470
|
-
this.isFirstMove = false;
|
|
11471
|
-
if (parent.textArea.style.display === 'none') {
|
|
11472
|
-
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;
|
|
11473
11463
|
}
|
|
11474
|
-
if (
|
|
11475
|
-
|
|
11476
|
-
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
11477
|
-
if (parent.isCropTab || parent.activeObj.shape) {
|
|
11478
|
-
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
|
|
11479
|
-
parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
|
|
11480
|
-
}
|
|
11481
|
-
if (parent.isStraightening) {
|
|
11482
|
-
parent.notify('draw', { prop: 'resetStraightenDestPoints' });
|
|
11483
|
-
parent.notify('draw', { prop: 'setDestForStraighten' });
|
|
11484
|
-
}
|
|
11485
|
-
return;
|
|
11464
|
+
else if (e.type === 'touchend') {
|
|
11465
|
+
e.stopImmediatePropagation();
|
|
11486
11466
|
}
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
if (parent.activeObj.shape !== undefined) {
|
|
11491
|
-
splitWords = parent.activeObj.shape.split('-');
|
|
11492
|
-
}
|
|
11493
|
-
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
11494
|
-
isCropSelection = true;
|
|
11495
|
-
}
|
|
11496
|
-
if (isBlazor() && parent.eventType) {
|
|
11497
|
-
if (parent.eventType === 'pan') {
|
|
11498
|
-
if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
|
|
11499
|
-
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
|
|
11500
|
-
}
|
|
11467
|
+
e.preventDefault();
|
|
11468
|
+
if (parent.togglePan) {
|
|
11469
|
+
this.canvasMouseUpHandler(e);
|
|
11501
11470
|
}
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then((shapeResizingArgs) => {
|
|
11508
|
-
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
11509
|
-
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
11510
|
-
});
|
|
11511
|
-
}
|
|
11512
|
-
else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
|
|
11513
|
-
parent.events.onSelectionResizeEnd.hasDelegate === true) {
|
|
11514
|
-
const currentSelectionSettings = { type: parent.activeObj.shape,
|
|
11515
|
-
startX: this.shapeResizingArgs.currentShapeSettings.startX,
|
|
11516
|
-
startY: this.shapeResizingArgs.currentShapeSettings.startY,
|
|
11517
|
-
width: this.shapeResizingArgs.currentShapeSettings.width,
|
|
11518
|
-
height: this.shapeResizingArgs.currentShapeSettings.height };
|
|
11519
|
-
this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
|
|
11520
|
-
this.selectionResizingArgs.action = 'resize-end';
|
|
11521
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
11522
|
-
parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then((selectionResizingArgs) => {
|
|
11523
|
-
parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
|
|
11524
|
-
value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
|
|
11525
|
-
});
|
|
11526
|
-
}
|
|
11471
|
+
let x;
|
|
11472
|
+
let y;
|
|
11473
|
+
if (e.type === 'mouseup') {
|
|
11474
|
+
x = e.clientX;
|
|
11475
|
+
y = e.clientY;
|
|
11527
11476
|
}
|
|
11528
11477
|
else {
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
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;
|
|
11537
11502
|
}
|
|
11538
11503
|
}
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
parent.
|
|
11542
|
-
|
|
11543
|
-
}
|
|
11544
|
-
if (this.currentDrawingShape === 'path') {
|
|
11545
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
11546
|
-
const elem = e.srcElement;
|
|
11547
|
-
const elemId = elem.parentElement.id;
|
|
11548
|
-
const id = parent.element.id;
|
|
11549
|
-
if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
|
|
11550
|
-
(elem.classList.contains('e-upload-icon') || elemId === id + '_zoomIn' ||
|
|
11551
|
-
elemId === id + '_zoomOut' || elemId === id + '_annotationBtn' ||
|
|
11552
|
-
elemId === id + '_borderColorBtn' || elemId === id + '_borderWidthBtn' || elemId === id + '_saveBtn')) {
|
|
11553
|
-
parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
|
|
11554
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
11555
|
-
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
11556
|
-
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('-');
|
|
11557
11508
|
}
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
|
|
11567
|
-
previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
|
|
11568
|
-
previousCropObj: prevCropObj, previousText: null,
|
|
11569
|
-
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
|
+
}
|
|
11570
11517
|
}
|
|
11571
|
-
else {
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
11596
|
-
const selPointCollObj = { selPointColl: null };
|
|
11597
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11598
|
-
value: { obj: selPointCollObj } });
|
|
11599
|
-
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11600
|
-
if (!parent.togglePen && !isCropSelection) {
|
|
11601
|
-
if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
|
|
11602
|
-
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
11603
|
-
parent.objColl.push(parent.activeObj);
|
|
11604
|
-
if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
11605
|
-
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
11606
|
-
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
|
|
11607
|
-
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
11608
|
-
previousCropObj: prevCropObj, previousText: null,
|
|
11609
|
-
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
|
+
});
|
|
11610
11542
|
}
|
|
11611
|
-
this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
|
|
11612
|
-
this.tempObjColl = undefined;
|
|
11613
11543
|
}
|
|
11614
|
-
|
|
11615
|
-
this.
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
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
|
+
});
|
|
11619
11553
|
}
|
|
11620
11554
|
}
|
|
11555
|
+
this.shapeResizingArgs = null;
|
|
11556
|
+
this.shapeMovingArgs = null;
|
|
11557
|
+
parent.panEventArgs = null;
|
|
11558
|
+
parent.eventType = null;
|
|
11621
11559
|
}
|
|
11622
|
-
if (
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
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 } });
|
|
11630
11573
|
}
|
|
11631
|
-
|
|
11632
|
-
|
|
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
|
+
}
|
|
11633
11637
|
}
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
if (
|
|
11638
|
-
parent.
|
|
11639
|
-
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('-');
|
|
11640
11643
|
}
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
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',
|
|
11655
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
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',
|
|
11644
11665
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
11645
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 });
|
|
11646
11672
|
}
|
|
11647
|
-
else
|
|
11648
|
-
|
|
11649
|
-
|
|
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
|
+
}
|
|
11650
11681
|
}
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
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 } });
|
|
11654
11696
|
}
|
|
11655
|
-
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
11656
11697
|
}
|
|
11657
11698
|
else {
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
}
|
|
11662
|
-
else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
|
|
11663
|
-
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 } });
|
|
11664
11702
|
}
|
|
11665
11703
|
}
|
|
11666
|
-
}
|
|
11667
|
-
}
|
|
11668
|
-
if (parent.activeObj.shape !== undefined) {
|
|
11669
|
-
splitWords = parent.activeObj.shape.split('-');
|
|
11670
|
-
}
|
|
11671
|
-
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
11672
|
-
isCropSelection = true;
|
|
11673
|
-
}
|
|
11674
|
-
if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
|
|
11675
|
-
parent.textArea.style.display === 'none') {
|
|
11676
|
-
if (parent.activeObj.shape === 'text') {
|
|
11677
11704
|
if (!isBlazor()) {
|
|
11678
|
-
parent.notify('toolbar', { prop: '
|
|
11679
|
-
|
|
11705
|
+
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
11706
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
11680
11707
|
}
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
if (!isBlazor()) {
|
|
11684
|
-
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
|
|
11685
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
11708
|
+
else {
|
|
11709
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
11686
11710
|
}
|
|
11687
11711
|
}
|
|
11688
|
-
if (
|
|
11689
|
-
parent.notify('
|
|
11690
|
-
|
|
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 } });
|
|
11691
11715
|
}
|
|
11692
11716
|
else {
|
|
11693
|
-
parent.
|
|
11717
|
+
parent.currObjType.shape = '';
|
|
11694
11718
|
}
|
|
11719
|
+
this.dragElement = '';
|
|
11720
|
+
this.mouseDown = '';
|
|
11721
|
+
this.isSliderActive = false;
|
|
11722
|
+
parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
|
|
11723
|
+
this.selMouseUpEvent();
|
|
11695
11724
|
}
|
|
11696
|
-
if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
|
|
11697
|
-
parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
|
|
11698
|
-
value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
|
|
11699
|
-
}
|
|
11700
|
-
else {
|
|
11701
|
-
parent.currObjType.shape = '';
|
|
11702
|
-
}
|
|
11703
|
-
this.dragElement = '';
|
|
11704
|
-
parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
|
|
11705
|
-
this.selMouseUpEvent();
|
|
11706
11725
|
}
|
|
11707
11726
|
adjustActObjForLineArrow(obj) {
|
|
11708
11727
|
let isAdjusted = false;
|
|
@@ -13123,7 +13142,7 @@ class Selection {
|
|
|
13123
13142
|
fontStyle.push('underline');
|
|
13124
13143
|
}
|
|
13125
13144
|
}
|
|
13126
|
-
const { startX, startY, width, height } = parent.activeObj.activePoint;
|
|
13145
|
+
const { startX, startY, endX, endY, width, height } = parent.activeObj.activePoint;
|
|
13127
13146
|
const { keyHistory, currIndex, shape, textSettings, strokeSettings, rotatedAngle, imageElement, opacity } = parent.activeObj;
|
|
13128
13147
|
const shapeSettingsObj = {
|
|
13129
13148
|
id: !isNullOrUndefined(currIndex) ? currIndex : null,
|
|
@@ -13139,15 +13158,27 @@ class Selection {
|
|
|
13139
13158
|
fontFamily: shape === 'text' ? (textSettings ? textSettings.fontFamily : null) : null,
|
|
13140
13159
|
fontStyle: shape === 'text' ? fontStyle : null,
|
|
13141
13160
|
color: shape === 'text' ? (strokeSettings ? strokeSettings.strokeColor : null) : null,
|
|
13142
|
-
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,
|
|
13143
13162
|
imageData: shape === 'image' ? imageElement.src : null,
|
|
13144
|
-
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
|
|
13145
13171
|
};
|
|
13146
13172
|
if (obj) {
|
|
13147
13173
|
obj['shapeSettingsObj'] = shapeSettingsObj;
|
|
13148
13174
|
}
|
|
13149
13175
|
return shapeSettingsObj;
|
|
13150
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
|
+
}
|
|
13151
13182
|
getRectanglePoints(rectX, rectY, rectWidth, rectHeight, rectAngle, pointX, pointY) {
|
|
13152
13183
|
const centerX = rectX + rectWidth / 2;
|
|
13153
13184
|
const centerY = rectY + rectHeight / 2;
|
|
@@ -14069,13 +14100,22 @@ class Shape {
|
|
|
14069
14100
|
}
|
|
14070
14101
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.strokeColor;
|
|
14071
14102
|
parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
|
|
14103
|
+
parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
|
|
14072
14104
|
parent.activeObj.opacity = shapeSettings.opacity;
|
|
14073
14105
|
if (isNullOrUndefined(shapeSettings.degree)) {
|
|
14074
14106
|
shapeSettings.degree = 0;
|
|
14075
14107
|
}
|
|
14076
14108
|
switch (parent.activeObj.shape) {
|
|
14077
14109
|
case 'ellipse':
|
|
14078
|
-
|
|
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
|
+
}
|
|
14079
14119
|
if (shapeSettings.degree) {
|
|
14080
14120
|
parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
|
|
14081
14121
|
}
|
|
@@ -14083,18 +14123,35 @@ class Shape {
|
|
|
14083
14123
|
case 'line':
|
|
14084
14124
|
case 'arrow':
|
|
14085
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
|
+
}
|
|
14086
14136
|
break;
|
|
14087
14137
|
case 'text':
|
|
14088
14138
|
parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
|
|
14089
14139
|
parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
|
|
14090
14140
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
|
|
14091
14141
|
parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
|
|
14142
|
+
if (shapeSettings.degree) {
|
|
14143
|
+
parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
|
|
14144
|
+
}
|
|
14092
14145
|
break;
|
|
14093
14146
|
case 'rectangle':
|
|
14094
14147
|
case 'image':
|
|
14095
14148
|
if (shapeSettings.degree) {
|
|
14096
14149
|
parent.activeObj.rotatedAngle = shapeSettings.degree * (Math.PI / 180);
|
|
14097
14150
|
}
|
|
14151
|
+
// Prevented setting image src as it cannot be set in canvas
|
|
14152
|
+
break;
|
|
14153
|
+
case 'path':
|
|
14154
|
+
parent.activeObj.pointColl = shapeSettings.points;
|
|
14098
14155
|
break;
|
|
14099
14156
|
}
|
|
14100
14157
|
if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
|
|
@@ -16126,18 +16183,31 @@ class Shape {
|
|
|
16126
16183
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
16127
16184
|
shapeDetails.fillColor = obj.strokeSettings.fillColor;
|
|
16128
16185
|
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
16186
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
16129
16187
|
break;
|
|
16130
16188
|
case 'ellipse':
|
|
16131
16189
|
shapeDetails.radius = obj.activePoint.width / 2;
|
|
16132
16190
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
16133
16191
|
shapeDetails.fillColor = obj.strokeSettings.fillColor;
|
|
16134
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);
|
|
16135
16196
|
break;
|
|
16136
16197
|
case 'line':
|
|
16137
16198
|
case 'arrow':
|
|
16138
16199
|
shapeDetails.length = obj.activePoint.width;
|
|
16139
16200
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
16140
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
|
+
}
|
|
16141
16211
|
break;
|
|
16142
16212
|
case 'text':
|
|
16143
16213
|
shapeDetails.text = obj.keyHistory;
|
|
@@ -16151,10 +16221,26 @@ class Shape {
|
|
|
16151
16221
|
if (obj.textSettings.italic) {
|
|
16152
16222
|
shapeDetails.fontStyle.push('italic');
|
|
16153
16223
|
}
|
|
16224
|
+
shapeDetails.degree = obj.rotatedAngle * (180 / Math.PI);
|
|
16154
16225
|
break;
|
|
16155
16226
|
case 'path':
|
|
16156
16227
|
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
16157
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;
|
|
16158
16244
|
break;
|
|
16159
16245
|
}
|
|
16160
16246
|
return shapeDetails;
|
|
@@ -19354,6 +19440,7 @@ class UndoRedo {
|
|
|
19354
19440
|
undo() {
|
|
19355
19441
|
const parent = this.parent;
|
|
19356
19442
|
this.cancelCropSelection();
|
|
19443
|
+
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
|
|
19357
19444
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
19358
19445
|
if (this.undoRedoStep > 0) {
|
|
19359
19446
|
this.refreshToolbarActions();
|
|
@@ -19492,6 +19579,7 @@ class UndoRedo {
|
|
|
19492
19579
|
redo() {
|
|
19493
19580
|
const parent = this.parent;
|
|
19494
19581
|
this.cancelCropSelection();
|
|
19582
|
+
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
|
|
19495
19583
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
19496
19584
|
if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
|
|
19497
19585
|
this.refreshToolbarActions();
|
|
@@ -20810,7 +20898,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
20810
20898
|
EventHandler.add(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler, this);
|
|
20811
20899
|
EventHandler.add(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler, this);
|
|
20812
20900
|
EventHandler.add(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler, this);
|
|
20813
|
-
EventHandler.add(document, 'mouseup', this.canvasMouseUpHandler, this);
|
|
20814
20901
|
EventHandler.add(this.upperCanvas, 'touchstart', this.touchStartHandler, this);
|
|
20815
20902
|
EventHandler.add(this.lowerCanvas, 'touchstart', this.touchStartHandler, this);
|
|
20816
20903
|
EventHandler.add(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll, this);
|
|
@@ -20837,7 +20924,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
20837
20924
|
EventHandler.remove(this.lowerCanvas, 'mousedown', this.canvasMouseDownHandler);
|
|
20838
20925
|
EventHandler.remove(this.lowerCanvas, 'mousemove', this.canvasMouseMoveHandler);
|
|
20839
20926
|
EventHandler.remove(this.lowerCanvas, 'mouseup', this.canvasMouseUpHandler);
|
|
20840
|
-
EventHandler.remove(document, 'mouseup', this.canvasMouseUpHandler);
|
|
20841
20927
|
EventHandler.remove(this.upperCanvas, 'touchstart', this.touchStartHandler);
|
|
20842
20928
|
EventHandler.remove(this.lowerCanvas, 'touchstart', this.touchStartHandler);
|
|
20843
20929
|
EventHandler.remove(this.lowerCanvas, 'mousewheel DOMMouseScroll', this.handleScroll);
|
|
@@ -20935,10 +21021,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
20935
21021
|
this.upperCanvas.style.cursor = this.cursor = 'default';
|
|
20936
21022
|
this.upperCanvas.style.display = 'block';
|
|
20937
21023
|
this.upperContext = this.upperCanvas.getContext('2d');
|
|
20938
|
-
|
|
20939
|
-
|
|
21024
|
+
dropAnchorElement.addEventListener('click', function (e) {
|
|
21025
|
+
e.preventDefault();
|
|
21026
|
+
dropUploader.click();
|
|
20940
21027
|
return false;
|
|
20941
|
-
};
|
|
21028
|
+
});
|
|
21029
|
+
minDropAnchorElem.addEventListener('click', function (e) {
|
|
21030
|
+
e.preventDefault();
|
|
21031
|
+
dropUploader.click();
|
|
21032
|
+
return false;
|
|
21033
|
+
});
|
|
20942
21034
|
}
|
|
20943
21035
|
touchStartHandler(e) {
|
|
20944
21036
|
this.notify('selection', { prop: 'touchStartHandler', onPropertyChange: false, value: { e: e } });
|
|
@@ -25574,7 +25666,13 @@ class ToolbarModule {
|
|
|
25574
25666
|
const args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
|
|
25575
25667
|
toolbarItems: this.defToolbarItems };
|
|
25576
25668
|
parent.trigger('toolbarUpdating', args);
|
|
25577
|
-
this.
|
|
25669
|
+
if (this.isToolbarString(args.toolbarItems)) {
|
|
25670
|
+
items = args.toolbarItems;
|
|
25671
|
+
this.excludeItems(args.toolbarItems);
|
|
25672
|
+
}
|
|
25673
|
+
else {
|
|
25674
|
+
this.defToolbarItems = args.toolbarItems;
|
|
25675
|
+
}
|
|
25578
25676
|
const toolbar = new Toolbar({
|
|
25579
25677
|
width: '100%',
|
|
25580
25678
|
items: this.defToolbarItems,
|
|
@@ -25584,8 +25682,12 @@ class ToolbarModule {
|
|
|
25584
25682
|
this.createShapeColor(items);
|
|
25585
25683
|
this.createShapeBtn(items);
|
|
25586
25684
|
if (parent.activeObj.shape === 'arrow') {
|
|
25587
|
-
|
|
25588
|
-
|
|
25685
|
+
if (items.some(item => item.toLowerCase().indexOf('start') > -1)) {
|
|
25686
|
+
this.createStartBtn();
|
|
25687
|
+
}
|
|
25688
|
+
if (items.some(item => item.toLowerCase().indexOf('end') > -1)) {
|
|
25689
|
+
this.createEndBtn();
|
|
25690
|
+
}
|
|
25589
25691
|
}
|
|
25590
25692
|
this.wireZoomBtnEvents();
|
|
25591
25693
|
if (!Browser.isDevice) {
|
|
@@ -25748,24 +25850,24 @@ class ToolbarModule {
|
|
|
25748
25850
|
createShapeBtn(items) {
|
|
25749
25851
|
const parent = this.parent;
|
|
25750
25852
|
const id = parent.element.id;
|
|
25751
|
-
let strokeWidthItems = [
|
|
25752
|
-
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
25753
|
-
{ id: '2', text: this.l10n.getConstant('Small') },
|
|
25754
|
-
{ id: '3', text: this.l10n.getConstant('Medium') },
|
|
25755
|
-
{ id: '4', text: this.l10n.getConstant('Large') },
|
|
25756
|
-
{ id: '5', text: this.l10n.getConstant('XLarge') }
|
|
25757
|
-
];
|
|
25758
|
-
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
|
|
25759
|
-
strokeWidthItems = [
|
|
25760
|
-
{ id: '1', text: this.l10n.getConstant('NoOutline') },
|
|
25761
|
-
{ id: '2', text: this.l10n.getConstant('XSmall') },
|
|
25762
|
-
{ id: '3', text: this.l10n.getConstant('Small') },
|
|
25763
|
-
{ id: '4', text: this.l10n.getConstant('Medium') },
|
|
25764
|
-
{ id: '5', text: this.l10n.getConstant('Large') },
|
|
25765
|
-
{ id: '6', text: this.l10n.getConstant('XLarge') }
|
|
25766
|
-
];
|
|
25767
|
-
}
|
|
25768
25853
|
if (items.indexOf('strokeWidth') > -1) {
|
|
25854
|
+
let strokeWidthItems = [
|
|
25855
|
+
{ id: '1', text: this.l10n.getConstant('XSmall') },
|
|
25856
|
+
{ id: '2', text: this.l10n.getConstant('Small') },
|
|
25857
|
+
{ id: '3', text: this.l10n.getConstant('Medium') },
|
|
25858
|
+
{ id: '4', text: this.l10n.getConstant('Large') },
|
|
25859
|
+
{ id: '5', text: this.l10n.getConstant('XLarge') }
|
|
25860
|
+
];
|
|
25861
|
+
if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
|
|
25862
|
+
strokeWidthItems = [
|
|
25863
|
+
{ id: '1', text: this.l10n.getConstant('NoOutline') },
|
|
25864
|
+
{ id: '2', text: this.l10n.getConstant('XSmall') },
|
|
25865
|
+
{ id: '3', text: this.l10n.getConstant('Small') },
|
|
25866
|
+
{ id: '4', text: this.l10n.getConstant('Medium') },
|
|
25867
|
+
{ id: '5', text: this.l10n.getConstant('Large') },
|
|
25868
|
+
{ id: '6', text: this.l10n.getConstant('XLarge') }
|
|
25869
|
+
];
|
|
25870
|
+
}
|
|
25769
25871
|
const strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
|
|
25770
25872
|
const spanElem = document.createElement('span');
|
|
25771
25873
|
spanElem.innerHTML = this.l10n.getConstant('XSmall');
|
|
@@ -25981,7 +26083,13 @@ class ToolbarModule {
|
|
|
25981
26083
|
}
|
|
25982
26084
|
const args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
|
|
25983
26085
|
parent.trigger('toolbarUpdating', args);
|
|
25984
|
-
this.
|
|
26086
|
+
if (this.isToolbarString(args.toolbarItems)) {
|
|
26087
|
+
items = args.toolbarItems;
|
|
26088
|
+
this.excludeItems(args.toolbarItems);
|
|
26089
|
+
}
|
|
26090
|
+
else {
|
|
26091
|
+
this.defToolbarItems = args.toolbarItems;
|
|
26092
|
+
}
|
|
25985
26093
|
const toolbar = new Toolbar({
|
|
25986
26094
|
width: '100%',
|
|
25987
26095
|
items: this.defToolbarItems,
|
|
@@ -26466,7 +26574,8 @@ class ToolbarModule {
|
|
|
26466
26574
|
template: '<button id="' + id + '_penColorBtn"></button>' });
|
|
26467
26575
|
}
|
|
26468
26576
|
if (items.indexOf('strokeWidth') > -1) {
|
|
26469
|
-
toolbarItems.push({ prefixIcon: 'e-icons e-copy',
|
|
26577
|
+
toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokewidth',
|
|
26578
|
+
cssClass: 'top-icon e-size',
|
|
26470
26579
|
tooltipText: this.l10n.getConstant('StrokeWidth'),
|
|
26471
26580
|
align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
|
|
26472
26581
|
}
|
|
@@ -26502,7 +26611,13 @@ class ToolbarModule {
|
|
|
26502
26611
|
}
|
|
26503
26612
|
const args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
|
|
26504
26613
|
parent.trigger('toolbarUpdating', args);
|
|
26505
|
-
this.
|
|
26614
|
+
if (this.isToolbarString(args.toolbarItems)) {
|
|
26615
|
+
items = args.toolbarItems;
|
|
26616
|
+
this.excludeItems(args.toolbarItems);
|
|
26617
|
+
}
|
|
26618
|
+
else {
|
|
26619
|
+
this.defToolbarItems = args.toolbarItems;
|
|
26620
|
+
}
|
|
26506
26621
|
const toolbar = new Toolbar({
|
|
26507
26622
|
width: '100%',
|
|
26508
26623
|
items: this.defToolbarItems,
|
|
@@ -27640,6 +27755,8 @@ class ToolbarModule {
|
|
|
27640
27755
|
let ctx;
|
|
27641
27756
|
parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
|
|
27642
27757
|
const type = args.item.id.replace(id + '_', '').toLowerCase();
|
|
27758
|
+
let left;
|
|
27759
|
+
let right;
|
|
27643
27760
|
switch (type) {
|
|
27644
27761
|
case 'duplicate':
|
|
27645
27762
|
if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
|
|
@@ -27689,8 +27806,10 @@ class ToolbarModule {
|
|
|
27689
27806
|
break;
|
|
27690
27807
|
case 'rotleft':
|
|
27691
27808
|
case 'rotright':
|
|
27692
|
-
|
|
27693
|
-
|
|
27809
|
+
left = parent.element.querySelector('#' + id + '_rotLeft');
|
|
27810
|
+
right = parent.element.querySelector('#' + id + '_rotRight');
|
|
27811
|
+
if ((left && !left.classList.contains('e-disabled')) ||
|
|
27812
|
+
(right && !right.classList.contains('e-disabled'))) {
|
|
27694
27813
|
parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
|
|
27695
27814
|
}
|
|
27696
27815
|
break;
|
|
@@ -28521,6 +28640,7 @@ class ToolbarModule {
|
|
|
28521
28640
|
step: step, width: Browser.isDevice ? '180px' : (type === 'straighten' ? '200px' : '300px'),
|
|
28522
28641
|
cssClass: 'e-slider',
|
|
28523
28642
|
change: (args) => {
|
|
28643
|
+
parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: true } });
|
|
28524
28644
|
if (type === 'transparency') {
|
|
28525
28645
|
if (parent.activeObj.shape) {
|
|
28526
28646
|
let prevCropObj;
|
|
@@ -28573,6 +28693,7 @@ class ToolbarModule {
|
|
|
28573
28693
|
parent.notify('selection', { prop: 'setSliding', value: { bool: false } });
|
|
28574
28694
|
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
28575
28695
|
}
|
|
28696
|
+
parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
|
|
28576
28697
|
}
|
|
28577
28698
|
});
|
|
28578
28699
|
}
|
|
@@ -28817,6 +28938,80 @@ class ToolbarModule {
|
|
|
28817
28938
|
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
28818
28939
|
parent.activeObj.flipObjColl = [];
|
|
28819
28940
|
}
|
|
28941
|
+
isToolbarString(items) {
|
|
28942
|
+
let isString = false;
|
|
28943
|
+
for (let i = 0; i < items.length; i++) {
|
|
28944
|
+
if (typeof (items[i]) === 'string') {
|
|
28945
|
+
isString = true;
|
|
28946
|
+
break;
|
|
28947
|
+
}
|
|
28948
|
+
}
|
|
28949
|
+
return isString;
|
|
28950
|
+
}
|
|
28951
|
+
excludeItems(items) {
|
|
28952
|
+
const indexArr = [];
|
|
28953
|
+
for (let i = 0; i < items.length; i++) {
|
|
28954
|
+
const index = this.getIndex(items[i]);
|
|
28955
|
+
if (index !== -1) {
|
|
28956
|
+
indexArr.push(index);
|
|
28957
|
+
}
|
|
28958
|
+
}
|
|
28959
|
+
const negativeIndexArr = [];
|
|
28960
|
+
for (let i = 0; i < this.defToolbarItems.length; i++) {
|
|
28961
|
+
if (this.defToolbarItems[i].align === 'Center' && !this.isSameIndex(indexArr, i) &&
|
|
28962
|
+
this.defToolbarItems[i].id !== this.parent.element.id + '_' + 'annotation') {
|
|
28963
|
+
negativeIndexArr.push(i);
|
|
28964
|
+
}
|
|
28965
|
+
}
|
|
28966
|
+
for (let i = negativeIndexArr.length - 1; i >= 0; i--) {
|
|
28967
|
+
this.defToolbarItems.splice(negativeIndexArr[i], 1);
|
|
28968
|
+
}
|
|
28969
|
+
}
|
|
28970
|
+
isSameIndex(indexArr, index) {
|
|
28971
|
+
for (let i = 0; i < indexArr.length; i++) {
|
|
28972
|
+
if (indexArr[i] === index) {
|
|
28973
|
+
return true;
|
|
28974
|
+
}
|
|
28975
|
+
}
|
|
28976
|
+
return false;
|
|
28977
|
+
}
|
|
28978
|
+
getIndex(item) {
|
|
28979
|
+
let index = -1;
|
|
28980
|
+
let isFontColor = false;
|
|
28981
|
+
if (item === 'rotateLeft') {
|
|
28982
|
+
item = 'rotLeft';
|
|
28983
|
+
}
|
|
28984
|
+
if (item === 'rotateRight') {
|
|
28985
|
+
item = 'rotRight';
|
|
28986
|
+
}
|
|
28987
|
+
if (item === 'horizontalFlip') {
|
|
28988
|
+
item = 'hflip';
|
|
28989
|
+
}
|
|
28990
|
+
if (item === 'verticalFlip') {
|
|
28991
|
+
item = 'vflip';
|
|
28992
|
+
}
|
|
28993
|
+
if (item === 'arrowStart') {
|
|
28994
|
+
item = 'start';
|
|
28995
|
+
}
|
|
28996
|
+
if (item === 'arrowEnd') {
|
|
28997
|
+
item = 'end';
|
|
28998
|
+
}
|
|
28999
|
+
if (item === 'fontColor') {
|
|
29000
|
+
item = 'strokeColor';
|
|
29001
|
+
isFontColor = true;
|
|
29002
|
+
}
|
|
29003
|
+
for (let i = 0; i < this.defToolbarItems.length; i++) {
|
|
29004
|
+
const id = this.defToolbarItems[i].id;
|
|
29005
|
+
if (id && id.toLowerCase().indexOf(item.toLowerCase()) !== -1) {
|
|
29006
|
+
index = i;
|
|
29007
|
+
break;
|
|
29008
|
+
}
|
|
29009
|
+
}
|
|
29010
|
+
if (isFontColor) {
|
|
29011
|
+
item = 'fontColor';
|
|
29012
|
+
}
|
|
29013
|
+
return index;
|
|
29014
|
+
}
|
|
28820
29015
|
getModuleName() {
|
|
28821
29016
|
return 'toolbar-module';
|
|
28822
29017
|
}
|