@syncfusion/ej2-image-editor 25.2.4 → 26.1.35
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/.eslintrc.json +3 -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 +2679 -830
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +2762 -873
- 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 +13 -12
- package/src/image-editor/action/crop.d.ts +0 -1
- package/src/image-editor/action/crop.js +35 -77
- package/src/image-editor/action/draw.d.ts +3 -0
- package/src/image-editor/action/draw.js +190 -81
- package/src/image-editor/action/export.d.ts +3 -0
- package/src/image-editor/action/export.js +99 -41
- package/src/image-editor/action/filter.d.ts +0 -1
- package/src/image-editor/action/filter.js +4 -24
- package/src/image-editor/action/freehand-draw.js +30 -8
- package/src/image-editor/action/selection.d.ts +10 -0
- package/src/image-editor/action/selection.js +444 -99
- package/src/image-editor/action/shape.d.ts +11 -1
- package/src/image-editor/action/shape.js +520 -127
- package/src/image-editor/action/transform.d.ts +0 -1
- package/src/image-editor/action/transform.js +53 -69
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +114 -29
- package/src/image-editor/base/enum.d.ts +5 -1
- package/src/image-editor/base/enum.js +4 -0
- package/src/image-editor/base/image-editor-model.d.ts +8 -6
- package/src/image-editor/base/image-editor.d.ts +116 -7
- package/src/image-editor/base/image-editor.js +378 -52
- package/src/image-editor/base/interface.d.ts +17 -0
- package/src/image-editor/base/interface.js +0 -1
- package/src/image-editor/renderer/toolbar.d.ts +14 -1
- package/src/image-editor/renderer/toolbar.js +831 -191
- package/styles/bootstrap-dark.css +279 -97
- package/styles/bootstrap-dark.scss +13 -1
- package/styles/bootstrap.css +282 -98
- package/styles/bootstrap.scss +13 -1
- package/styles/bootstrap4.css +280 -97
- package/styles/bootstrap4.scss +13 -1
- package/styles/bootstrap5-dark.css +280 -101
- package/styles/bootstrap5-dark.scss +13 -1
- package/styles/bootstrap5.css +280 -101
- package/styles/bootstrap5.scss +13 -1
- package/styles/fabric-dark.css +281 -97
- package/styles/fabric-dark.scss +13 -1
- package/styles/fabric.css +284 -97
- package/styles/fabric.scss +13 -1
- package/styles/fluent-dark.css +287 -101
- package/styles/fluent-dark.scss +13 -1
- package/styles/fluent.css +287 -101
- package/styles/fluent.scss +13 -1
- package/styles/fluent2.css +1851 -0
- package/styles/fluent2.scss +13 -0
- package/styles/highcontrast-light.css +279 -97
- package/styles/highcontrast-light.scss +13 -1
- package/styles/highcontrast.css +284 -97
- package/styles/highcontrast.scss +13 -1
- package/styles/image-editor/_bds-definition.scss +5 -0
- package/styles/image-editor/_bootstrap-dark-definition.scss +5 -0
- package/styles/image-editor/_bootstrap-definition.scss +5 -0
- package/styles/image-editor/_bootstrap4-definition.scss +5 -0
- package/styles/image-editor/_bootstrap5-definition.scss +5 -0
- package/styles/image-editor/_bootstrap5.3-definition.scss +26 -0
- package/styles/image-editor/_fabric-dark-definition.scss +5 -0
- package/styles/image-editor/_fabric-definition.scss +5 -0
- package/styles/image-editor/_fluent-definition.scss +5 -0
- package/styles/image-editor/_fluent2-definition.scss +26 -0
- package/styles/image-editor/_fusionnew-definition.scss +5 -0
- package/styles/image-editor/_highcontrast-definition.scss +5 -0
- package/styles/image-editor/_highcontrast-light-definition.scss +5 -0
- package/styles/image-editor/_layout.scss +352 -13
- package/styles/image-editor/_material-dark-definition.scss +5 -0
- package/styles/image-editor/_material-definition.scss +5 -0
- package/styles/image-editor/_material3-definition.scss +5 -0
- package/styles/image-editor/_tailwind-definition.scss +5 -0
- package/styles/image-editor/bootstrap-dark.css +279 -97
- package/styles/image-editor/bootstrap.css +282 -98
- package/styles/image-editor/bootstrap4.css +280 -97
- package/styles/image-editor/bootstrap5-dark.css +280 -101
- package/styles/image-editor/bootstrap5.css +280 -101
- package/styles/image-editor/fabric-dark.css +281 -97
- package/styles/image-editor/fabric.css +284 -97
- package/styles/image-editor/fluent-dark.css +287 -101
- package/styles/image-editor/fluent.css +287 -101
- package/styles/image-editor/fluent2.css +1851 -0
- package/styles/image-editor/fluent2.scss +13 -0
- package/styles/image-editor/highcontrast-light.css +279 -97
- package/styles/image-editor/highcontrast.css +284 -97
- package/styles/image-editor/icons/_bds.scss +1 -162
- package/styles/image-editor/icons/_bootstrap-dark.scss +1 -162
- package/styles/image-editor/icons/_bootstrap.scss +1 -162
- package/styles/image-editor/icons/_bootstrap4.scss +1 -162
- package/styles/image-editor/icons/_bootstrap5.3.scss +250 -0
- package/styles/image-editor/icons/_bootstrap5.scss +1 -168
- package/styles/image-editor/icons/_fabric-dark.scss +1 -162
- package/styles/image-editor/icons/_fabric.scss +1 -162
- package/styles/image-editor/icons/_fluent.scss +1 -168
- package/styles/image-editor/icons/_fluent2.scss +256 -0
- package/styles/image-editor/icons/_fusionnew.scss +1 -138
- package/styles/image-editor/icons/_highcontrast-light.scss +1 -162
- package/styles/image-editor/icons/_highcontrast.scss +1 -162
- package/styles/image-editor/icons/_material-dark.scss +2 -163
- package/styles/image-editor/icons/_material.scss +1 -162
- package/styles/image-editor/icons/_material3.scss +2 -169
- package/styles/image-editor/icons/_tailwind.scss +1 -162
- package/styles/image-editor/material-dark.css +299 -100
- package/styles/image-editor/material.css +302 -100
- package/styles/image-editor/material3-dark.css +314 -103
- package/styles/image-editor/material3.css +314 -103
- package/styles/image-editor/tailwind-dark.css +284 -97
- package/styles/image-editor/tailwind.css +284 -97
- package/styles/material-dark.css +299 -100
- package/styles/material-dark.scss +13 -1
- package/styles/material.css +302 -100
- package/styles/material.scss +13 -1
- package/styles/material3-dark.css +314 -103
- package/styles/material3-dark.scss +13 -1
- package/styles/material3.css +314 -103
- package/styles/material3.scss +13 -1
- package/styles/tailwind-dark.css +284 -97
- package/styles/tailwind-dark.scss +13 -1
- package/styles/tailwind.css +284 -97
- package/styles/tailwind.scss +13 -1
- package/CHANGELOG.md +0 -289
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-constant-condition */
|
|
1
2
|
import { EventHandler, extend, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
3
|
import { ShapeType } from '../index';
|
|
3
4
|
var Shape = /** @class */ (function () {
|
|
@@ -5,6 +6,7 @@ var Shape = /** @class */ (function () {
|
|
|
5
6
|
this.textSettings = { text: 'Enter Text', fontFamily: '', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
6
7
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
7
8
|
this.keyHistory = ''; // text history
|
|
9
|
+
this.preventFrameAnnotation = false;
|
|
8
10
|
this.parent = parent;
|
|
9
11
|
this.addEventListener();
|
|
10
12
|
}
|
|
@@ -43,7 +45,7 @@ var Shape = /** @class */ (function () {
|
|
|
43
45
|
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor'], args.value['degree'], args.value['isSelected']);
|
|
44
46
|
break;
|
|
45
47
|
case 'drawText':
|
|
46
|
-
this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected']);
|
|
48
|
+
this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color'], args.value['isSelected'], args.value['degree']);
|
|
47
49
|
break;
|
|
48
50
|
case 'redrawActObj':
|
|
49
51
|
this.redrawActObj(args.value['x'], args.value['y'], args.value['isMouseDown']);
|
|
@@ -63,18 +65,9 @@ var Shape = /** @class */ (function () {
|
|
|
63
65
|
case 'updImgRatioForActObj':
|
|
64
66
|
this.updImgRatioForActObj();
|
|
65
67
|
break;
|
|
66
|
-
case 'zoomObjColl':
|
|
67
|
-
this.zoomObjColl(args.value['isPreventApply']);
|
|
68
|
-
break;
|
|
69
68
|
case 'redrawObj':
|
|
70
69
|
this.redrawObj(args.value['degree']);
|
|
71
70
|
break;
|
|
72
|
-
case 'rotateObjColl':
|
|
73
|
-
this.rotateObjColl();
|
|
74
|
-
break;
|
|
75
|
-
case 'draw-shape-text':
|
|
76
|
-
this.drawShapeText();
|
|
77
|
-
break;
|
|
78
71
|
case 'redraw-text':
|
|
79
72
|
this.redrawText();
|
|
80
73
|
break;
|
|
@@ -90,9 +83,6 @@ var Shape = /** @class */ (function () {
|
|
|
90
83
|
case 'findTextTarget':
|
|
91
84
|
this.findTextTarget(args.value['e']);
|
|
92
85
|
break;
|
|
93
|
-
case 'panObjColl':
|
|
94
|
-
this.panObjColl(args.value['xDiff'], args.value['yDiff'], args.value['panRegion']);
|
|
95
|
-
break;
|
|
96
86
|
case 'updateFontStyles':
|
|
97
87
|
this.updateFontStyles(args.value['isTextBox']);
|
|
98
88
|
break;
|
|
@@ -105,9 +95,6 @@ var Shape = /** @class */ (function () {
|
|
|
105
95
|
case 'updateFontSize':
|
|
106
96
|
this.updateFontSize(args.value['obj']);
|
|
107
97
|
break;
|
|
108
|
-
case 'updateObjColl':
|
|
109
|
-
this.updateObjColl(args.value['item'], args.value['objColl']);
|
|
110
|
-
break;
|
|
111
98
|
case 'pushActItemIntoObj':
|
|
112
99
|
this.pushActItemIntoObj();
|
|
113
100
|
break;
|
|
@@ -132,7 +119,9 @@ var Shape = /** @class */ (function () {
|
|
|
132
119
|
EventHandler.remove(parent.upperCanvas, 'dblclick', this.findTextTarget);
|
|
133
120
|
EventHandler.remove(parent.textArea, 'mousedown', this.findTextTarget);
|
|
134
121
|
uploader = document.getElementById(parent.element.id + '_fileUpload');
|
|
135
|
-
|
|
122
|
+
if (uploader) {
|
|
123
|
+
EventHandler.remove(uploader, 'change', this.fileChanged);
|
|
124
|
+
}
|
|
136
125
|
break;
|
|
137
126
|
case 'getShapeSetting':
|
|
138
127
|
this.getShapeSetting(args.value['id'], args.value['obj']);
|
|
@@ -222,9 +211,6 @@ var Shape = /** @class */ (function () {
|
|
|
222
211
|
case 'reset':
|
|
223
212
|
this.reset();
|
|
224
213
|
break;
|
|
225
|
-
case 'fileChanged':
|
|
226
|
-
this.fileChanged(args.value['e']);
|
|
227
|
-
break;
|
|
228
214
|
case 'updateObj':
|
|
229
215
|
this.updateObj(args.value['dimObj'], args.value['x'], args.value['y']);
|
|
230
216
|
break;
|
|
@@ -243,15 +229,36 @@ var Shape = /** @class */ (function () {
|
|
|
243
229
|
case 'getTextBoxPosition':
|
|
244
230
|
this.getTextBoxPosition(args.value['obj'], args.value['object']);
|
|
245
231
|
break;
|
|
246
|
-
case 'updateSelectionChangeEventArgs':
|
|
247
|
-
this.updateSelectionChangeEventArgs(args.value['selectionSettings']);
|
|
248
|
-
break;
|
|
249
232
|
case 'setFlipState':
|
|
250
233
|
this.setFlipState(args.value['x'], args.value['y'], args.value['obj'], args.value['object']);
|
|
251
234
|
break;
|
|
252
235
|
case 'getNewShapeId':
|
|
253
236
|
args.value['obj']['id'] = this.getNewShapeId();
|
|
254
237
|
break;
|
|
238
|
+
case 'z-order':
|
|
239
|
+
this.updateZOrder(args.value['obj'], args.value['value']);
|
|
240
|
+
break;
|
|
241
|
+
case 'getSmallestIndex':
|
|
242
|
+
args.value['obj']['index'] = this.getSmallestIndex();
|
|
243
|
+
break;
|
|
244
|
+
case 'isIndexInObjColl':
|
|
245
|
+
args.value['obj']['bool'] = this.isIndexInObjColl(args.value['index']);
|
|
246
|
+
break;
|
|
247
|
+
case 'drawAnnotations':
|
|
248
|
+
this.drawAnnotations(args.value['ctx'], args.value['shape'], args.value['pen'], args.value['isPreventApply'], args.value['x'], args.value['y'], args.value['panRegion']);
|
|
249
|
+
break;
|
|
250
|
+
case 'updateShapeColl':
|
|
251
|
+
this.updateShapeColl();
|
|
252
|
+
break;
|
|
253
|
+
case 'getNewOrder':
|
|
254
|
+
args.value['obj']['order'] = this.getNewOrder();
|
|
255
|
+
break;
|
|
256
|
+
case 'getHighestOrder':
|
|
257
|
+
args.value['obj']['order'] = this.getHighestOrder();
|
|
258
|
+
break;
|
|
259
|
+
case 'getLowestOrder':
|
|
260
|
+
args.value['obj']['order'] = this.getLowestOrder();
|
|
261
|
+
break;
|
|
255
262
|
}
|
|
256
263
|
};
|
|
257
264
|
Shape.prototype.getModuleName = function () {
|
|
@@ -278,6 +285,7 @@ var Shape = /** @class */ (function () {
|
|
|
278
285
|
this.textSettings =
|
|
279
286
|
{ text: 'Enter Text', fontFamily: this.parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
280
287
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
288
|
+
this.preventFrameAnnotation = false;
|
|
281
289
|
};
|
|
282
290
|
Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree, isSelected) {
|
|
283
291
|
this.initializeShape('ellipse');
|
|
@@ -319,8 +327,8 @@ var Shape = /** @class */ (function () {
|
|
|
319
327
|
var start = x && y ? { x: x, y: y } : null;
|
|
320
328
|
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree, null, isSelected);
|
|
321
329
|
};
|
|
322
|
-
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected) {
|
|
323
|
-
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected);
|
|
330
|
+
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color, isSelected, degree) {
|
|
331
|
+
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y, isSelected, degree);
|
|
324
332
|
};
|
|
325
333
|
Shape.prototype.initializeShape = function (type) {
|
|
326
334
|
var parent = this.parent;
|
|
@@ -462,6 +470,7 @@ var Shape = /** @class */ (function () {
|
|
|
462
470
|
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
463
471
|
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
464
472
|
parent.activeObj.flipObjColl = [];
|
|
473
|
+
parent.activeObj.order = this.getNewOrder();
|
|
465
474
|
};
|
|
466
475
|
Shape.prototype.setPointCollForLineAndArrow = function () {
|
|
467
476
|
var parent = this.parent;
|
|
@@ -492,7 +501,7 @@ var Shape = /** @class */ (function () {
|
|
|
492
501
|
value: { obj: selPointCollObj } });
|
|
493
502
|
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
494
503
|
};
|
|
495
|
-
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected) {
|
|
504
|
+
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y, isSelected, degree) {
|
|
496
505
|
var parent = this.parent;
|
|
497
506
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
498
507
|
if (parent.currObjType.shape === 'freehanddraw') {
|
|
@@ -523,6 +532,7 @@ var Shape = /** @class */ (function () {
|
|
|
523
532
|
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
524
533
|
parent.activeObj.flipObjColl = [];
|
|
525
534
|
this.updateFontStyles();
|
|
535
|
+
parent.activeObj.order = this.getNewOrder();
|
|
526
536
|
var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
|
|
527
537
|
parent.activeObj.textSettings.fontSize * 0.5;
|
|
528
538
|
var height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
|
|
@@ -542,6 +552,15 @@ var Shape = /** @class */ (function () {
|
|
|
542
552
|
currentShapeSettings: shapeSettings };
|
|
543
553
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
544
554
|
this.drawShapeTextEvent(shapeChangingArgs);
|
|
555
|
+
if (degree) {
|
|
556
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
557
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
558
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
559
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
560
|
+
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: null } });
|
|
561
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
562
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
563
|
+
}
|
|
545
564
|
if (parent.isPublicMethod && !isSelected) {
|
|
546
565
|
parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
|
|
547
566
|
}
|
|
@@ -567,7 +586,7 @@ var Shape = /** @class */ (function () {
|
|
|
567
586
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
568
587
|
}
|
|
569
588
|
else {
|
|
570
|
-
parent.okBtn();
|
|
589
|
+
parent.okBtn(null, true);
|
|
571
590
|
}
|
|
572
591
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
573
592
|
};
|
|
@@ -717,15 +736,24 @@ var Shape = /** @class */ (function () {
|
|
|
717
736
|
Shape.prototype.updateShapeChangeEventArgs = function (shapeSettings) {
|
|
718
737
|
var parent = this.parent;
|
|
719
738
|
var shapeId;
|
|
739
|
+
if (shapeSettings.id && shapeSettings.id.indexOf('shape_') === -1 &&
|
|
740
|
+
shapeSettings.id.indexOf('pen_') === -1) {
|
|
741
|
+
if (parent.activeObj.currIndex) {
|
|
742
|
+
parent.activeObj.currIndex = 'shape_' + shapeSettings.id;
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
parent.pointColl[shapeId].id = 'pen_' + shapeSettings.id;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
720
748
|
if (shapeSettings.id && shapeSettings.id.split('_')[0] && shapeSettings.id.split('_')[0] === 'pen') {
|
|
721
749
|
shapeId = parseInt(shapeSettings.id.split('_')[1], 10) - 1;
|
|
722
750
|
parent.pointColl[shapeId].points = shapeSettings.points;
|
|
723
751
|
parent.pointColl[shapeId].strokeColor = shapeSettings.strokeColor;
|
|
724
752
|
parent.pointColl[shapeId].strokeWidth = shapeSettings.strokeWidth;
|
|
725
753
|
parent.pointColl[shapeId].opacity = shapeSettings.opacity;
|
|
754
|
+
parent.pointColl[shapeId].order = shapeSettings.index;
|
|
726
755
|
}
|
|
727
756
|
else {
|
|
728
|
-
parent.activeObj.currIndex = shapeSettings.id;
|
|
729
757
|
parent.activeObj.activePoint.startX = shapeSettings.startX;
|
|
730
758
|
parent.activeObj.activePoint.startY = shapeSettings.startY;
|
|
731
759
|
if (shapeSettings.width && shapeSettings.height) {
|
|
@@ -738,6 +766,7 @@ var Shape = /** @class */ (function () {
|
|
|
738
766
|
parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
|
|
739
767
|
parent.activeObj.strokeSettings.strokeWidth = shapeSettings.strokeWidth;
|
|
740
768
|
parent.activeObj.opacity = shapeSettings.opacity;
|
|
769
|
+
parent.activeObj.order = shapeSettings.index;
|
|
741
770
|
if (isNullOrUndefined(shapeSettings.degree)) {
|
|
742
771
|
shapeSettings.degree = 0;
|
|
743
772
|
}
|
|
@@ -804,17 +833,6 @@ var Shape = /** @class */ (function () {
|
|
|
804
833
|
}
|
|
805
834
|
}
|
|
806
835
|
};
|
|
807
|
-
Shape.prototype.updateSelectionChangeEventArgs = function (selectionSettings) {
|
|
808
|
-
var parent = this.parent;
|
|
809
|
-
parent.activeObj.activePoint.startX = selectionSettings.startX;
|
|
810
|
-
parent.activeObj.activePoint.startY = selectionSettings.startY;
|
|
811
|
-
if (selectionSettings.width && selectionSettings.height) {
|
|
812
|
-
parent.activeObj.activePoint.width = selectionSettings.width;
|
|
813
|
-
parent.activeObj.activePoint.height = selectionSettings.height;
|
|
814
|
-
parent.activeObj.activePoint.endX = parent.activeObj.activePoint.startX + parent.activeObj.activePoint.width;
|
|
815
|
-
parent.activeObj.activePoint.endY = parent.activeObj.activePoint.startY + parent.activeObj.activePoint.height;
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
836
|
Shape.prototype.addLetter = function (letter) {
|
|
819
837
|
var parent = this.parent;
|
|
820
838
|
if (parent.textArea.style.display === 'none' && (parent.currObjType.isText || parent.activeObj.shape === 'text')) {
|
|
@@ -937,15 +955,61 @@ var Shape = /** @class */ (function () {
|
|
|
937
955
|
Shape.prototype.iterateObjColl = function () {
|
|
938
956
|
var parent = this.parent;
|
|
939
957
|
if (parent.objColl.length > 0) {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
958
|
+
var index = this.getSmallestIndex();
|
|
959
|
+
var objColl = extend([], parent.objColl, [], true);
|
|
960
|
+
while (objColl.length > 0) {
|
|
961
|
+
var found = false;
|
|
962
|
+
for (var i = 0; i < objColl.length; i++) {
|
|
963
|
+
var currentObj = objColl[i];
|
|
964
|
+
if (isNullOrUndefined(currentObj.order)) {
|
|
965
|
+
objColl.splice(i, 1);
|
|
966
|
+
i--;
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
if (currentObj.order === index) {
|
|
970
|
+
this.apply(currentObj.shape, currentObj);
|
|
971
|
+
this.refreshActiveObj();
|
|
972
|
+
index++;
|
|
973
|
+
if (!this.isIndexInObjColl(index)) {
|
|
974
|
+
index++;
|
|
975
|
+
}
|
|
976
|
+
objColl.splice(i, 1);
|
|
977
|
+
found = true;
|
|
978
|
+
break; // Exit the loop to start from the beginning
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (!found) {
|
|
982
|
+
break; // If no matching order was found, exit the loop
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
Shape.prototype.getSmallestIndex = function () {
|
|
988
|
+
var parent = this.parent;
|
|
989
|
+
var smallestIndex;
|
|
990
|
+
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
991
|
+
var currentObj = parent.objColl[i];
|
|
992
|
+
if (isNullOrUndefined(currentObj.order)) {
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
if (isNullOrUndefined(smallestIndex) || currentObj.order < smallestIndex) {
|
|
996
|
+
smallestIndex = currentObj.order;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return smallestIndex;
|
|
1000
|
+
};
|
|
1001
|
+
Shape.prototype.isIndexInObjColl = function (index) {
|
|
1002
|
+
var parent = this.parent;
|
|
1003
|
+
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
1004
|
+
var currentObj = parent.objColl[i];
|
|
1005
|
+
if (isNullOrUndefined(currentObj.order)) {
|
|
1006
|
+
continue;
|
|
1007
|
+
}
|
|
1008
|
+
if (currentObj.order === index) {
|
|
1009
|
+
return true;
|
|
946
1010
|
}
|
|
947
|
-
parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
|
|
948
1011
|
}
|
|
1012
|
+
return false;
|
|
949
1013
|
};
|
|
950
1014
|
Shape.prototype.updImgRatioForActObj = function () {
|
|
951
1015
|
var parent = this.parent;
|
|
@@ -981,60 +1045,67 @@ var Shape = /** @class */ (function () {
|
|
|
981
1045
|
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
982
1046
|
width: parent.img.destWidth, height: parent.img.destHeight };
|
|
983
1047
|
this.straightenShapes();
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
if (currObj.shape === 'text') {
|
|
993
|
-
this.updateFontSize(currObj);
|
|
994
|
-
}
|
|
995
|
-
else if (currObj.shape === 'line' || currObj.shape === 'arrow') {
|
|
996
|
-
currObj.pointColl = this.getLinePoints(currObj.activePoint.startX, currObj.activePoint.startY, currObj.activePoint.endX, currObj.activePoint.endY);
|
|
997
|
-
for (var n = 0, len_1 = currObj.pointColl.length; n < len_1; n++) {
|
|
998
|
-
currObj.pointColl[n].ratioX =
|
|
999
|
-
(currObj.pointColl[n].x - destLeft) / destWidth;
|
|
1000
|
-
currObj.pointColl[n].ratioY =
|
|
1001
|
-
(currObj.pointColl[n].y - destTop) / destHeight;
|
|
1002
|
-
}
|
|
1003
|
-
if (currObj.shape === 'arrow') {
|
|
1004
|
-
this.updateArrowSize(currObj);
|
|
1048
|
+
if (parent.objColl.length > 0) {
|
|
1049
|
+
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
1050
|
+
var currObj = parent.objColl[i];
|
|
1051
|
+
if (currObj.imageRatio) {
|
|
1052
|
+
currObj.activePoint.startX = (currObj.imageRatio.startX * parent.img.destWidth) + parent.img.destLeft;
|
|
1053
|
+
currObj.activePoint.startY = (currObj.imageRatio.startY * parent.img.destHeight) + parent.img.destTop;
|
|
1054
|
+
currObj.activePoint.endX = (currObj.imageRatio.endX * parent.img.destWidth) + parent.img.destLeft;
|
|
1055
|
+
currObj.activePoint.endY = (currObj.imageRatio.endY * parent.img.destHeight) + parent.img.destTop;
|
|
1005
1056
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1057
|
+
currObj = this.updateWidthHeight(currObj);
|
|
1058
|
+
if (currObj.shape === 'text') {
|
|
1059
|
+
this.updateFontSize(currObj);
|
|
1008
1060
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1061
|
+
else if (currObj.shape === 'line' || currObj.shape === 'arrow') {
|
|
1062
|
+
currObj.pointColl = this.getLinePoints(currObj.activePoint.startX, currObj.activePoint.startY, currObj.activePoint.endX, currObj.activePoint.endY);
|
|
1063
|
+
for (var n = 0, len_1 = currObj.pointColl.length; n < len_1; n++) {
|
|
1064
|
+
currObj.pointColl[n].ratioX =
|
|
1065
|
+
(currObj.pointColl[n].x - parent.img.destLeft) / parent.img.destWidth;
|
|
1066
|
+
currObj.pointColl[n].ratioY =
|
|
1067
|
+
(currObj.pointColl[n].y - parent.img.destTop) / parent.img.destHeight;
|
|
1068
|
+
}
|
|
1069
|
+
if (currObj.shape === 'arrow') {
|
|
1070
|
+
this.updateArrowSize(currObj);
|
|
1071
|
+
}
|
|
1072
|
+
if (parent.transform.straighten !== 0 && (currObj.shape === 'line' || currObj.shape === 'arrow')) {
|
|
1073
|
+
this.straightenShapePoints(currObj);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
else if (currObj.shape === 'path') {
|
|
1077
|
+
for (var l = 0, len_2 = currObj.pointColl.length; l < len_2; l++) {
|
|
1078
|
+
currObj.pointColl[l].x = (currObj.pointColl[l].ratioX * parent.img.destWidth) +
|
|
1079
|
+
parent.img.destLeft;
|
|
1080
|
+
currObj.pointColl[l].y = (currObj.pointColl[l].ratioY * parent.img.destHeight) +
|
|
1081
|
+
parent.img.destTop;
|
|
1082
|
+
}
|
|
1083
|
+
this.updatePathRatio(currObj);
|
|
1084
|
+
if (parent.transform.straighten !== 0) {
|
|
1085
|
+
this.straightenPath(currObj);
|
|
1086
|
+
}
|
|
1016
1087
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1088
|
+
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: currObj.activePoint,
|
|
1089
|
+
obj: currObj } });
|
|
1090
|
+
if (currObj.shape !== 'line' && currObj.shape !== 'arrow' && currObj.shape !== 'path' && currObj.rotatedAngle !== 0) {
|
|
1091
|
+
this.setPointCollForShapeRotation(currObj);
|
|
1092
|
+
currObj.rotationCirclePoint.x =
|
|
1093
|
+
(currObj.rotationCirclePoint.ratioX * parent.img.destWidth) + parent.img.destLeft;
|
|
1094
|
+
currObj.rotationCirclePoint.y =
|
|
1095
|
+
(currObj.rotationCirclePoint.ratioY * parent.img.destHeight) + parent.img.destTop;
|
|
1096
|
+
if (currObj.rotationCirclePointColl) {
|
|
1097
|
+
currObj.rotationCirclePointColl.x =
|
|
1098
|
+
(currObj.rotationCirclePointColl.ratioX * parent.img.destWidth) + parent.img.destLeft;
|
|
1099
|
+
currObj.rotationCirclePointColl.y =
|
|
1100
|
+
(currObj.rotationCirclePointColl.ratioY * parent.img.destHeight) + parent.img.destTop;
|
|
1101
|
+
}
|
|
1020
1102
|
}
|
|
1021
1103
|
}
|
|
1022
|
-
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: currObj.activePoint,
|
|
1023
|
-
obj: currObj } });
|
|
1024
1104
|
if (isNullOrUndefined(preventApply)) {
|
|
1025
1105
|
var temp = this.lowerContext.filter;
|
|
1026
1106
|
this.lowerContext.filter = 'none';
|
|
1027
|
-
this.
|
|
1028
|
-
this.refreshActiveObj();
|
|
1107
|
+
this.iterateObjColl();
|
|
1029
1108
|
this.lowerContext.filter = temp;
|
|
1030
|
-
parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
|
|
1031
|
-
}
|
|
1032
|
-
if (currObj.shape !== 'line' && currObj.shape !== 'arrow' && currObj.shape !== 'path' && currObj.rotatedAngle !== 0) {
|
|
1033
|
-
this.setPointCollForShapeRotation(currObj);
|
|
1034
|
-
currObj.rotationCirclePoint.x = (currObj.rotationCirclePoint.ratioX * destWidth) + destLeft;
|
|
1035
|
-
currObj.rotationCirclePoint.y = (currObj.rotationCirclePoint.ratioY * destHeight) + destTop;
|
|
1036
|
-
currObj.rotationCirclePointColl.x = (currObj.rotationCirclePointColl.ratioX * destWidth) + destLeft;
|
|
1037
|
-
currObj.rotationCirclePointColl.y = (currObj.rotationCirclePointColl.ratioY * destHeight) + destTop;
|
|
1038
1109
|
}
|
|
1039
1110
|
}
|
|
1040
1111
|
parent.img.destLeft = destPoints.startX;
|
|
@@ -1507,9 +1578,13 @@ var Shape = /** @class */ (function () {
|
|
|
1507
1578
|
var degree = this.getRotDegOfShape(parent.activeObj);
|
|
1508
1579
|
this.transformTextArea();
|
|
1509
1580
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
1581
|
+
var zOrderElem = parent.element.querySelector('#' + parent.element.id + '_zOrderBtn');
|
|
1510
1582
|
var dupElem = parent.element.querySelector('#' + parent.element.id + '_duplicate');
|
|
1511
1583
|
var removeElem = parent.element.querySelector('#' + parent.element.id + '_remove');
|
|
1512
1584
|
var editTextElem = parent.element.querySelector('#' + parent.element.id + '_editText');
|
|
1585
|
+
if (zOrderElem) {
|
|
1586
|
+
zOrderElem.classList.add('e-disabled');
|
|
1587
|
+
}
|
|
1513
1588
|
if (dupElem) {
|
|
1514
1589
|
dupElem.classList.add('e-disabled');
|
|
1515
1590
|
}
|
|
@@ -1600,7 +1675,9 @@ var Shape = /** @class */ (function () {
|
|
|
1600
1675
|
var p1 = { x: cosAngle * (left - center.x) - sinAngle * (top_1 - center.y) + center.x,
|
|
1601
1676
|
y: sinAngle * (left - center.x) + cosAngle * (top_1 - center.y) + center.y };
|
|
1602
1677
|
if (p1.x > parent.img.destLeft && p1.x < parent.img.destLeft + parent.img.destWidth &&
|
|
1678
|
+
// eslint-disable-next-line max-len
|
|
1603
1679
|
p1.y > parent.img.destTop && p1.y + parseFloat(parent.textArea.style.fontSize) < parent.img.destTop + parent.img.destHeight) {
|
|
1680
|
+
// eslint-disable-next-line no-self-assign
|
|
1604
1681
|
parent.textArea.style.width = parent.textArea.style.width;
|
|
1605
1682
|
}
|
|
1606
1683
|
else {
|
|
@@ -1614,6 +1691,7 @@ var Shape = /** @class */ (function () {
|
|
|
1614
1691
|
p1 = { x: cosAngle * (left - center.x) - sinAngle * (top_1 - center.y) + center.x,
|
|
1615
1692
|
y: sinAngle * (left - center.x) + cosAngle * (top_1 - center.y) + center.y };
|
|
1616
1693
|
if ((p1.x > parent.img.destLeft && p1.x < parent.img.destLeft + parent.img.destWidth &&
|
|
1694
|
+
// eslint-disable-next-line max-len
|
|
1617
1695
|
p1.y > parent.img.destTop && p1.y + parseFloat(parent.textArea.style.fontSize) < parent.img.destTop + parent.img.destHeight) ||
|
|
1618
1696
|
count === width2) {
|
|
1619
1697
|
parent.textArea.style.width = width1 + 'px';
|
|
@@ -1817,7 +1895,11 @@ var Shape = /** @class */ (function () {
|
|
|
1817
1895
|
}
|
|
1818
1896
|
parent.notify('draw', { prop: 'setNewPath', value: { bool: true } });
|
|
1819
1897
|
if (parent.objColl[parent.objColl.length - 1]) {
|
|
1898
|
+
var shape = parent.drawingShape;
|
|
1899
|
+
parent.notify('selection', { prop: 'setCurrentDrawingShape', value: { value: '' } });
|
|
1820
1900
|
parent.selectShape(parent.objColl[parent.objColl.length - 1].currIndex);
|
|
1901
|
+
parent.notify('selection', { prop: 'setCurrentDrawingShape', value: { value: 'path' } });
|
|
1902
|
+
parent.drawingShape = shape;
|
|
1821
1903
|
}
|
|
1822
1904
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
1823
1905
|
var obj_1 = { shapeSettingsObj: {} };
|
|
@@ -1827,6 +1909,7 @@ var Shape = /** @class */ (function () {
|
|
|
1827
1909
|
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: shapeSettings };
|
|
1828
1910
|
parent.notify('selection', { prop: 'triggerShapeChange', onPropertyChange: false,
|
|
1829
1911
|
value: { shapeResizingArgs: shapeResizingArgs, shapeMovingArgs: shapeMovingArgs, type: 'mouse-up' } });
|
|
1912
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
1830
1913
|
}
|
|
1831
1914
|
}
|
|
1832
1915
|
};
|
|
@@ -2137,6 +2220,9 @@ var Shape = /** @class */ (function () {
|
|
|
2137
2220
|
if (parent.isPublicMethod && !isSelected) {
|
|
2138
2221
|
parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
|
|
2139
2222
|
}
|
|
2223
|
+
else if (!parent.isPublicMethod) {
|
|
2224
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
2225
|
+
}
|
|
2140
2226
|
parent.isPublicMethod = false;
|
|
2141
2227
|
};
|
|
2142
2228
|
Shape.prototype.updateObj = function (dimObj, x, y) {
|
|
@@ -2326,7 +2412,7 @@ var Shape = /** @class */ (function () {
|
|
|
2326
2412
|
if (parent.objColl.length > 0) {
|
|
2327
2413
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
2328
2414
|
var currObj = parent.objColl[i];
|
|
2329
|
-
if (panRegion === ''
|
|
2415
|
+
if (panRegion === '') {
|
|
2330
2416
|
currObj.activePoint.startX += xDiff;
|
|
2331
2417
|
currObj.activePoint.endX += xDiff;
|
|
2332
2418
|
if (currObj.rotationCirclePointColl) {
|
|
@@ -2337,20 +2423,6 @@ var Shape = /** @class */ (function () {
|
|
|
2337
2423
|
currObj.pointColl[l].x += xDiff;
|
|
2338
2424
|
}
|
|
2339
2425
|
}
|
|
2340
|
-
}
|
|
2341
|
-
else {
|
|
2342
|
-
currObj.activePoint.startX -= xDiff;
|
|
2343
|
-
currObj.activePoint.endX -= xDiff;
|
|
2344
|
-
if (currObj.rotationCirclePointColl) {
|
|
2345
|
-
currObj.rotationCirclePointColl.x -= xDiff;
|
|
2346
|
-
}
|
|
2347
|
-
if (currObj.shape === 'path') {
|
|
2348
|
-
for (var l = 0, len_4 = currObj.pointColl.length; l < len_4; l++) {
|
|
2349
|
-
currObj.pointColl[l].x -= xDiff;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
if (panRegion === '' || panRegion === 'horizontal') {
|
|
2354
2426
|
currObj.activePoint.startY += yDiff;
|
|
2355
2427
|
currObj.activePoint.endY += yDiff;
|
|
2356
2428
|
if (currObj.rotationCirclePointColl) {
|
|
@@ -2362,36 +2434,25 @@ var Shape = /** @class */ (function () {
|
|
|
2362
2434
|
}
|
|
2363
2435
|
}
|
|
2364
2436
|
}
|
|
2365
|
-
else {
|
|
2366
|
-
currObj.activePoint.startY -= yDiff;
|
|
2367
|
-
currObj.activePoint.endY -= yDiff;
|
|
2368
|
-
if (currObj.rotationCirclePointColl) {
|
|
2369
|
-
currObj.rotationCirclePointColl.y -= yDiff;
|
|
2370
|
-
}
|
|
2371
|
-
if (currObj.shape === 'path') {
|
|
2372
|
-
for (var l = 0; l < currObj.pointColl.length; l++) {
|
|
2373
|
-
currObj.pointColl[l].y -= yDiff;
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
2437
|
currObj = this.updateWidthHeight(currObj);
|
|
2378
2438
|
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: currObj.activePoint,
|
|
2379
2439
|
obj: currObj } });
|
|
2380
2440
|
if (currObj.shape === 'line' || currObj.shape === 'arrow') {
|
|
2381
2441
|
currObj.pointColl = this.getLinePoints(currObj.activePoint.startX, currObj.activePoint.startY, currObj.activePoint.endX, currObj.activePoint.endY);
|
|
2382
|
-
for (var j = 0,
|
|
2442
|
+
for (var j = 0, len_4 = currObj.pointColl.length; j < len_4; j++) {
|
|
2383
2443
|
currObj.pointColl[j].ratioX =
|
|
2384
2444
|
(currObj.pointColl[j].x - parent.img.destLeft) / parent.img.destWidth;
|
|
2385
2445
|
currObj.pointColl[j].ratioY =
|
|
2386
2446
|
(currObj.pointColl[j].y - parent.img.destTop) / parent.img.destHeight;
|
|
2387
2447
|
}
|
|
2388
2448
|
}
|
|
2389
|
-
var temp = this.lowerContext.filter;
|
|
2390
|
-
this.lowerContext.filter = 'none';
|
|
2391
|
-
this.apply(currObj.shape, currObj);
|
|
2392
|
-
this.lowerContext.filter = temp;
|
|
2393
2449
|
this.refreshActiveObj();
|
|
2394
2450
|
}
|
|
2451
|
+
var temp = this.lowerContext.filter;
|
|
2452
|
+
this.lowerContext.filter = 'none';
|
|
2453
|
+
this.iterateObjColl();
|
|
2454
|
+
this.lowerContext.filter = temp;
|
|
2455
|
+
this.refreshActiveObj();
|
|
2395
2456
|
parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
|
|
2396
2457
|
}
|
|
2397
2458
|
};
|
|
@@ -2472,7 +2533,9 @@ var Shape = /** @class */ (function () {
|
|
|
2472
2533
|
else {
|
|
2473
2534
|
this.textSettings.bold = parent.activeObj.textSettings.bold = fontWeight === 'normal' ? false : true;
|
|
2474
2535
|
this.textSettings.italic = parent.activeObj.textSettings.italic = fontStyle === 'normal' ? false : true;
|
|
2475
|
-
|
|
2536
|
+
if (parent.activeObj.activePoint.width !== 0 || parent.activeObj.activePoint.height !== 0) {
|
|
2537
|
+
this.redrawText();
|
|
2538
|
+
}
|
|
2476
2539
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
2477
2540
|
}
|
|
2478
2541
|
};
|
|
@@ -2615,6 +2678,7 @@ var Shape = /** @class */ (function () {
|
|
|
2615
2678
|
parent.activeObj.activePoint = { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 };
|
|
2616
2679
|
parent.activeObj.triangle = [];
|
|
2617
2680
|
parent.activeObj.triangleRatio = [];
|
|
2681
|
+
parent.activeObj.order = null;
|
|
2618
2682
|
parent.activeObj.flipObjColl = [];
|
|
2619
2683
|
parent.activeObj.strokeSettings = this.strokeSettings;
|
|
2620
2684
|
parent.activeObj.textSettings = this.textSettings;
|
|
@@ -2651,6 +2715,9 @@ var Shape = /** @class */ (function () {
|
|
|
2651
2715
|
if (isNullOrUndefined(parent.activeObj.currIndex)) {
|
|
2652
2716
|
parent.activeObj.currIndex = this.getNewShapeId();
|
|
2653
2717
|
}
|
|
2718
|
+
if (isNullOrUndefined(parent.activeObj.order)) {
|
|
2719
|
+
parent.activeObj.order = this.getNewOrder();
|
|
2720
|
+
}
|
|
2654
2721
|
this.updImgRatioForActObj();
|
|
2655
2722
|
var splitWords_1 = parent.activeObj.currIndex.split('_');
|
|
2656
2723
|
var tempObjColl = parent.objColl.splice(0, parseInt(splitWords_1[1], 10) - 1);
|
|
@@ -2691,6 +2758,40 @@ var Shape = /** @class */ (function () {
|
|
|
2691
2758
|
}
|
|
2692
2759
|
return 'shape_' + value;
|
|
2693
2760
|
};
|
|
2761
|
+
Shape.prototype.getNewOrder = function () {
|
|
2762
|
+
var parent = this.parent;
|
|
2763
|
+
this.updateShapeColl();
|
|
2764
|
+
var value = parent.shapeColl.length + 1;
|
|
2765
|
+
for (var i = 0; i < parent.shapeColl.length; i++) {
|
|
2766
|
+
if (parent.shapeColl[i].order === value) {
|
|
2767
|
+
value++;
|
|
2768
|
+
i = -1;
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
return value;
|
|
2772
|
+
};
|
|
2773
|
+
Shape.prototype.getHighestOrder = function () {
|
|
2774
|
+
var parent = this.parent;
|
|
2775
|
+
this.updateShapeColl();
|
|
2776
|
+
var value = 0;
|
|
2777
|
+
for (var i = 0; i < parent.shapeColl.length; i++) {
|
|
2778
|
+
if (parent.shapeColl[i].order > value) {
|
|
2779
|
+
value = parent.shapeColl[i].order;
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
return value;
|
|
2783
|
+
};
|
|
2784
|
+
Shape.prototype.getLowestOrder = function () {
|
|
2785
|
+
var parent = this.parent;
|
|
2786
|
+
this.updateShapeColl();
|
|
2787
|
+
var value = 1;
|
|
2788
|
+
for (var i = 0; i < parent.shapeColl.length; i++) {
|
|
2789
|
+
if (parent.shapeColl[i].order < value) {
|
|
2790
|
+
value = parent.shapeColl[i].order;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
return value;
|
|
2794
|
+
};
|
|
2694
2795
|
Shape.prototype.alignTextAreaIntoCanvas = function () {
|
|
2695
2796
|
var parent = this.parent;
|
|
2696
2797
|
var letters = parent.textArea.value;
|
|
@@ -2778,6 +2879,7 @@ var Shape = /** @class */ (function () {
|
|
|
2778
2879
|
shapeDetails.type = parent.toPascalCase(obj.shape);
|
|
2779
2880
|
shapeDetails.startX = obj.activePoint.startX;
|
|
2780
2881
|
shapeDetails.startY = obj.activePoint.startY;
|
|
2882
|
+
shapeDetails.index = obj.order;
|
|
2781
2883
|
switch (obj.shape) {
|
|
2782
2884
|
case 'rectangle':
|
|
2783
2885
|
shapeDetails.width = obj.activePoint.width;
|
|
@@ -2848,6 +2950,7 @@ var Shape = /** @class */ (function () {
|
|
|
2848
2950
|
shapeDetails.points = extend([], parent.pointColl[index].points);
|
|
2849
2951
|
shapeDetails.strokeColor = parent.pointColl[index].strokeColor;
|
|
2850
2952
|
shapeDetails.strokeWidth = parent.pointColl[index].strokeWidth;
|
|
2953
|
+
shapeDetails.index = parent.pointColl[index].order;
|
|
2851
2954
|
return shapeDetails;
|
|
2852
2955
|
};
|
|
2853
2956
|
Shape.prototype.getShapeSetting = function (id, obj) {
|
|
@@ -2855,7 +2958,7 @@ var Shape = /** @class */ (function () {
|
|
|
2855
2958
|
var shapeDetails;
|
|
2856
2959
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
2857
2960
|
if (parent.textArea.style.display !== 'none') {
|
|
2858
|
-
parent.okBtn();
|
|
2961
|
+
parent.okBtn(null, true);
|
|
2859
2962
|
}
|
|
2860
2963
|
else {
|
|
2861
2964
|
this.applyActObj(true);
|
|
@@ -2881,7 +2984,7 @@ var Shape = /** @class */ (function () {
|
|
|
2881
2984
|
var shapeDetailsColl = [];
|
|
2882
2985
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
2883
2986
|
if (parent.textArea.style.display !== 'none') {
|
|
2884
|
-
parent.okBtn();
|
|
2987
|
+
parent.okBtn(null, true);
|
|
2885
2988
|
}
|
|
2886
2989
|
else {
|
|
2887
2990
|
this.applyActObj(true);
|
|
@@ -3055,7 +3158,7 @@ var Shape = /** @class */ (function () {
|
|
|
3055
3158
|
var object = { bool: false };
|
|
3056
3159
|
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: object } });
|
|
3057
3160
|
if (object['bool']) {
|
|
3058
|
-
parent.okBtn();
|
|
3161
|
+
parent.okBtn(null, true);
|
|
3059
3162
|
}
|
|
3060
3163
|
var obj_6 = { isIndex: false };
|
|
3061
3164
|
parent.notify('freehand-draw', { prop: 'isFHDIdx', value: { index: parseInt(id.split('_')[1], 10) - 1, obj: obj_6 } });
|
|
@@ -3341,6 +3444,296 @@ var Shape = /** @class */ (function () {
|
|
|
3341
3444
|
}
|
|
3342
3445
|
return point;
|
|
3343
3446
|
};
|
|
3447
|
+
Shape.prototype.updateZOrder = function (obj, value) {
|
|
3448
|
+
var parent = this.parent;
|
|
3449
|
+
value = value.toLowerCase();
|
|
3450
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3451
|
+
var object = obj;
|
|
3452
|
+
if (isNullOrUndefined(object.order)) {
|
|
3453
|
+
return;
|
|
3454
|
+
}
|
|
3455
|
+
var index;
|
|
3456
|
+
var prevIndex;
|
|
3457
|
+
var highestOrder = this.getHighestOrder();
|
|
3458
|
+
this.updateShapeColl();
|
|
3459
|
+
if (parent.shapeColl.length === 0) {
|
|
3460
|
+
return;
|
|
3461
|
+
}
|
|
3462
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3463
|
+
var coll;
|
|
3464
|
+
for (var i = 0; i < parent.shapeColl.length; i++) {
|
|
3465
|
+
coll = parent.shapeColl[i];
|
|
3466
|
+
if (object.id && object.id.indexOf('pen') > -1) {
|
|
3467
|
+
if (coll.id && coll.id === object.id) {
|
|
3468
|
+
parent.shapeColl.splice(i, 1);
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
else if (coll.shape && coll.shape.indexOf('crop-') > -1) {
|
|
3472
|
+
parent.shapeColl.splice(i, 1);
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
switch (value) {
|
|
3476
|
+
case 'sendtoback':
|
|
3477
|
+
prevIndex = object.order;
|
|
3478
|
+
index = object.order;
|
|
3479
|
+
object.order = 1;
|
|
3480
|
+
break;
|
|
3481
|
+
case 'sendbackward':
|
|
3482
|
+
object.order -= 1;
|
|
3483
|
+
index = object.order;
|
|
3484
|
+
break;
|
|
3485
|
+
case 'bringtofront':
|
|
3486
|
+
prevIndex = object.order;
|
|
3487
|
+
index = highestOrder;
|
|
3488
|
+
object.order = index;
|
|
3489
|
+
break;
|
|
3490
|
+
case 'bringforward':
|
|
3491
|
+
object.order += 1;
|
|
3492
|
+
index = object.order;
|
|
3493
|
+
break;
|
|
3494
|
+
}
|
|
3495
|
+
this.reArrangeObjColl(index, value, prevIndex);
|
|
3496
|
+
if (object.id && object.id.indexOf('pen') > -1) {
|
|
3497
|
+
this.reUpdateShapeColl(object);
|
|
3498
|
+
}
|
|
3499
|
+
};
|
|
3500
|
+
Shape.prototype.reArrangeObjColl = function (index, value, prevIndex) {
|
|
3501
|
+
var parent = this.parent;
|
|
3502
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3503
|
+
var obj;
|
|
3504
|
+
switch (value) {
|
|
3505
|
+
case 'sendtoback':
|
|
3506
|
+
for (var i = 0, len = parent.shapeColl.length; i < len; i++) {
|
|
3507
|
+
obj = parent.shapeColl[i];
|
|
3508
|
+
if (obj.order < prevIndex && obj.order <= index) {
|
|
3509
|
+
obj.order += 1;
|
|
3510
|
+
this.reUpdateShapeColl(obj);
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
break;
|
|
3514
|
+
case 'sendbackward':
|
|
3515
|
+
for (var i = 0, len = parent.shapeColl.length; i < len; i++) {
|
|
3516
|
+
obj = parent.shapeColl[i];
|
|
3517
|
+
if (obj.order === index) {
|
|
3518
|
+
obj.order += 1;
|
|
3519
|
+
this.reUpdateShapeColl(obj);
|
|
3520
|
+
break;
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
break;
|
|
3524
|
+
case 'bringtofront':
|
|
3525
|
+
for (var i = 0, len = parent.shapeColl.length; i < len; i++) {
|
|
3526
|
+
obj = parent.shapeColl[i];
|
|
3527
|
+
if (obj.order > prevIndex && obj.order <= index) {
|
|
3528
|
+
obj.order -= 1;
|
|
3529
|
+
this.reUpdateShapeColl(obj);
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
break;
|
|
3533
|
+
case 'bringforward':
|
|
3534
|
+
for (var i = 0, len = parent.shapeColl.length; i < len; i++) {
|
|
3535
|
+
obj = parent.shapeColl[i];
|
|
3536
|
+
if (obj.order === index) {
|
|
3537
|
+
obj.order -= 1;
|
|
3538
|
+
this.reUpdateShapeColl(obj);
|
|
3539
|
+
break;
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
break;
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
Shape.prototype.updateShapeColl = function () {
|
|
3546
|
+
var parent = this.parent;
|
|
3547
|
+
var isOrdered = false;
|
|
3548
|
+
var tempOrder = 1;
|
|
3549
|
+
var tempObjColl = extend([], parent.objColl, [], true);
|
|
3550
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3551
|
+
var tempPointColl = extend([], parent.pointColl, [], true);
|
|
3552
|
+
if (parent.shapeColl.length > 0 &&
|
|
3553
|
+
parent.shapeColl.length === parent.objColl.length + parent.pointColl.length) {
|
|
3554
|
+
for (var i = 0; i < parent.shapeColl.length; i++) {
|
|
3555
|
+
if (parent.shapeColl[i].order === tempOrder) {
|
|
3556
|
+
isOrdered = true;
|
|
3557
|
+
tempOrder++;
|
|
3558
|
+
}
|
|
3559
|
+
else {
|
|
3560
|
+
isOrdered = false;
|
|
3561
|
+
break;
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
if (isOrdered) {
|
|
3565
|
+
for (var i = 0; i < parent.shapeColl.length; i++) {
|
|
3566
|
+
if (parent.shapeColl[i].currIndex &&
|
|
3567
|
+
parent.shapeColl[i].currIndex.indexOf('shape') > -1) {
|
|
3568
|
+
for (var j = 0; j < tempObjColl.length; j++) {
|
|
3569
|
+
if (parent.shapeColl[i].currIndex === tempObjColl[j].currIndex) {
|
|
3570
|
+
parent.shapeColl[i] = extend({}, tempObjColl[j], {}, true);
|
|
3571
|
+
tempObjColl.splice(j, 1);
|
|
3572
|
+
break;
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
else if (parent.shapeColl[i].id && parent.shapeColl[i].id.indexOf('pen') > -1) {
|
|
3577
|
+
for (var j = 0; j < tempPointColl.length; j++) {
|
|
3578
|
+
if (parent.shapeColl[i].id === tempPointColl[j].id) {
|
|
3579
|
+
parent.shapeColl[i] = extend([], tempPointColl[j], [], true);
|
|
3580
|
+
tempPointColl.splice(j, 1);
|
|
3581
|
+
break;
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
tempObjColl = extend([], parent.objColl, [], true);
|
|
3590
|
+
tempPointColl = extend([], parent.pointColl, [], true);
|
|
3591
|
+
parent.shapeColl = [];
|
|
3592
|
+
var order = 1;
|
|
3593
|
+
var isBreak;
|
|
3594
|
+
var isCrop = false;
|
|
3595
|
+
while (tempObjColl.length !== 0 || tempPointColl.length !== 0) {
|
|
3596
|
+
isBreak = isCrop = false;
|
|
3597
|
+
for (var i = 0; i < tempObjColl.length; i++) {
|
|
3598
|
+
if (tempObjColl[i].order === order ||
|
|
3599
|
+
(!tempObjColl[i].order && tempObjColl[i].shape &&
|
|
3600
|
+
tempObjColl[i].shape.indexOf('crop-') > -1)) {
|
|
3601
|
+
parent.shapeColl.push(extend({}, tempObjColl[i], {}, true));
|
|
3602
|
+
if (tempObjColl[i].shape && tempObjColl[i].shape.indexOf('crop-') > -1) {
|
|
3603
|
+
isCrop = true;
|
|
3604
|
+
}
|
|
3605
|
+
tempObjColl.splice(i, 1);
|
|
3606
|
+
isBreak = true;
|
|
3607
|
+
break;
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
if (!isBreak) {
|
|
3611
|
+
for (var i = 0; i < tempPointColl.length; i++) {
|
|
3612
|
+
if (tempPointColl[i].order === order) {
|
|
3613
|
+
parent.shapeColl.push(extend([], tempPointColl[i], [], true));
|
|
3614
|
+
tempPointColl.splice(i, 1);
|
|
3615
|
+
isBreak = true;
|
|
3616
|
+
break;
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
if (!isCrop) {
|
|
3621
|
+
order++;
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
};
|
|
3625
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3626
|
+
Shape.prototype.reUpdateShapeColl = function (obj) {
|
|
3627
|
+
var parent = this.parent;
|
|
3628
|
+
if (obj.id && obj.id.indexOf('pen') > -1) {
|
|
3629
|
+
if (parent.freehandCounter > 0) {
|
|
3630
|
+
for (var i = 0; i < parent.freehandCounter; i++) {
|
|
3631
|
+
if (parent.pointColl[i].id === obj.id) {
|
|
3632
|
+
parent.pointColl[i].order = obj.order;
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
else if (obj.currIndex && obj.currIndex.indexOf('shape') > -1) {
|
|
3638
|
+
for (var i = 0; i < parent.objColl.length; i++) {
|
|
3639
|
+
if (parent.objColl[i].currIndex === obj.currIndex) {
|
|
3640
|
+
parent.objColl[i].order = obj.order;
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
};
|
|
3645
|
+
Shape.prototype.drawAnnotations = function (ctx, shape, pen, isPreventApply, x, y, panRegion) {
|
|
3646
|
+
var parent = this.parent;
|
|
3647
|
+
var activeObj = extend({}, parent.activeObj, {}, true);
|
|
3648
|
+
var tempObjColl = extend([], parent.objColl, [], true);
|
|
3649
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3650
|
+
var tempPointColl = extend([], parent.pointColl, [], true);
|
|
3651
|
+
this.updateShapeColl();
|
|
3652
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3653
|
+
var tempShapeColl = extend([], parent.shapeColl, [], true);
|
|
3654
|
+
var isPrevented = false;
|
|
3655
|
+
if (!this.preventFrameAnnotation) {
|
|
3656
|
+
this.preventFrameAnnotation = isPrevented = true;
|
|
3657
|
+
}
|
|
3658
|
+
for (var i = 0; i < tempShapeColl.length; i++) {
|
|
3659
|
+
var isPenId = tempShapeColl[i].id;
|
|
3660
|
+
if ((tempShapeColl[i].order) ||
|
|
3661
|
+
(!tempShapeColl[i].order && tempShapeColl[i].shape && tempShapeColl[i].shape.indexOf('crop-') > -1) ||
|
|
3662
|
+
(!tempShapeColl[i].order && tempShapeColl[i].shape === 'path' && parent.drawingShape === 'path')) {
|
|
3663
|
+
if (tempShapeColl[i].currIndex && tempShapeColl[i].currIndex.indexOf('shape') > -1) {
|
|
3664
|
+
parent.objColl = [];
|
|
3665
|
+
parent.objColl.push(extend({}, tempShapeColl[i], {}, true));
|
|
3666
|
+
if (shape === 'iterate') {
|
|
3667
|
+
var temp = this.lowerContext.filter;
|
|
3668
|
+
this.lowerContext.filter = 'none';
|
|
3669
|
+
this.iterateObjColl();
|
|
3670
|
+
this.lowerContext.filter = temp;
|
|
3671
|
+
}
|
|
3672
|
+
else if (shape === 'zoom' || shape === 'pan') {
|
|
3673
|
+
var tempObjCollIndex = -1;
|
|
3674
|
+
for (var i_3 = 0; i_3 < tempObjColl.length; i_3++) {
|
|
3675
|
+
if (JSON.stringify(tempObjColl[i_3]) === JSON.stringify(parent.objColl[0])) {
|
|
3676
|
+
tempObjCollIndex = i_3;
|
|
3677
|
+
break;
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
if (shape === 'zoom') {
|
|
3681
|
+
this.zoomObjColl(isPreventApply);
|
|
3682
|
+
}
|
|
3683
|
+
else {
|
|
3684
|
+
this.panObjColl(x, y, panRegion);
|
|
3685
|
+
}
|
|
3686
|
+
if (tempObjCollIndex > -1) {
|
|
3687
|
+
tempObjColl[tempObjCollIndex] = extend({}, parent.objColl[0], {}, true);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
else if (tempShapeColl[i].id && tempShapeColl[i].id.indexOf('pen') > -1) {
|
|
3692
|
+
parent.pointColl = [];
|
|
3693
|
+
parent.freehandCounter = 0;
|
|
3694
|
+
parent.pointColl.push(extend({}, tempShapeColl[i], {}, true));
|
|
3695
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
3696
|
+
if (pen === 'iterate') {
|
|
3697
|
+
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
3698
|
+
value: { context: ctx, points: null } });
|
|
3699
|
+
}
|
|
3700
|
+
else if (pen === 'zoom' || pen === 'pan') {
|
|
3701
|
+
if (pen === 'zoom') {
|
|
3702
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false,
|
|
3703
|
+
value: { isPreventApply: isPreventApply } });
|
|
3704
|
+
}
|
|
3705
|
+
else {
|
|
3706
|
+
parent.notify('freehand-draw', { prop: 'panFHDColl', onPropertyChange: false,
|
|
3707
|
+
value: { xDiff: x, yDiff: y, panRegion: panRegion } });
|
|
3708
|
+
}
|
|
3709
|
+
for (var i_4 = 0; i_4 < tempPointColl.length; i_4++) {
|
|
3710
|
+
if (tempPointColl[i_4].id === parent.pointColl[0].id) {
|
|
3711
|
+
tempPointColl[i_4] = extend({}, parent.pointColl[0], {}, true);
|
|
3712
|
+
break;
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
else if ((!tempShapeColl[i].shape && !isPenId) ||
|
|
3719
|
+
(!tempShapeColl[i].currIndex && !isPenId)) {
|
|
3720
|
+
tempShapeColl.splice(i, 1);
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
if (pen && pen === 'zoom') {
|
|
3724
|
+
parent.pointColl = [];
|
|
3725
|
+
parent.freehandCounter = 0;
|
|
3726
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
3727
|
+
}
|
|
3728
|
+
parent.objColl = tempObjColl;
|
|
3729
|
+
parent.pointColl = tempPointColl;
|
|
3730
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
3731
|
+
if (isPrevented && this.preventFrameAnnotation) {
|
|
3732
|
+
parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
|
|
3733
|
+
this.preventFrameAnnotation = false;
|
|
3734
|
+
}
|
|
3735
|
+
parent.activeObj = activeObj;
|
|
3736
|
+
};
|
|
3344
3737
|
return Shape;
|
|
3345
3738
|
}());
|
|
3346
3739
|
export { Shape };
|