@syncfusion/ej2-image-editor 25.2.4 → 26.1.38
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 +2691 -830
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +2788 -887
- 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 +198 -83
- 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 +385 -53
- 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 +1852 -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 +355 -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 +1852 -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,5 +1,6 @@
|
|
|
1
|
+
/* eslint-disable prefer-const */
|
|
1
2
|
import { Browser, EventHandler, extend, getComponent, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
-
import { ShapeType, ZoomTrigger } from '../index';
|
|
3
|
+
import { ArrowheadType, ShapeType, ZoomTrigger } from '../index';
|
|
3
4
|
var Selection = /** @class */ (function () {
|
|
4
5
|
function Selection(parent) {
|
|
5
6
|
this.diffPoint = { x: 0, y: 0 }; // updates resize points
|
|
@@ -10,7 +11,7 @@ var Selection = /** @class */ (function () {
|
|
|
10
11
|
this.dragPoint = { startX: 0, startY: 0, endX: 0, endY: 0 }; // updates drag start and end points in mousedown and mousemove
|
|
11
12
|
this.isShapeInserted = false;
|
|
12
13
|
this.tempActiveObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
|
|
13
|
-
flipObjColl: [], triangle: [], triangleRatio: [] }; // for undo redo
|
|
14
|
+
flipObjColl: [], triangle: [], triangleRatio: [], order: null }; // for undo redo
|
|
14
15
|
this.isFirstMove = false; // for pinch zoom
|
|
15
16
|
this.startTouches = []; // for pinch zoom
|
|
16
17
|
this.tempTouches = []; // for pinch zoom
|
|
@@ -36,6 +37,7 @@ var Selection = /** @class */ (function () {
|
|
|
36
37
|
this.isSliding = false;
|
|
37
38
|
this.mouseDown = '';
|
|
38
39
|
this.isSliderActive = false;
|
|
40
|
+
this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
|
|
39
41
|
this.parent = parent;
|
|
40
42
|
this.addEventListener();
|
|
41
43
|
}
|
|
@@ -57,9 +59,6 @@ var Selection = /** @class */ (function () {
|
|
|
57
59
|
var parent = this.parent;
|
|
58
60
|
this.updatePrivateVariables();
|
|
59
61
|
switch (args.prop) {
|
|
60
|
-
case 'mouse-up':
|
|
61
|
-
this.selMouseUpEvent();
|
|
62
|
-
break;
|
|
63
62
|
case 'setCursor':
|
|
64
63
|
this.setCursor(args.value['x'], args.value['y']);
|
|
65
64
|
break;
|
|
@@ -81,9 +80,6 @@ var Selection = /** @class */ (function () {
|
|
|
81
80
|
case 'calcShapeRatio':
|
|
82
81
|
this.calcShapeRatio(args.value['x'], args.value['y'], args.value['imgWidth'], args.value['imgHeight']);
|
|
83
82
|
break;
|
|
84
|
-
case 'applyCurrShape':
|
|
85
|
-
this.applyCurrShape(args.value['isShapeClick']);
|
|
86
|
-
break;
|
|
87
83
|
case 'tab':
|
|
88
84
|
this.performTabAction();
|
|
89
85
|
break;
|
|
@@ -209,7 +205,7 @@ var Selection = /** @class */ (function () {
|
|
|
209
205
|
case 'annotate':
|
|
210
206
|
this.currentDrawingShape = args.value['shape'];
|
|
211
207
|
if (args.value['shape'] === 'text') {
|
|
212
|
-
parent.activeObj.textSettings.fontSize =
|
|
208
|
+
parent.activeObj.textSettings.fontSize = 11;
|
|
213
209
|
parent.activeObj.keyHistory = 'Enter Text';
|
|
214
210
|
parent.notify('shape', { prop: 'initializeTextShape', onPropertyChange: false,
|
|
215
211
|
value: { text: null, fontFamily: null, fontSize: null, bold: null, italic: null, strokeColor: null } });
|
|
@@ -260,15 +256,9 @@ var Selection = /** @class */ (function () {
|
|
|
260
256
|
case 'upgradeImageQuality':
|
|
261
257
|
this.upgradeImageQuality();
|
|
262
258
|
break;
|
|
263
|
-
case 'getScaleRatio':
|
|
264
|
-
args.value['obj']['newScale'] = this.getScaleRatio(args.value['scale']);
|
|
265
|
-
break;
|
|
266
259
|
case 'triggerShapeChange':
|
|
267
260
|
this.triggerShapeChange(args.value['shapeResizingArgs'], args.value['shapeMovingArgs'], args.value['type']);
|
|
268
261
|
break;
|
|
269
|
-
case 'limitDrag':
|
|
270
|
-
args.value['bool'] = this.limitDrag(args.value['isStart']);
|
|
271
|
-
break;
|
|
272
262
|
case 'applyTransformToImg':
|
|
273
263
|
this.applyTransformToImg(args.value['ctx']);
|
|
274
264
|
break;
|
|
@@ -284,6 +274,38 @@ var Selection = /** @class */ (function () {
|
|
|
284
274
|
case 'getArrowType':
|
|
285
275
|
args.value['obj']['type'] = this.getArrowType(args.value['type']);
|
|
286
276
|
break;
|
|
277
|
+
case 'setArrowShape':
|
|
278
|
+
if (args.value['type'] === 'initial') {
|
|
279
|
+
this.arrowShape[0] = args.value['shape'];
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
this.arrowShape[1] = args.value['shape'];
|
|
283
|
+
}
|
|
284
|
+
break;
|
|
285
|
+
case 'updateNWPoints':
|
|
286
|
+
this.updateNWPoints(args.value['x'], args.value['y']);
|
|
287
|
+
break;
|
|
288
|
+
case 'updateNPoints':
|
|
289
|
+
this.updateNPoints(args.value['x'], args.value['y']);
|
|
290
|
+
break;
|
|
291
|
+
case 'updateNEPoints':
|
|
292
|
+
this.updateNEPoints(args.value['x'], args.value['y']);
|
|
293
|
+
break;
|
|
294
|
+
case 'updateWPoints':
|
|
295
|
+
this.updateWPoints(args.value['x'], args.value['y']);
|
|
296
|
+
break;
|
|
297
|
+
case 'updateEPoints':
|
|
298
|
+
this.updateEPoints(args.value['x'], args.value['y']);
|
|
299
|
+
break;
|
|
300
|
+
case 'updateSWPoints':
|
|
301
|
+
this.updateSWPoints(args.value['x'], args.value['y']);
|
|
302
|
+
break;
|
|
303
|
+
case 'updateSPoints':
|
|
304
|
+
this.updateSPoints(args.value['x'], args.value['y']);
|
|
305
|
+
break;
|
|
306
|
+
case 'updateSEPoints':
|
|
307
|
+
this.updateSEPoints(args.value['x'], args.value['y']);
|
|
308
|
+
break;
|
|
287
309
|
}
|
|
288
310
|
};
|
|
289
311
|
Selection.prototype.getModuleName = function () {
|
|
@@ -304,7 +326,7 @@ var Selection = /** @class */ (function () {
|
|
|
304
326
|
this.isTouch = this.isObjSelected = this.isFhdPoint = this.isShapeInserted = false;
|
|
305
327
|
this.dragPoint = { startX: 0, startY: 0, endX: 0, endY: 0 };
|
|
306
328
|
this.tempActiveObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
|
|
307
|
-
flipObjColl: [], triangle: [], triangleRatio: [] };
|
|
329
|
+
flipObjColl: [], triangle: [], triangleRatio: [], order: null };
|
|
308
330
|
this.isFirstMove = false;
|
|
309
331
|
this.cursorTargetId = this.dragElement = '';
|
|
310
332
|
this.startTouches = [];
|
|
@@ -332,6 +354,7 @@ var Selection = /** @class */ (function () {
|
|
|
332
354
|
this.resizedElement = '';
|
|
333
355
|
this.mouseDown = '';
|
|
334
356
|
this.isSliderActive = false;
|
|
357
|
+
this.arrowShape = [ArrowheadType.None, ArrowheadType.SolidArrow];
|
|
335
358
|
};
|
|
336
359
|
Selection.prototype.performTabAction = function () {
|
|
337
360
|
var parent = this.parent;
|
|
@@ -425,6 +448,7 @@ var Selection = /** @class */ (function () {
|
|
|
425
448
|
};
|
|
426
449
|
Selection.prototype.setCursor = function (x, y) {
|
|
427
450
|
var parent = this.parent;
|
|
451
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
428
452
|
var frameObject = { bool: null };
|
|
429
453
|
parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObject } });
|
|
430
454
|
if (parent.isResize || this.isSliding || frameObject['bool']) {
|
|
@@ -433,10 +457,6 @@ var Selection = /** @class */ (function () {
|
|
|
433
457
|
}
|
|
434
458
|
var isCropSelection = false;
|
|
435
459
|
var splitWords;
|
|
436
|
-
if (this.currentDrawingShape !== '') {
|
|
437
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
460
|
if (parent.currObjType.isDragging) {
|
|
441
461
|
if (this.dragElement === '') {
|
|
442
462
|
parent.upperCanvas.style.cursor = parent.cursor = 'move';
|
|
@@ -446,6 +466,91 @@ var Selection = /** @class */ (function () {
|
|
|
446
466
|
}
|
|
447
467
|
return;
|
|
448
468
|
}
|
|
469
|
+
if (parent.togglePen) {
|
|
470
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (parent.activeObj.shape) {
|
|
474
|
+
this.setCursorForActObj(splitWords, isCropSelection, x, y);
|
|
475
|
+
}
|
|
476
|
+
if (parent.cursor === 'default' || parent.cursor === 'grab') {
|
|
477
|
+
var highestOrder = this.getHighestOrder();
|
|
478
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
479
|
+
var tempShapeColl = extend([], parent.shapeColl, [], true);
|
|
480
|
+
var objColl = extend([], parent.objColl, [], true);
|
|
481
|
+
var isShape = false;
|
|
482
|
+
while (highestOrder > 0) {
|
|
483
|
+
isShape = false;
|
|
484
|
+
for (var i = tempShapeColl.length - 1; i >= 0; i--) {
|
|
485
|
+
if (tempShapeColl[i].order === highestOrder) {
|
|
486
|
+
isShape = true;
|
|
487
|
+
if (tempShapeColl[i].id && tempShapeColl[i].id.indexOf('pen') > -1) {
|
|
488
|
+
if (parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
|
|
489
|
+
&& !parent.currObjType.isDragging && !parent.currObjType.isResize) {
|
|
490
|
+
var points = extend([], parent.points, [], true);
|
|
491
|
+
if (!isCropSelection) {
|
|
492
|
+
this.setCursorForFreehandDrawing(x, y, parent.upperCanvas, tempShapeColl[i].id);
|
|
493
|
+
}
|
|
494
|
+
parent.points = points;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
parent.objColl = [];
|
|
499
|
+
parent.objColl.push(extend({}, tempShapeColl[i], null, true));
|
|
500
|
+
var cursor = parent.upperCanvas.style.cursor;
|
|
501
|
+
if (parent.objColl.length > 0 && (parent.cursor !== 'grab' || !isCropSelection)) {
|
|
502
|
+
this.setCursorFromObj(x, y, parent.objColl, parent.upperCanvas, isCropSelection);
|
|
503
|
+
}
|
|
504
|
+
if (cursor === 'grab' && parent.cursor === 'default') {
|
|
505
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'grab';
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else if (isNullOrUndefined(tempShapeColl[i].order)) {
|
|
510
|
+
isShape = true;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (parent.cursor !== 'default' && parent.cursor !== 'grab') {
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
else if (isShape) {
|
|
517
|
+
var isBreak = false;
|
|
518
|
+
while (!isBreak && highestOrder > 0) {
|
|
519
|
+
for (var a = 0; a < tempShapeColl.length; a++) {
|
|
520
|
+
if (tempShapeColl[a].order === highestOrder - 1) {
|
|
521
|
+
isBreak = true;
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
highestOrder--;
|
|
526
|
+
if (!isBreak) {
|
|
527
|
+
highestOrder--;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
parent.objColl = objColl;
|
|
533
|
+
if (parent.cursor === 'default' || parent.cursor === 'grab') {
|
|
534
|
+
if (parent.togglePan) {
|
|
535
|
+
parent.lowerCanvas.style.cursor = parent.upperCanvas.style.cursor = parent.cursor = 'grab';
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (this.currentDrawingShape !== '' && (parent.cursor === 'default' || parent.cursor === 'grab')) {
|
|
540
|
+
parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
Selection.prototype.getHighestOrder = function () {
|
|
544
|
+
var highestOrder = 0;
|
|
545
|
+
for (var i = 0; i < this.parent.shapeColl.length; i++) {
|
|
546
|
+
if (this.parent.shapeColl[i].order > highestOrder) {
|
|
547
|
+
highestOrder = this.parent.shapeColl[i].order;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return highestOrder;
|
|
551
|
+
};
|
|
552
|
+
Selection.prototype.setCursorForActObj = function (splitWords, isCropSelection, x, y) {
|
|
553
|
+
var parent = this.parent;
|
|
449
554
|
if (parent.activeObj.horTopLine !== undefined) {
|
|
450
555
|
if (parent.activeObj.shape !== undefined) {
|
|
451
556
|
splitWords = parent.activeObj.shape.split('-');
|
|
@@ -506,20 +611,6 @@ var Selection = /** @class */ (function () {
|
|
|
506
611
|
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
507
612
|
}
|
|
508
613
|
}
|
|
509
|
-
if (parent.cursor === 'default' || parent.cursor === 'grab') {
|
|
510
|
-
var cursor = parent.upperCanvas.style.cursor;
|
|
511
|
-
if (parent.objColl.length > 0 && (parent.cursor !== 'grab' || !isCropSelection)) {
|
|
512
|
-
this.setCursorFromObj(x, y, parent.objColl, parent.upperCanvas, isCropSelection);
|
|
513
|
-
}
|
|
514
|
-
if (cursor === 'grab' && parent.cursor === 'default') {
|
|
515
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'grab';
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
if ((parent.cursor === 'default' || parent.cursor === 'grab')
|
|
519
|
-
&& parent.pointColl[0] && (parent.cursor !== 'grab' || !isCropSelection)
|
|
520
|
-
&& !parent.currObjType.isDragging && !parent.currObjType.isResize) {
|
|
521
|
-
this.setCursorForFreehandDrawing(x, y, parent.upperCanvas);
|
|
522
|
-
}
|
|
523
614
|
};
|
|
524
615
|
Selection.prototype.setCursorForPath = function (actObj, x, y, upperCanvas) {
|
|
525
616
|
this.setCursorForLineArrow(actObj, x, y, upperCanvas);
|
|
@@ -563,6 +654,9 @@ var Selection = /** @class */ (function () {
|
|
|
563
654
|
Selection.prototype.setCursorForLineArrow = function (actObj, x, y, upperCanvas) {
|
|
564
655
|
var index;
|
|
565
656
|
var radius = actObj.topLeftCircle.radius;
|
|
657
|
+
if (isNullOrUndefined(actObj.pointColl)) {
|
|
658
|
+
return index;
|
|
659
|
+
}
|
|
566
660
|
for (var i = 0, len = actObj.pointColl.length; i < len; i++) {
|
|
567
661
|
var point = actObj.pointColl[i];
|
|
568
662
|
if (x >= (point.x - (radius * 2)) && x <= (point.x + (radius * 2)) &&
|
|
@@ -755,7 +849,7 @@ var Selection = /** @class */ (function () {
|
|
|
755
849
|
}
|
|
756
850
|
return element;
|
|
757
851
|
};
|
|
758
|
-
Selection.prototype.setCursorForFreehandDrawing = function (x, y, upperCanvas) {
|
|
852
|
+
Selection.prototype.setCursorForFreehandDrawing = function (x, y, upperCanvas, id) {
|
|
759
853
|
var upperContext = upperCanvas.getContext('2d');
|
|
760
854
|
var parent = this.parent;
|
|
761
855
|
var textArea = document.querySelector('#' + parent.element.id + '_textArea');
|
|
@@ -764,6 +858,9 @@ var Selection = /** @class */ (function () {
|
|
|
764
858
|
value: { index: -1 } });
|
|
765
859
|
var sPoints;
|
|
766
860
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
861
|
+
if (id && id !== parent.pointColl[n].id) {
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
767
864
|
var obj = { selPointColl: {} };
|
|
768
865
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: obj } });
|
|
769
866
|
sPoints = extend([], obj['selPointColl'][n].points, []);
|
|
@@ -796,9 +893,12 @@ var Selection = /** @class */ (function () {
|
|
|
796
893
|
}
|
|
797
894
|
}
|
|
798
895
|
if (this.isFhdEditing) {
|
|
799
|
-
var
|
|
896
|
+
var indexObj = { freehandSelectedIndex: -1 };
|
|
897
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
898
|
+
var strokeColor = parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
|
|
899
|
+
var strokeWidth = parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth;
|
|
800
900
|
parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
801
|
-
value: { strokeColor: strokeColor, strokeWidth:
|
|
901
|
+
value: { strokeColor: strokeColor, strokeWidth: strokeWidth } });
|
|
802
902
|
}
|
|
803
903
|
else {
|
|
804
904
|
parent.notify('freehand-draw', { prop: 'setFreehandDrawHoveredIndex', onPropertyChange: false,
|
|
@@ -826,9 +926,12 @@ var Selection = /** @class */ (function () {
|
|
|
826
926
|
}
|
|
827
927
|
}
|
|
828
928
|
if (this.isFhdEditing) {
|
|
829
|
-
var
|
|
929
|
+
var indexObj = { freehandSelectedIndex: -1 };
|
|
930
|
+
parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
931
|
+
var strokeColor = parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
|
|
932
|
+
var strokeWidth = parent.pointColl[indexObj['freehandSelectedIndex']].strokeWidth;
|
|
830
933
|
parent.notify('freehand-draw', { prop: 'hoverFhd', onPropertyChange: false,
|
|
831
|
-
value: { strokeColor: strokeColor, strokeWidth:
|
|
934
|
+
value: { strokeColor: strokeColor, strokeWidth: strokeWidth } });
|
|
832
935
|
}
|
|
833
936
|
this.isFhdPoint = false;
|
|
834
937
|
}
|
|
@@ -880,7 +983,6 @@ var Selection = /** @class */ (function () {
|
|
|
880
983
|
var _b = parent.activeObj.activePoint, width = _b.width, height = _b.height;
|
|
881
984
|
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
882
985
|
value: { width: width, height: height, obj: obj, isImgShape: null } });
|
|
883
|
-
var maxDimension = obj;
|
|
884
986
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
885
987
|
var shapeResizingArgs = { cancel: false, action: 'resize', previousShapeSettings: previousShapeSettings };
|
|
886
988
|
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
|
|
@@ -890,7 +992,7 @@ var Selection = /** @class */ (function () {
|
|
|
890
992
|
parent.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
|
|
891
993
|
value: { obj: parent.activeObj, isTextArea: null } });
|
|
892
994
|
}
|
|
893
|
-
if (this.currentDrawingShape !== '' && (this.dragElement === '' || this.dragElement === 'move')) {
|
|
995
|
+
if (this.currentDrawingShape !== '' && (this.dragElement === '' || this.dragElement === 'move') && parent.isShapeDrawing) {
|
|
894
996
|
var shapeColl = ['line', 'arrow', 'path'];
|
|
895
997
|
if (shapeColl.indexOf(parent.activeObj.shape) > -1) {
|
|
896
998
|
this.dragElement = 'e-resize';
|
|
@@ -926,7 +1028,7 @@ var Selection = /** @class */ (function () {
|
|
|
926
1028
|
}
|
|
927
1029
|
switch (this.dragElement.toLowerCase()) {
|
|
928
1030
|
case 'nw-resize':
|
|
929
|
-
this.updateNWPoints(x, y
|
|
1031
|
+
this.updateNWPoints(x, y);
|
|
930
1032
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
931
1033
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
932
1034
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
@@ -938,7 +1040,7 @@ var Selection = /** @class */ (function () {
|
|
|
938
1040
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
939
1041
|
break;
|
|
940
1042
|
case 'ne-resize':
|
|
941
|
-
this.updateNEPoints(x, y
|
|
1043
|
+
this.updateNEPoints(x, y);
|
|
942
1044
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
943
1045
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
944
1046
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
@@ -956,7 +1058,7 @@ var Selection = /** @class */ (function () {
|
|
|
956
1058
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
957
1059
|
break;
|
|
958
1060
|
case 'sw-resize':
|
|
959
|
-
this.updateSWPoints(x, y
|
|
1061
|
+
this.updateSWPoints(x, y);
|
|
960
1062
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
961
1063
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
962
1064
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
@@ -968,7 +1070,7 @@ var Selection = /** @class */ (function () {
|
|
|
968
1070
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
969
1071
|
break;
|
|
970
1072
|
case 'se-resize':
|
|
971
|
-
this.updateSEPoints(x, y
|
|
1073
|
+
this.updateSEPoints(x, y);
|
|
972
1074
|
parent.notify('shape', { prop: 'updateArrowDirection', onPropertyChange: false,
|
|
973
1075
|
value: { obj: parent.activeObj, flip: null, rotatedDegree: null } });
|
|
974
1076
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'resize');
|
|
@@ -1108,10 +1210,11 @@ var Selection = /** @class */ (function () {
|
|
|
1108
1210
|
this.isCropSelection = true;
|
|
1109
1211
|
}
|
|
1110
1212
|
if (!this.isCropSelection) {
|
|
1111
|
-
if (this.currentDrawingShape !== '') {
|
|
1213
|
+
if (this.currentDrawingShape !== '' && parent.upperCanvas.style.cursor === 'crosshair') {
|
|
1112
1214
|
shapeResizingArgs.action = 'drawing';
|
|
1113
1215
|
}
|
|
1114
1216
|
parent.trigger('shapeChanging', shapeResizingArgs);
|
|
1217
|
+
this.isPreventShaping = shapeResizingArgs.cancel;
|
|
1115
1218
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1116
1219
|
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
1117
1220
|
}
|
|
@@ -1135,11 +1238,13 @@ var Selection = /** @class */ (function () {
|
|
|
1135
1238
|
}
|
|
1136
1239
|
else if (type === 'mouse-down' || type === 'mouse-up') {
|
|
1137
1240
|
parent.trigger('shapeChanging', shapeResizingArgs);
|
|
1241
|
+
this.isPreventShaping = shapeResizingArgs.cancel;
|
|
1138
1242
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1139
1243
|
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
1140
1244
|
}
|
|
1141
1245
|
else {
|
|
1142
1246
|
parent.trigger('shapeChanging', shapeMovingArgs);
|
|
1247
|
+
this.isPreventShaping = shapeResizingArgs.cancel;
|
|
1143
1248
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
1144
1249
|
value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
|
|
1145
1250
|
}
|
|
@@ -1352,7 +1457,78 @@ var Selection = /** @class */ (function () {
|
|
|
1352
1457
|
actPoint.endY = tempActiveObj.activePoint.endY;
|
|
1353
1458
|
}
|
|
1354
1459
|
};
|
|
1355
|
-
Selection.prototype.
|
|
1460
|
+
Selection.prototype.performSEResize = function (x, y, tempActiveObj, actPoint) {
|
|
1461
|
+
var parent = this.parent;
|
|
1462
|
+
this.resizeImg(x, y, 'se-resize', tempActiveObj);
|
|
1463
|
+
if (actPoint.endX < actPoint.startX) {
|
|
1464
|
+
var temp = actPoint.endX;
|
|
1465
|
+
actPoint.endX = actPoint.startX;
|
|
1466
|
+
actPoint.startX = temp;
|
|
1467
|
+
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'sw-resize';
|
|
1468
|
+
}
|
|
1469
|
+
if (actPoint.endY < actPoint.startY) {
|
|
1470
|
+
var temp = actPoint.endY;
|
|
1471
|
+
actPoint.endY = actPoint.startY;
|
|
1472
|
+
actPoint.startY = temp;
|
|
1473
|
+
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'ne-resize';
|
|
1474
|
+
}
|
|
1475
|
+
this.revertCustomSelection(actPoint, tempActiveObj, 'se-resize');
|
|
1476
|
+
this.revertResizing(tempActiveObj);
|
|
1477
|
+
};
|
|
1478
|
+
Selection.prototype.performNWResize = function (x, y, tempActiveObj, actPoint) {
|
|
1479
|
+
var parent = this.parent;
|
|
1480
|
+
this.resizeImg(x, y, 'nw-resize', tempActiveObj);
|
|
1481
|
+
if (actPoint.startX > actPoint.endX) {
|
|
1482
|
+
var temp = actPoint.startX;
|
|
1483
|
+
actPoint.startX = actPoint.endX;
|
|
1484
|
+
actPoint.endX = temp;
|
|
1485
|
+
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'ne-resize';
|
|
1486
|
+
}
|
|
1487
|
+
if (actPoint.startY > actPoint.endY) {
|
|
1488
|
+
var temp = actPoint.startY;
|
|
1489
|
+
actPoint.startY = actPoint.endY;
|
|
1490
|
+
actPoint.endY = temp;
|
|
1491
|
+
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'sw-resize';
|
|
1492
|
+
}
|
|
1493
|
+
this.revertCustomSelection(actPoint, tempActiveObj, 'nw-resize');
|
|
1494
|
+
this.revertResizing(tempActiveObj);
|
|
1495
|
+
};
|
|
1496
|
+
Selection.prototype.isCustomSelection = function () {
|
|
1497
|
+
if (this.parent.activeObj.shape) {
|
|
1498
|
+
var shapeColl = ['custom', 'circle', 'square', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '5:7', '7:5', '9:16', '16:9'];
|
|
1499
|
+
return this.parent.activeObj.shape.indexOf('crop-') > -1 && shapeColl.indexOf(this.parent.activeObj.shape.split('-')[1]) === -1;
|
|
1500
|
+
}
|
|
1501
|
+
return false;
|
|
1502
|
+
};
|
|
1503
|
+
Selection.prototype.revertCustomSelection = function (actPoint, tempActiveObj, type) {
|
|
1504
|
+
var parent = this.parent;
|
|
1505
|
+
if (this.isCustomSelection()) {
|
|
1506
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
1507
|
+
var endX = destLeft + destWidth < parent.lowerCanvas.width ?
|
|
1508
|
+
destLeft + destWidth : parent.lowerCanvas.width;
|
|
1509
|
+
var endY = destTop + destHeight < parent.lowerCanvas.height ?
|
|
1510
|
+
destTop + destHeight : parent.lowerCanvas.height;
|
|
1511
|
+
var left = destLeft > 0 ? destLeft : 0;
|
|
1512
|
+
var top_1 = destTop > 0 ? destTop : 0;
|
|
1513
|
+
var endY1 = destTop > 0 ? destTop : 0;
|
|
1514
|
+
var endX1 = destLeft > 0 ? destLeft : 0;
|
|
1515
|
+
if ((type === 'se-resize' && (actPoint.endX > endX || actPoint.endY > endY)) ||
|
|
1516
|
+
(type === 'nw-resize' && (actPoint.startX < left || actPoint.startY < top_1)) ||
|
|
1517
|
+
(type === 'ne-resize' && (actPoint.endX > endX || actPoint.startY < endY1)) ||
|
|
1518
|
+
(type === 'sw-resize' && (actPoint.startX < endX1 || actPoint.endY > endY))) {
|
|
1519
|
+
this.revertPoints(actPoint, tempActiveObj);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
Selection.prototype.revertPoints = function (actPoint, tempActiveObj) {
|
|
1524
|
+
actPoint.startX = tempActiveObj.activePoint.startX;
|
|
1525
|
+
actPoint.startY = tempActiveObj.activePoint.startY;
|
|
1526
|
+
actPoint.endX = tempActiveObj.activePoint.endX;
|
|
1527
|
+
actPoint.endY = tempActiveObj.activePoint.endY;
|
|
1528
|
+
actPoint.width = tempActiveObj.activePoint.width;
|
|
1529
|
+
actPoint.height = tempActiveObj.activePoint.height;
|
|
1530
|
+
};
|
|
1531
|
+
Selection.prototype.updateNWPoints = function (x, y) {
|
|
1356
1532
|
var parent = this.parent;
|
|
1357
1533
|
var actPoint = parent.activeObj.activePoint;
|
|
1358
1534
|
var width;
|
|
@@ -1369,8 +1545,9 @@ var Selection = /** @class */ (function () {
|
|
|
1369
1545
|
if (parent.activeObj.shape !== undefined) {
|
|
1370
1546
|
splitWords = parent.activeObj.shape.split('-');
|
|
1371
1547
|
}
|
|
1372
|
-
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1373
|
-
|
|
1548
|
+
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1549
|
+
|| this.isCustomSelection()) {
|
|
1550
|
+
if (parent.activeObj.shape === 'image' || this.isCustomSelection()) {
|
|
1374
1551
|
this.resizeImg(x, y, 'nw-resize', tempActiveObj);
|
|
1375
1552
|
}
|
|
1376
1553
|
else {
|
|
@@ -1388,10 +1565,11 @@ var Selection = /** @class */ (function () {
|
|
|
1388
1565
|
actPoint.endY = temp;
|
|
1389
1566
|
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'sw-resize';
|
|
1390
1567
|
}
|
|
1568
|
+
this.revertCustomSelection(actPoint, tempActiveObj, 'nw-resize');
|
|
1391
1569
|
this.revertResizing(tempActiveObj);
|
|
1392
1570
|
}
|
|
1393
1571
|
else {
|
|
1394
|
-
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop
|
|
1572
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop;
|
|
1395
1573
|
if (actPoint.startX < x && actPoint.startY < y) {
|
|
1396
1574
|
width = x - actPoint.startX;
|
|
1397
1575
|
height = y - actPoint.startY;
|
|
@@ -1400,8 +1578,8 @@ var Selection = /** @class */ (function () {
|
|
|
1400
1578
|
actPoint.startX += newScale.x;
|
|
1401
1579
|
actPoint.startY += newScale.y;
|
|
1402
1580
|
var left = destLeft > 0 ? destLeft : 0;
|
|
1403
|
-
var
|
|
1404
|
-
if (actPoint.startX < left || actPoint.startY <
|
|
1581
|
+
var top_2 = destTop > 0 ? destTop : 0;
|
|
1582
|
+
if (actPoint.startX < left || actPoint.startY < top_2) {
|
|
1405
1583
|
actPoint.startX -= newScale.x;
|
|
1406
1584
|
actPoint.startY -= newScale.y;
|
|
1407
1585
|
}
|
|
@@ -1414,8 +1592,8 @@ var Selection = /** @class */ (function () {
|
|
|
1414
1592
|
actPoint.startX -= newScale.x;
|
|
1415
1593
|
actPoint.startY -= newScale.y;
|
|
1416
1594
|
var left = destLeft > 0 ? destLeft : 0;
|
|
1417
|
-
var
|
|
1418
|
-
if (actPoint.startX < left || actPoint.startY <
|
|
1595
|
+
var top_3 = destTop > 0 ? destTop : 0;
|
|
1596
|
+
if (actPoint.startX < left || actPoint.startY < top_3) {
|
|
1419
1597
|
actPoint.startX += newScale.x;
|
|
1420
1598
|
actPoint.startY += newScale.y;
|
|
1421
1599
|
}
|
|
@@ -1467,8 +1645,11 @@ var Selection = /** @class */ (function () {
|
|
|
1467
1645
|
this.revertResizing(tempActiveObj);
|
|
1468
1646
|
}
|
|
1469
1647
|
else {
|
|
1470
|
-
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth
|
|
1471
|
-
if (
|
|
1648
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth;
|
|
1649
|
+
if (this.isCustomSelection()) {
|
|
1650
|
+
this.performNWResize(x, y, tempActiveObj, actPoint);
|
|
1651
|
+
}
|
|
1652
|
+
else if (actPoint.endX > x && actPoint.startY < y) {
|
|
1472
1653
|
width = actPoint.endX - x;
|
|
1473
1654
|
height = y - actPoint.startY;
|
|
1474
1655
|
scale = Math.min(width, height);
|
|
@@ -1500,7 +1681,7 @@ var Selection = /** @class */ (function () {
|
|
|
1500
1681
|
}
|
|
1501
1682
|
}
|
|
1502
1683
|
};
|
|
1503
|
-
Selection.prototype.updateNEPoints = function (x, y
|
|
1684
|
+
Selection.prototype.updateNEPoints = function (x, y) {
|
|
1504
1685
|
var parent = this.parent;
|
|
1505
1686
|
var actPoint = parent.activeObj.activePoint;
|
|
1506
1687
|
var width;
|
|
@@ -1517,8 +1698,9 @@ var Selection = /** @class */ (function () {
|
|
|
1517
1698
|
if (parent.activeObj.shape) {
|
|
1518
1699
|
splitWords = parent.activeObj.shape.split('-');
|
|
1519
1700
|
}
|
|
1520
|
-
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1521
|
-
|
|
1701
|
+
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1702
|
+
|| this.isCustomSelection()) {
|
|
1703
|
+
if (parent.activeObj.shape === 'image' || this.isCustomSelection()) {
|
|
1522
1704
|
this.resizeImg(x, y, 'ne-resize', tempActiveObj);
|
|
1523
1705
|
}
|
|
1524
1706
|
else {
|
|
@@ -1536,10 +1718,11 @@ var Selection = /** @class */ (function () {
|
|
|
1536
1718
|
actPoint.endY = temp;
|
|
1537
1719
|
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'se-resize';
|
|
1538
1720
|
}
|
|
1721
|
+
this.revertCustomSelection(actPoint, tempActiveObj, 'ne-resize');
|
|
1539
1722
|
this.revertResizing(tempActiveObj);
|
|
1540
1723
|
}
|
|
1541
1724
|
else {
|
|
1542
|
-
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth
|
|
1725
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth;
|
|
1543
1726
|
if (actPoint.endX > x && actPoint.startY < y) {
|
|
1544
1727
|
width = actPoint.endX - x;
|
|
1545
1728
|
height = y - actPoint.startY;
|
|
@@ -1630,8 +1813,11 @@ var Selection = /** @class */ (function () {
|
|
|
1630
1813
|
this.revertResizing(tempActiveObj);
|
|
1631
1814
|
}
|
|
1632
1815
|
else {
|
|
1633
|
-
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop,
|
|
1634
|
-
if (
|
|
1816
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destHeight = _a.destHeight;
|
|
1817
|
+
if (this.isCustomSelection()) {
|
|
1818
|
+
this.performNWResize(x, y, tempActiveObj, actPoint);
|
|
1819
|
+
}
|
|
1820
|
+
else if (actPoint.startX < x && actPoint.endY > y) {
|
|
1635
1821
|
width = x - actPoint.startX;
|
|
1636
1822
|
height = actPoint.endY - y;
|
|
1637
1823
|
scale = Math.min(width, height);
|
|
@@ -1715,7 +1901,10 @@ var Selection = /** @class */ (function () {
|
|
|
1715
1901
|
}
|
|
1716
1902
|
else {
|
|
1717
1903
|
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
1718
|
-
if (
|
|
1904
|
+
if (this.isCustomSelection()) {
|
|
1905
|
+
this.performSEResize(x, y, tempActiveObj, actPoint);
|
|
1906
|
+
}
|
|
1907
|
+
else if (actPoint.endX > x && actPoint.endY > y) {
|
|
1719
1908
|
width = actPoint.endX - x;
|
|
1720
1909
|
height = actPoint.endY - y;
|
|
1721
1910
|
scale = Math.min(width, height);
|
|
@@ -1747,7 +1936,7 @@ var Selection = /** @class */ (function () {
|
|
|
1747
1936
|
}
|
|
1748
1937
|
}
|
|
1749
1938
|
};
|
|
1750
|
-
Selection.prototype.updateSWPoints = function (x, y
|
|
1939
|
+
Selection.prototype.updateSWPoints = function (x, y) {
|
|
1751
1940
|
var parent = this.parent;
|
|
1752
1941
|
var actPoint = parent.activeObj.activePoint;
|
|
1753
1942
|
var width;
|
|
@@ -1764,8 +1953,9 @@ var Selection = /** @class */ (function () {
|
|
|
1764
1953
|
if (parent.activeObj.shape !== undefined) {
|
|
1765
1954
|
splitWords = parent.activeObj.shape.split('-');
|
|
1766
1955
|
}
|
|
1767
|
-
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1768
|
-
|
|
1956
|
+
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1957
|
+
|| this.isCustomSelection()) {
|
|
1958
|
+
if (parent.activeObj.shape === 'image' || this.isCustomSelection()) {
|
|
1769
1959
|
this.resizeImg(x, y, 'sw-resize', tempActiveObj);
|
|
1770
1960
|
}
|
|
1771
1961
|
else {
|
|
@@ -1783,10 +1973,11 @@ var Selection = /** @class */ (function () {
|
|
|
1783
1973
|
actPoint.startY = temp;
|
|
1784
1974
|
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'nw-resize';
|
|
1785
1975
|
}
|
|
1976
|
+
this.revertCustomSelection(actPoint, tempActiveObj, 'sw-resize');
|
|
1786
1977
|
this.revertResizing(tempActiveObj);
|
|
1787
1978
|
}
|
|
1788
1979
|
else {
|
|
1789
|
-
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop,
|
|
1980
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destHeight = _a.destHeight;
|
|
1790
1981
|
if (actPoint.startX < x && actPoint.endY > y) {
|
|
1791
1982
|
width = x - actPoint.startX;
|
|
1792
1983
|
height = actPoint.endY - y;
|
|
@@ -1865,7 +2056,10 @@ var Selection = /** @class */ (function () {
|
|
|
1865
2056
|
}
|
|
1866
2057
|
else {
|
|
1867
2058
|
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
1868
|
-
if (
|
|
2059
|
+
if (this.isCustomSelection()) {
|
|
2060
|
+
this.performSEResize(x, y, tempActiveObj, actPoint);
|
|
2061
|
+
}
|
|
2062
|
+
else if (actPoint.endX > x && actPoint.endY > y) {
|
|
1869
2063
|
width = actPoint.endX - x;
|
|
1870
2064
|
height = actPoint.endY - y;
|
|
1871
2065
|
scale = Math.min(width, height);
|
|
@@ -1897,7 +2091,7 @@ var Selection = /** @class */ (function () {
|
|
|
1897
2091
|
}
|
|
1898
2092
|
}
|
|
1899
2093
|
};
|
|
1900
|
-
Selection.prototype.updateSEPoints = function (x, y
|
|
2094
|
+
Selection.prototype.updateSEPoints = function (x, y) {
|
|
1901
2095
|
var parent = this.parent;
|
|
1902
2096
|
var actPoint = parent.activeObj.activePoint;
|
|
1903
2097
|
var width;
|
|
@@ -1915,8 +2109,9 @@ var Selection = /** @class */ (function () {
|
|
|
1915
2109
|
if (parent.activeObj.shape !== undefined) {
|
|
1916
2110
|
splitWords = parent.activeObj.shape.split('-');
|
|
1917
2111
|
}
|
|
1918
|
-
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
1919
|
-
|
|
2112
|
+
if (parent.activeObj.shape === 'crop-custom' || (parent.activeObj.shape !== undefined && splitWords[0] !== 'crop')
|
|
2113
|
+
|| this.isCustomSelection()) {
|
|
2114
|
+
if (parent.activeObj.shape === 'image' || this.isCustomSelection()) {
|
|
1920
2115
|
this.resizeImg(x, y, 'se-resize', tempActiveObj);
|
|
1921
2116
|
}
|
|
1922
2117
|
else {
|
|
@@ -1934,6 +2129,7 @@ var Selection = /** @class */ (function () {
|
|
|
1934
2129
|
actPoint.startY = temp;
|
|
1935
2130
|
this.dragElement = parent.upperCanvas.style.cursor = parent.cursor = 'ne-resize';
|
|
1936
2131
|
}
|
|
2132
|
+
this.revertCustomSelection(actPoint, tempActiveObj, 'se-resize');
|
|
1937
2133
|
this.revertResizing(tempActiveObj);
|
|
1938
2134
|
}
|
|
1939
2135
|
else {
|
|
@@ -1985,6 +2181,26 @@ var Selection = /** @class */ (function () {
|
|
|
1985
2181
|
var scale;
|
|
1986
2182
|
var newScale;
|
|
1987
2183
|
if (this.previousPoint.x !== 0 && this.previousPoint.y !== 0) {
|
|
2184
|
+
if (this.currentDrawingShape === 'text') {
|
|
2185
|
+
this.setCursor(x, y);
|
|
2186
|
+
if (parent.activeObj.textSettings.fontSize === 0) {
|
|
2187
|
+
parent.activeObj.textSettings.fontSize = 11;
|
|
2188
|
+
parent.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
|
|
2189
|
+
value: { obj: parent.activeObj, isTextArea: null } });
|
|
2190
|
+
parent.activeObj.textSettings.text = parent.activeObj.keyHistory = 'Enter Text';
|
|
2191
|
+
parent.notify('shape', { prop: 'updateFontStyles', onPropertyChange: false,
|
|
2192
|
+
value: { isTextBox: null } });
|
|
2193
|
+
var width_2 = this.upperContext.measureText(parent.activeObj.textSettings.text).width +
|
|
2194
|
+
parent.activeObj.textSettings.fontSize * 0.5;
|
|
2195
|
+
actPoint.endX = actPoint.startX + width_2;
|
|
2196
|
+
actPoint.endY = actPoint.startY + parent.activeObj.textSettings.fontSize;
|
|
2197
|
+
actPoint.width = actPoint.endX - actPoint.startX;
|
|
2198
|
+
actPoint.height = actPoint.endY - actPoint.startY;
|
|
2199
|
+
tempActiveObj = extend({}, parent.activeObj, null, true);
|
|
2200
|
+
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: parent.activeObj.activePoint, obj: parent.activeObj,
|
|
2201
|
+
isMouseMove: null, x: null, y: null } });
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
1988
2204
|
switch (parent.upperCanvas.style.cursor) {
|
|
1989
2205
|
case 'se-resize':
|
|
1990
2206
|
case 's-resize':
|
|
@@ -2733,6 +2949,15 @@ var Selection = /** @class */ (function () {
|
|
|
2733
2949
|
if (this.isCropSelection) {
|
|
2734
2950
|
this.dragCanvas = parent.togglePan = true;
|
|
2735
2951
|
}
|
|
2952
|
+
if (parent.cursor === 'grabbing') {
|
|
2953
|
+
var obj = { shapeSettingsObj: {} };
|
|
2954
|
+
this.isGrabbing = true;
|
|
2955
|
+
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
2956
|
+
var shapeSettings = obj['shapeSettingsObj'];
|
|
2957
|
+
var shapeResizingArgs = { cancel: false, action: 'rotate-start', previousShapeSettings: shapeSettings };
|
|
2958
|
+
var shapeMovingArgs = { cancel: false, action: 'rotate-start', previousShapeSettings: shapeSettings };
|
|
2959
|
+
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
2960
|
+
}
|
|
2736
2961
|
var imageEditorClickEventArgs = { point: this.setXYPoints(e) };
|
|
2737
2962
|
parent.trigger('click', imageEditorClickEventArgs);
|
|
2738
2963
|
this.clickEvent(imageEditorClickEventArgs, e);
|
|
@@ -2769,7 +2994,13 @@ var Selection = /** @class */ (function () {
|
|
|
2769
2994
|
else if (JSON.stringify(parent.frameObj) !== JSON.stringify(parent.tempFrameObj)) {
|
|
2770
2995
|
parent.okBtn();
|
|
2771
2996
|
}
|
|
2772
|
-
else if (this.currentDrawingShape !== '')
|
|
2997
|
+
else if (this.currentDrawingShape !== '' && ((this.isTouch && !this.isShapeTouch(e, this.isCropSelection))
|
|
2998
|
+
|| parent.upperCanvas.style.cursor === 'crosshair' || parent.isShapeDrawing)) {
|
|
2999
|
+
if (parent.drawingShape && !parent.isShapeDrawing) {
|
|
3000
|
+
parent.okBtn();
|
|
3001
|
+
parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
|
|
3002
|
+
}
|
|
3003
|
+
activePoint = parent.activeObj.activePoint;
|
|
2773
3004
|
var object_1 = { currObj: {} };
|
|
2774
3005
|
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object_1 } });
|
|
2775
3006
|
this.initialPrevObj = object_1['currObj'];
|
|
@@ -2781,6 +3012,7 @@ var Selection = /** @class */ (function () {
|
|
|
2781
3012
|
value: { obj: selPointCollObj } });
|
|
2782
3013
|
this.initialPrevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
2783
3014
|
this.setActivePoint(x, y);
|
|
3015
|
+
activePoint = parent.activeObj.activePoint;
|
|
2784
3016
|
if (this.currentDrawingShape === 'path') {
|
|
2785
3017
|
var point = this.getImagePoints(x, y);
|
|
2786
3018
|
parent.activeObj.pointColl.push({ x: point.x, y: point.y });
|
|
@@ -2793,6 +3025,22 @@ var Selection = /** @class */ (function () {
|
|
|
2793
3025
|
}
|
|
2794
3026
|
activePoint.endX = activePoint.startX;
|
|
2795
3027
|
activePoint.endY = activePoint.startY;
|
|
3028
|
+
if (this.currentDrawingShape === 'text') {
|
|
3029
|
+
parent.activeObj.textSettings.fontSize = 11;
|
|
3030
|
+
this.previousPoint.x = activePoint.startX;
|
|
3031
|
+
this.previousPoint.y = activePoint.startY;
|
|
3032
|
+
parent.notify('shape', { prop: 'updateFontStyles', onPropertyChange: false,
|
|
3033
|
+
value: { isTextBox: null } });
|
|
3034
|
+
var width = this.upperContext.measureText(parent.activeObj.textSettings.text).width + parent.activeObj.textSettings.fontSize * 0.5;
|
|
3035
|
+
activePoint.endX = activePoint.startX + width;
|
|
3036
|
+
activePoint.endY = activePoint.startY + parent.activeObj.textSettings.fontSize;
|
|
3037
|
+
activePoint.width = activePoint.endX - activePoint.startX;
|
|
3038
|
+
activePoint.height = activePoint.endY - activePoint.startY;
|
|
3039
|
+
}
|
|
3040
|
+
else if (this.currentDrawingShape === 'arrow') {
|
|
3041
|
+
parent.activeObj.start = this.arrowShape[0];
|
|
3042
|
+
parent.activeObj.end = this.arrowShape[1];
|
|
3043
|
+
}
|
|
2796
3044
|
parent.currObjType.isDragging = true;
|
|
2797
3045
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
2798
3046
|
var shapeResizingArgs = { cancel: false, action: 'draw-start', previousShapeSettings: previousShapeSettings };
|
|
@@ -2800,6 +3048,8 @@ var Selection = /** @class */ (function () {
|
|
|
2800
3048
|
this.shapeResizingArgs = shapeResizingArgs;
|
|
2801
3049
|
this.shapeMovingArgs = shapeMovingArgs;
|
|
2802
3050
|
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
3051
|
+
parent.activeObj.activePoint = activePoint;
|
|
3052
|
+
parent.isShapeDrawing = true;
|
|
2803
3053
|
return;
|
|
2804
3054
|
}
|
|
2805
3055
|
parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: true } });
|
|
@@ -2932,7 +3182,7 @@ var Selection = /** @class */ (function () {
|
|
|
2932
3182
|
}
|
|
2933
3183
|
else {
|
|
2934
3184
|
if (this.isFhdEditing) {
|
|
2935
|
-
parent.
|
|
3185
|
+
parent.apply();
|
|
2936
3186
|
var qbArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
|
|
2937
3187
|
if (qbArea) {
|
|
2938
3188
|
qbArea.style.display = 'none';
|
|
@@ -2941,14 +3191,15 @@ var Selection = /** @class */ (function () {
|
|
|
2941
3191
|
var point = parent.pointColl[indexObj['freehandSelectedIndex']];
|
|
2942
3192
|
var shapeSettings = { id: 'pen_' + (indexObj['freehandSelectedIndex'] + 1), type: ShapeType.FreehandDraw,
|
|
2943
3193
|
startX: point.points[0].x, startY: point.points[0].y, strokeColor: point.strokeColor,
|
|
2944
|
-
strokeWidth: point.strokeWidth, points: point.points, opacity: point.opacity
|
|
3194
|
+
strokeWidth: point.strokeWidth, points: point.points, opacity: point.opacity,
|
|
3195
|
+
index: point.order };
|
|
2945
3196
|
var shapeChangedArgs = { action: 'apply', currentShapeSettings: extend({}, shapeSettings, {}, true) };
|
|
2946
3197
|
parent.trigger('shapeChange', shapeChangedArgs);
|
|
2947
3198
|
}
|
|
2948
3199
|
var isPenDraw = parent.togglePen;
|
|
2949
3200
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
2950
3201
|
if (isPenDraw) {
|
|
2951
|
-
parent.
|
|
3202
|
+
parent.freeHandDraw(true);
|
|
2952
3203
|
}
|
|
2953
3204
|
this.isFhdEditing = false;
|
|
2954
3205
|
if (isLineArrow) {
|
|
@@ -2984,6 +3235,8 @@ var Selection = /** @class */ (function () {
|
|
|
2984
3235
|
}
|
|
2985
3236
|
if ((parent.cursor !== 'crosshair' && e.type.toLowerCase() === 'touchstart') ||
|
|
2986
3237
|
(parent.currObjType.isActiveObj && parent.cursor !== 'default' && !parent.togglePen)) {
|
|
3238
|
+
parent.notify('draw', { prop: 'updateTempObjColl' });
|
|
3239
|
+
parent.notify('draw', { prop: 'updateTempPointColl' });
|
|
2987
3240
|
this.findTarget(x_1, y_1, e.type);
|
|
2988
3241
|
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
2989
3242
|
}
|
|
@@ -3003,6 +3256,17 @@ var Selection = /** @class */ (function () {
|
|
|
3003
3256
|
var cursor = parent.cursor;
|
|
3004
3257
|
var canvasCursor = parent.upperCanvas.style.cursor;
|
|
3005
3258
|
e.preventDefault();
|
|
3259
|
+
if (this.isPreventShaping) {
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
if (parent.cursor === 'grabbing' && this.isGrabbing) {
|
|
3263
|
+
var obj = { shapeSettingsObj: {} };
|
|
3264
|
+
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
3265
|
+
var shapeSettings = obj['shapeSettingsObj'];
|
|
3266
|
+
var shapeResizingArgs = { cancel: false, action: 'rotating', previousShapeSettings: shapeSettings };
|
|
3267
|
+
var shapeMovingArgs = { cancel: false, action: 'rotating', previousShapeSettings: shapeSettings };
|
|
3268
|
+
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-down');
|
|
3269
|
+
}
|
|
3006
3270
|
if (this.timer && this.timer > 0) {
|
|
3007
3271
|
this.timer = 0;
|
|
3008
3272
|
}
|
|
@@ -3128,6 +3392,18 @@ var Selection = /** @class */ (function () {
|
|
|
3128
3392
|
&& !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
|
|
3129
3393
|
return;
|
|
3130
3394
|
}
|
|
3395
|
+
if (parent.cursor === 'grabbing' && this.isGrabbing) {
|
|
3396
|
+
var obj = { shapeSettingsObj: {} };
|
|
3397
|
+
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
3398
|
+
var shapeSettings = obj['shapeSettingsObj'];
|
|
3399
|
+
var shapeResizingArgs = { cancel: false, action: 'rotate-end', previousShapeSettings: shapeSettings };
|
|
3400
|
+
var shapeMovingArgs = { cancel: false, action: 'rotate-end', previousShapeSettings: shapeSettings };
|
|
3401
|
+
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
|
|
3402
|
+
}
|
|
3403
|
+
this.isGrabbing = false;
|
|
3404
|
+
if (this.isPreventShaping) {
|
|
3405
|
+
this.isPreventShaping = false;
|
|
3406
|
+
}
|
|
3131
3407
|
if (this.mouseDown === 'canvas' || this.isSliderActive ||
|
|
3132
3408
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3133
3409
|
e.target.closest('.e-image-editor') || e.target.closest('.e-ie-ddb-popup')) {
|
|
@@ -3154,6 +3430,9 @@ var Selection = /** @class */ (function () {
|
|
|
3154
3430
|
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
3155
3431
|
x -= bbox.left;
|
|
3156
3432
|
y -= bbox.top;
|
|
3433
|
+
var activeObjShape = void 0;
|
|
3434
|
+
var currentDrawingShape = this.currentDrawingShape;
|
|
3435
|
+
var dummyClick = false;
|
|
3157
3436
|
if (e.type === 'touchend') {
|
|
3158
3437
|
this.startTouches = this.tempTouches = [];
|
|
3159
3438
|
this.isFirstMove = false;
|
|
@@ -3182,15 +3461,16 @@ var Selection = /** @class */ (function () {
|
|
|
3182
3461
|
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
3183
3462
|
isCropSelection = true;
|
|
3184
3463
|
}
|
|
3185
|
-
if (this.currentDrawingShape === 'path') {
|
|
3464
|
+
if (this.currentDrawingShape === 'path' && parent.isShapeDrawing) {
|
|
3186
3465
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3187
3466
|
var elem = e.srcElement;
|
|
3188
3467
|
var elemId = elem.parentElement.id;
|
|
3189
3468
|
var id_1 = parent.element.id;
|
|
3469
|
+
// eslint-disable-next-line max-len
|
|
3190
3470
|
if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
|
|
3191
3471
|
(elem.classList.contains('e-upload-icon') || elemId === id_1 + '_zoomIn' ||
|
|
3192
3472
|
elemId === id_1 + '_zoomOut' || elemId === id_1 + '_annotationBtn' ||
|
|
3193
|
-
elemId === id_1 + '_borderColorBtn' || elemId === id_1 + '_borderWidthBtn'
|
|
3473
|
+
elemId === id_1 + '_borderColorBtn' || elemId === id_1 + '_borderWidthBtn')) {
|
|
3194
3474
|
parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
|
|
3195
3475
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3196
3476
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
@@ -3214,8 +3494,12 @@ var Selection = /** @class */ (function () {
|
|
|
3214
3494
|
}
|
|
3215
3495
|
this.isShapeInserted = true;
|
|
3216
3496
|
this.currentDrawingShape = '';
|
|
3217
|
-
if (parent.activeObj.
|
|
3218
|
-
parent.
|
|
3497
|
+
if ((parent.activeObj.shape && parent.activeObj.shape === 'path' && parent.activeObj.pointColl.length === 0) ||
|
|
3498
|
+
((!parent.activeObj.shape || parent.activeObj.shape !== 'path') && parent.activeObj.activePoint.width === 0 &&
|
|
3499
|
+
parent.activeObj.activePoint.height === 0)) {
|
|
3500
|
+
dummyClick = true;
|
|
3501
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3502
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3219
3503
|
}
|
|
3220
3504
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
3221
3505
|
var shapeResizingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: previousShapeSettings };
|
|
@@ -3271,6 +3555,7 @@ var Selection = /** @class */ (function () {
|
|
|
3271
3555
|
isCropSelection_1 = true;
|
|
3272
3556
|
}
|
|
3273
3557
|
var shape = parent.activeObj.shape;
|
|
3558
|
+
activeObjShape = shape;
|
|
3274
3559
|
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
|
|
3275
3560
|
if (shapeColl.indexOf(shape) > -1) {
|
|
3276
3561
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
|
|
@@ -3291,6 +3576,23 @@ var Selection = /** @class */ (function () {
|
|
|
3291
3576
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
|
|
3292
3577
|
}
|
|
3293
3578
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
3579
|
+
if (!this.isFhdEditing) {
|
|
3580
|
+
if (parent.activeObj.shape && parent.activeObj.shape === 'text' &&
|
|
3581
|
+
parent.activeObj.textSettings.fontSize === 11 && Math.floor(parent.activeObj.activePoint.width) === 55 &&
|
|
3582
|
+
Math.floor(parent.activeObj.activePoint.height) === 11) {
|
|
3583
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3584
|
+
}
|
|
3585
|
+
if (!isCropSelection_1) {
|
|
3586
|
+
if (parent.isShapeDrawing) {
|
|
3587
|
+
var temp = this.currentDrawingShape;
|
|
3588
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
3589
|
+
this.currentDrawingShape = temp;
|
|
3590
|
+
}
|
|
3591
|
+
else {
|
|
3592
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3294
3596
|
}
|
|
3295
3597
|
}
|
|
3296
3598
|
if (parent.activeObj.shape !== undefined) {
|
|
@@ -3312,9 +3614,16 @@ var Selection = /** @class */ (function () {
|
|
|
3312
3614
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
3313
3615
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
3314
3616
|
}
|
|
3315
|
-
|
|
3617
|
+
var obj = { freehandDrawSelectedId: null };
|
|
3618
|
+
parent.notify('freehand-draw', { prop: 'getFreehandDrawSelectedId', onPropertyChange: false, value: { obj: obj } });
|
|
3619
|
+
if (parent.togglePen && e.currentTarget === parent.upperCanvas && !obj['freehandDrawSelectedId']) {
|
|
3316
3620
|
parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
|
|
3317
3621
|
value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
|
|
3622
|
+
if (parent.togglePen && (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)
|
|
3623
|
+
|| !isNullOrUndefined(parent.toolbarTemplate))) {
|
|
3624
|
+
parent.okBtn();
|
|
3625
|
+
parent.freeHandDraw(true);
|
|
3626
|
+
}
|
|
3318
3627
|
}
|
|
3319
3628
|
else {
|
|
3320
3629
|
parent.currObjType.shape = '';
|
|
@@ -3324,6 +3633,17 @@ var Selection = /** @class */ (function () {
|
|
|
3324
3633
|
this.isSliderActive = false;
|
|
3325
3634
|
parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
|
|
3326
3635
|
this.selMouseUpEvent();
|
|
3636
|
+
if (isNullOrUndefined(parent.drawingShape) && activeObjShape && currentDrawingShape !== '') {
|
|
3637
|
+
parent.drawingShape = activeObjShape;
|
|
3638
|
+
}
|
|
3639
|
+
if (parent.drawingShape) {
|
|
3640
|
+
this.currentDrawingShape = parent.drawingShape.toLowerCase();
|
|
3641
|
+
if (dummyClick) {
|
|
3642
|
+
parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
|
|
3643
|
+
parent.upperCanvas.style.cursor = 'crosshair';
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
parent.isShapeDrawing = false;
|
|
3327
3647
|
}
|
|
3328
3648
|
};
|
|
3329
3649
|
Selection.prototype.adjustActObjForLineArrow = function (obj) {
|
|
@@ -3364,6 +3684,7 @@ var Selection = /** @class */ (function () {
|
|
|
3364
3684
|
parent.notify('shape', { prop: 'setPointCollForShapeRotation', onPropertyChange: false, value: { obj: obj } });
|
|
3365
3685
|
var _a = parent.img, destLeft_1 = _a.destLeft, destTop_1 = _a.destTop, destWidth_1 = _a.destWidth, destHeight_1 = _a.destHeight;
|
|
3366
3686
|
var horTopLinePointColl = obj.horTopLinePointColl, horBottomLinePointColl = obj.horBottomLinePointColl, verLeftLinePointColl = obj.verLeftLinePointColl, verRightLinePointColl = obj.verRightLinePointColl;
|
|
3687
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
3367
3688
|
var setRatio = function (point) {
|
|
3368
3689
|
point.ratioX = (point.x - destLeft_1) / destWidth_1;
|
|
3369
3690
|
point.ratioY = (point.y - destTop_1) / destHeight_1;
|
|
@@ -3545,6 +3866,9 @@ var Selection = /** @class */ (function () {
|
|
|
3545
3866
|
Selection.prototype.applyObj = function (x, y) {
|
|
3546
3867
|
var parent = this.parent;
|
|
3547
3868
|
var isApply = false;
|
|
3869
|
+
if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
|
|
3870
|
+
return false;
|
|
3871
|
+
}
|
|
3548
3872
|
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image', 'text'];
|
|
3549
3873
|
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY;
|
|
3550
3874
|
if (parent.activeObj.shape && shapeColl.indexOf(parent.activeObj.shape) > -1) {
|
|
@@ -3747,11 +4071,21 @@ var Selection = /** @class */ (function () {
|
|
|
3747
4071
|
break;
|
|
3748
4072
|
case (e.ctrlKey && 'z'):
|
|
3749
4073
|
if (parent.allowUndoRedo) {
|
|
4074
|
+
parent.noPushUndo = false;
|
|
4075
|
+
if (parent.togglePen || parent.drawingShape) {
|
|
4076
|
+
parent.okBtn();
|
|
4077
|
+
parent.drawingShape = null;
|
|
4078
|
+
}
|
|
3750
4079
|
parent.notify('undo-redo', { prop: 'call-undo' });
|
|
3751
4080
|
}
|
|
3752
4081
|
break;
|
|
3753
4082
|
case (e.ctrlKey && 'y'):
|
|
3754
4083
|
if (parent.allowUndoRedo) {
|
|
4084
|
+
parent.noPushUndo = false;
|
|
4085
|
+
if (parent.togglePen || parent.drawingShape) {
|
|
4086
|
+
parent.okBtn();
|
|
4087
|
+
parent.drawingShape = null;
|
|
4088
|
+
}
|
|
3755
4089
|
parent.notify('undo-redo', { prop: 'call-redo' });
|
|
3756
4090
|
}
|
|
3757
4091
|
break;
|
|
@@ -3791,7 +4125,7 @@ var Selection = /** @class */ (function () {
|
|
|
3791
4125
|
this.deleteItem();
|
|
3792
4126
|
break;
|
|
3793
4127
|
case 'Escape':
|
|
3794
|
-
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
4128
|
+
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null, isFinalCancel: true } });
|
|
3795
4129
|
break;
|
|
3796
4130
|
case 'Enter':
|
|
3797
4131
|
this.performEnterAction(e);
|
|
@@ -3894,7 +4228,7 @@ var Selection = /** @class */ (function () {
|
|
|
3894
4228
|
if (e.ctrlKey === true && isInsideCanvas) {
|
|
3895
4229
|
e.preventDefault();
|
|
3896
4230
|
if (!parent.isCropTab && (parent.activeObj.shape && parent.activeObj.shape.split('-')[0] !== 'crop')) {
|
|
3897
|
-
parent.okBtn();
|
|
4231
|
+
parent.okBtn(null, true);
|
|
3898
4232
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
3899
4233
|
}
|
|
3900
4234
|
var type = '';
|
|
@@ -4098,7 +4432,7 @@ var Selection = /** @class */ (function () {
|
|
|
4098
4432
|
var parent = this.parent;
|
|
4099
4433
|
var isShape = false;
|
|
4100
4434
|
if (parent.objColl.length !== 0 && !parent.currObjType.isCustomCrop && !isCrop) {
|
|
4101
|
-
var
|
|
4435
|
+
var prevIndex = 0;
|
|
4102
4436
|
var i = void 0;
|
|
4103
4437
|
for (var index = 0; index < parent.objColl.length; index++) {
|
|
4104
4438
|
var cursor = parent.upperCanvas.style.cursor;
|
|
@@ -4119,8 +4453,8 @@ var Selection = /** @class */ (function () {
|
|
|
4119
4453
|
else {
|
|
4120
4454
|
if (this.isTouch || parent.cursor === 'move' ||
|
|
4121
4455
|
parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4122
|
-
if (
|
|
4123
|
-
|
|
4456
|
+
if (prevIndex === 0 || prevIndex < actObj.order) {
|
|
4457
|
+
prevIndex = actObj.order;
|
|
4124
4458
|
i = index;
|
|
4125
4459
|
}
|
|
4126
4460
|
}
|
|
@@ -4142,8 +4476,8 @@ var Selection = /** @class */ (function () {
|
|
|
4142
4476
|
}
|
|
4143
4477
|
else {
|
|
4144
4478
|
if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4145
|
-
if (
|
|
4146
|
-
|
|
4479
|
+
if (prevIndex === 0 || prevIndex < actObj.order) {
|
|
4480
|
+
prevIndex = actObj.order;
|
|
4147
4481
|
i = index;
|
|
4148
4482
|
}
|
|
4149
4483
|
}
|
|
@@ -4163,8 +4497,8 @@ var Selection = /** @class */ (function () {
|
|
|
4163
4497
|
}
|
|
4164
4498
|
else {
|
|
4165
4499
|
if (this.isTouch || parent.cursor === 'move' || parent.cursor === 'grab' || this.isShapeInserted) {
|
|
4166
|
-
if (
|
|
4167
|
-
|
|
4500
|
+
if (prevIndex === 0 || prevIndex < actObj.order) {
|
|
4501
|
+
prevIndex = actObj.order;
|
|
4168
4502
|
i = index;
|
|
4169
4503
|
}
|
|
4170
4504
|
}
|
|
@@ -4193,8 +4527,8 @@ var Selection = /** @class */ (function () {
|
|
|
4193
4527
|
else {
|
|
4194
4528
|
if (this.isTouch || cursor === 'move' || cursor === 'grabbing' || this.isShapeInserted
|
|
4195
4529
|
|| parent.cursor === 'move' || parent.cursor === 'grabbing') {
|
|
4196
|
-
if (
|
|
4197
|
-
|
|
4530
|
+
if (prevIndex === 0 || prevIndex < actObj.order) {
|
|
4531
|
+
prevIndex = actObj.order;
|
|
4198
4532
|
i = index;
|
|
4199
4533
|
}
|
|
4200
4534
|
}
|
|
@@ -4220,10 +4554,9 @@ var Selection = /** @class */ (function () {
|
|
|
4220
4554
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
4221
4555
|
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
4222
4556
|
this.lowerContext.filter = 'none';
|
|
4223
|
-
parent.notify('shape', { prop: '
|
|
4557
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
4558
|
+
value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
|
|
4224
4559
|
parent.activeObj = extend({}, temp_1, {}, true);
|
|
4225
|
-
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
4226
|
-
value: { context: this.lowerContext, points: null } });
|
|
4227
4560
|
this.lowerContext.filter = temp_1;
|
|
4228
4561
|
this.getCurrentFlipState();
|
|
4229
4562
|
}
|
|
@@ -4237,8 +4570,8 @@ var Selection = /** @class */ (function () {
|
|
|
4237
4570
|
parent.img.destTop = destPoints.startY;
|
|
4238
4571
|
parent.img.destWidth = destPoints.width;
|
|
4239
4572
|
parent.img.destHeight = destPoints.height;
|
|
4240
|
-
parent.notify('
|
|
4241
|
-
value: {
|
|
4573
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
4574
|
+
value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
|
|
4242
4575
|
}
|
|
4243
4576
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
4244
4577
|
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
@@ -4388,6 +4721,10 @@ var Selection = /** @class */ (function () {
|
|
|
4388
4721
|
break;
|
|
4389
4722
|
}
|
|
4390
4723
|
}
|
|
4724
|
+
if ((obj.shape === 'path' && obj.pointColl.length === 0) ||
|
|
4725
|
+
(obj.shape !== 'path' && (obj.activePoint.width === 0 && obj.activePoint.height === 0))) {
|
|
4726
|
+
return;
|
|
4727
|
+
}
|
|
4391
4728
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
4392
4729
|
if (this.isPreventDragging) {
|
|
4393
4730
|
if (parent.activeObj.activePoint.startX > parent.img.destLeft) {
|
|
@@ -4499,7 +4836,8 @@ var Selection = /** @class */ (function () {
|
|
|
4499
4836
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
4500
4837
|
}
|
|
4501
4838
|
}
|
|
4502
|
-
parent.notify('
|
|
4839
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
4840
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
4503
4841
|
this.lowerContext.filter = tempFilter;
|
|
4504
4842
|
if (parent.activeObj.shape) {
|
|
4505
4843
|
parent.notify('shape', { prop: 'apply', onPropertyChange: false,
|
|
@@ -4604,7 +4942,7 @@ var Selection = /** @class */ (function () {
|
|
|
4604
4942
|
}
|
|
4605
4943
|
if (obj['prevActObj'] && JSON.stringify(obj['prevActObj']) !== JSON.stringify(parent.activeObj)) {
|
|
4606
4944
|
var index = parent.activeObj.currIndex;
|
|
4607
|
-
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
4945
|
+
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null, isFinalCancel: true } });
|
|
4608
4946
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
4609
4947
|
if (parent.objColl[i].currIndex === index) {
|
|
4610
4948
|
parent.objColl.splice(i, 1);
|
|
@@ -4641,6 +4979,7 @@ var Selection = /** @class */ (function () {
|
|
|
4641
4979
|
parent.clearSelection();
|
|
4642
4980
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
4643
4981
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
4982
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
4644
4983
|
if (!isNullOrUndefined(prevObj.objColl[prevObj.objColl.length - 1].currIndex)) {
|
|
4645
4984
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
4646
4985
|
value: { operation: 'deleteObj', previousObj: prevObj, previousObjColl: this.tempObjColl,
|
|
@@ -4651,6 +4990,11 @@ var Selection = /** @class */ (function () {
|
|
|
4651
4990
|
}
|
|
4652
4991
|
}
|
|
4653
4992
|
parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false, value: { prevActObj: null } });
|
|
4993
|
+
if (parent.drawingShape) {
|
|
4994
|
+
this.currentDrawingShape = parent.drawingShape.toLowerCase();
|
|
4995
|
+
parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
|
|
4996
|
+
parent.upperCanvas.style.cursor = 'crosshair';
|
|
4997
|
+
}
|
|
4654
4998
|
}
|
|
4655
4999
|
if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
|
|
4656
5000
|
document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
|
|
@@ -4711,7 +5055,8 @@ var Selection = /** @class */ (function () {
|
|
|
4711
5055
|
endY: shape === 'line' || shape === 'arrow' ? endY : null,
|
|
4712
5056
|
arrowHead: shape === 'arrow' ? this.getArrowType(parent.activeObj.start) : null,
|
|
4713
5057
|
arrowTail: shape === 'arrow' ? this.getArrowType(parent.activeObj.end) : null,
|
|
4714
|
-
points: shape === 'path' ? parent.activeObj.pointColl : null
|
|
5058
|
+
points: shape === 'path' ? parent.activeObj.pointColl : null,
|
|
5059
|
+
index: parent.activeObj.order
|
|
4715
5060
|
};
|
|
4716
5061
|
if (obj) {
|
|
4717
5062
|
obj['shapeSettingsObj'] = shapeSettingsObj;
|