@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,3 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
6
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
10
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
11
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
12
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
13
|
+
function step(op) {
|
|
14
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
15
|
+
while (_) try {
|
|
16
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
17
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
18
|
+
switch (op[0]) {
|
|
19
|
+
case 0: case 1: t = op; break;
|
|
20
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
21
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
22
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
23
|
+
default:
|
|
24
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
25
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
26
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
27
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
28
|
+
if (t[2]) _.ops.pop();
|
|
29
|
+
_.trys.pop(); continue;
|
|
30
|
+
}
|
|
31
|
+
op = body.call(thisArg, _);
|
|
32
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
33
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/* eslint-disable no-constant-condition */
|
|
37
|
+
/* eslint-disable radix */
|
|
1
38
|
import { extend, isNullOrUndefined, Browser, getComponent } from '@syncfusion/ej2-base';
|
|
2
39
|
import { Dialog, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
|
|
3
40
|
var Draw = /** @class */ (function () {
|
|
@@ -31,6 +68,9 @@ var Draw = /** @class */ (function () {
|
|
|
31
68
|
this.isCropSelect = false;
|
|
32
69
|
this.isDownScale = false;
|
|
33
70
|
this.preventStraightening = false;
|
|
71
|
+
this.tempObjColl = [];
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
this.tempPointColl = {};
|
|
34
74
|
this.parent = parent;
|
|
35
75
|
this.addEventListener();
|
|
36
76
|
}
|
|
@@ -82,7 +122,7 @@ var Draw = /** @class */ (function () {
|
|
|
82
122
|
this.updateCanvas();
|
|
83
123
|
break;
|
|
84
124
|
case 'performCancel':
|
|
85
|
-
this.performCancel(args.value['isContextualToolbar'], args.value['isUndoRedo']);
|
|
125
|
+
this.performCancel(args.value['isContextualToolbar'], args.value['isUndoRedo'], args.value['isFinalCancel']);
|
|
86
126
|
break;
|
|
87
127
|
case 'updateFlipPan':
|
|
88
128
|
this.updateFlipPan(args.value['tempSelectionObj']);
|
|
@@ -188,12 +228,6 @@ var Draw = /** @class */ (function () {
|
|
|
188
228
|
case 'reset':
|
|
189
229
|
this.reset();
|
|
190
230
|
break;
|
|
191
|
-
case 'dlgBtnClick':
|
|
192
|
-
this.dlgBtnClick();
|
|
193
|
-
break;
|
|
194
|
-
case 'dlgCloseBtnClick':
|
|
195
|
-
this.dlgCloseBtnClick();
|
|
196
|
-
break;
|
|
197
231
|
case 'setNewPath':
|
|
198
232
|
this.isNewPath = args.value['bool'];
|
|
199
233
|
break;
|
|
@@ -290,6 +324,18 @@ var Draw = /** @class */ (function () {
|
|
|
290
324
|
case 'checkPointPosition':
|
|
291
325
|
args.value['obj']['position'] = this.checkPointPosition(args.value['obj']['x'], args.value['obj']['y'], args.value['obj']['x1'], args.value['obj']['y1'], args.value['obj']['x2'], args.value['obj']['y2'], args.value['obj']['x3'], args.value['obj']['y3'], args.value['obj']['x4'], args.value['obj']['y4']);
|
|
292
326
|
break;
|
|
327
|
+
case 'updateTempObjColl':
|
|
328
|
+
this.tempObjColl = extend([], this.parent.objColl, [], true);
|
|
329
|
+
break;
|
|
330
|
+
case 'resetTempObjColl':
|
|
331
|
+
this.tempObjColl = null;
|
|
332
|
+
break;
|
|
333
|
+
case 'updateTempPointColl':
|
|
334
|
+
this.tempPointColl = extend({}, this.parent.pointColl, {}, true);
|
|
335
|
+
break;
|
|
336
|
+
case 'resetTempPointColl':
|
|
337
|
+
this.tempPointColl = {};
|
|
338
|
+
break;
|
|
293
339
|
}
|
|
294
340
|
};
|
|
295
341
|
Draw.prototype.getModuleName = function () {
|
|
@@ -335,6 +381,8 @@ var Draw = /** @class */ (function () {
|
|
|
335
381
|
this.straightenActObj = null;
|
|
336
382
|
this.imgCanvasPoints = [];
|
|
337
383
|
this.straightenInitZoom = null;
|
|
384
|
+
this.tempObjColl = [];
|
|
385
|
+
this.tempPointColl = {};
|
|
338
386
|
this.straightenDestPoints = null;
|
|
339
387
|
this.isCropSelect = this.isDownScale = this.preventStraightening = false;
|
|
340
388
|
};
|
|
@@ -408,7 +456,7 @@ var Draw = /** @class */ (function () {
|
|
|
408
456
|
if (obj) {
|
|
409
457
|
parent.activeObj = extend({}, obj, {}, true);
|
|
410
458
|
}
|
|
411
|
-
if (points) {
|
|
459
|
+
if (points && points.startX && points.startY && points.endX && points.endY && points.width && points.height) {
|
|
412
460
|
actPoint.startX = points.startX;
|
|
413
461
|
actPoint.startY = points.startY;
|
|
414
462
|
actPoint.endX = points.endX;
|
|
@@ -437,7 +485,7 @@ var Draw = /** @class */ (function () {
|
|
|
437
485
|
}
|
|
438
486
|
}
|
|
439
487
|
if (isCrop) {
|
|
440
|
-
if (points) {
|
|
488
|
+
if (points && points.startX && points.startY && points.endX && points.endY && points.width && points.height) {
|
|
441
489
|
actPoint.startX = points.startX;
|
|
442
490
|
actPoint.startY = points.startY;
|
|
443
491
|
actPoint.endX = points.endX;
|
|
@@ -651,6 +699,10 @@ var Draw = /** @class */ (function () {
|
|
|
651
699
|
x = 9;
|
|
652
700
|
y = 16;
|
|
653
701
|
break;
|
|
702
|
+
default:
|
|
703
|
+
x = parseInt(parent.currObjType.shape.toLowerCase().split('crop-')[1].split(':')[0]);
|
|
704
|
+
y = parseInt(parent.currObjType.shape.toLowerCase().split('crop-')[1].split(':')[1]);
|
|
705
|
+
break;
|
|
654
706
|
}
|
|
655
707
|
if (x !== undefined && y !== undefined) {
|
|
656
708
|
parent.notify('selection', { prop: 'calcShapeRatio', onPropertyChange: false,
|
|
@@ -1642,6 +1694,8 @@ var Draw = /** @class */ (function () {
|
|
|
1642
1694
|
if (start) {
|
|
1643
1695
|
this.startCircleIntersectX1 = intersectionX1;
|
|
1644
1696
|
this.startCircleIntersectY1 = intersectionY1;
|
|
1697
|
+
this.endCircleIntersectX1 = endX - this.dx * t2;
|
|
1698
|
+
this.endCircleIntersectY1 = endY - this.dy * t2;
|
|
1645
1699
|
canvasDraw.beginPath();
|
|
1646
1700
|
canvasDraw.fill();
|
|
1647
1701
|
canvasDraw.beginPath();
|
|
@@ -1690,6 +1744,8 @@ var Draw = /** @class */ (function () {
|
|
|
1690
1744
|
if (start) {
|
|
1691
1745
|
this.startCircleIntersectX1 = intersectionX1;
|
|
1692
1746
|
this.startCircleIntersectY1 = intersectionY1;
|
|
1747
|
+
this.endCircleIntersectX1 = startX - this.dx * t2;
|
|
1748
|
+
this.endCircleIntersectY1 = startY - this.dy * t2;
|
|
1693
1749
|
if (actObj.start === 'circle' && actObj.end === 'circle') {
|
|
1694
1750
|
this.shapeLine(canvasDraw, this.endCircleIntersectX1, this.endCircleIntersectY1, this.startCircleIntersectX1, this.startCircleIntersectY1);
|
|
1695
1751
|
}
|
|
@@ -2360,7 +2416,6 @@ var Draw = /** @class */ (function () {
|
|
|
2360
2416
|
};
|
|
2361
2417
|
Draw.prototype.renderImage = function (isMouseWheel, isPreventClearRect, isFrame, isStraighten) {
|
|
2362
2418
|
var parent = this.parent;
|
|
2363
|
-
var temp = this.lowerContext.filter;
|
|
2364
2419
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
2365
2420
|
if (isNullOrUndefined(isPreventClearRect)) {
|
|
2366
2421
|
this.upperContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
@@ -2386,13 +2441,12 @@ var Draw = /** @class */ (function () {
|
|
|
2386
2441
|
this.isRotateZoom = false;
|
|
2387
2442
|
}
|
|
2388
2443
|
if (isFrame) {
|
|
2389
|
-
parent.notify('shape', { prop: '
|
|
2390
|
-
|
|
2444
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
2445
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
2391
2446
|
}
|
|
2392
2447
|
else {
|
|
2393
|
-
parent.notify('shape', { prop: '
|
|
2394
|
-
|
|
2395
|
-
value: { context: this.lowerContext, points: null } });
|
|
2448
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
2449
|
+
value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
|
|
2396
2450
|
}
|
|
2397
2451
|
this.clearOuterCanvas(this.lowerContext);
|
|
2398
2452
|
if (parent.isCircleCrop || (parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle')) {
|
|
@@ -2407,6 +2461,7 @@ var Draw = /** @class */ (function () {
|
|
|
2407
2461
|
var proxy = this;
|
|
2408
2462
|
parent.baseImg.src = src;
|
|
2409
2463
|
parent.baseImg.onload = function () {
|
|
2464
|
+
parent.imgSrc = src;
|
|
2410
2465
|
parent.notify('filter', { prop: 'update-finetunes', onPropertyChange: false });
|
|
2411
2466
|
proxy.lowerContext.drawImage(parent.baseImg, 0, 0, proxy.parent.lowerCanvas.width, proxy.parent.lowerCanvas.height);
|
|
2412
2467
|
hideSpinner(parent.element);
|
|
@@ -2475,8 +2530,8 @@ var Draw = /** @class */ (function () {
|
|
|
2475
2530
|
parent.notify('crop', { prop: 'setCropDestPoints', onPropertyChange: false, value: { point: point } });
|
|
2476
2531
|
var temp = this.lowerContext.filter;
|
|
2477
2532
|
this.lowerContext.filter = 'none';
|
|
2478
|
-
parent.notify('shape', { prop: '
|
|
2479
|
-
|
|
2533
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
2534
|
+
value: { ctx: this.lowerContext, shape: 'iterate', pen: 'zoom', isPreventApply: null } });
|
|
2480
2535
|
this.lowerContext.filter = temp;
|
|
2481
2536
|
if (parent.img.destWidth > 0 && parent.img.destHeight > 0) {
|
|
2482
2537
|
parent.isImageLoaded = true;
|
|
@@ -2516,8 +2571,11 @@ var Draw = /** @class */ (function () {
|
|
|
2516
2571
|
parent.cancelCropSelection = null;
|
|
2517
2572
|
}
|
|
2518
2573
|
};
|
|
2519
|
-
Draw.prototype.performCancel = function (isContextualToolbar, isUndoRedo) {
|
|
2574
|
+
Draw.prototype.performCancel = function (isContextualToolbar, isUndoRedo, isFinalCancel) {
|
|
2520
2575
|
var parent = this.parent;
|
|
2576
|
+
if (isFinalCancel) {
|
|
2577
|
+
parent.noPushUndo = false;
|
|
2578
|
+
}
|
|
2521
2579
|
var straightenObj = { bool: parent.isStraightening };
|
|
2522
2580
|
isContextualToolbar = isContextualToolbar ? isContextualToolbar : false;
|
|
2523
2581
|
var obj = { bool: false };
|
|
@@ -2531,7 +2589,7 @@ var Draw = /** @class */ (function () {
|
|
|
2531
2589
|
if (obj['bool']) {
|
|
2532
2590
|
parent.notify('freehand-draw', { prop: 'cancelFhd', onPropertyChange: false });
|
|
2533
2591
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
2534
|
-
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: '
|
|
2592
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
|
|
2535
2593
|
}
|
|
2536
2594
|
else if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
|
|
2537
2595
|
parent.textArea.style.display = 'none';
|
|
@@ -2552,6 +2610,9 @@ var Draw = /** @class */ (function () {
|
|
|
2552
2610
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
2553
2611
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
2554
2612
|
parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
2613
|
+
if (parent.drawingShape) {
|
|
2614
|
+
parent.enableShapeDrawing(parent.toPascalCase(parent.drawingShape), true);
|
|
2615
|
+
}
|
|
2555
2616
|
}
|
|
2556
2617
|
else if (((!Browser.isDevice || (Browser.isDevice && !straightenObj['bool'])) &&
|
|
2557
2618
|
document.querySelector('#' + parent.element.id + '_sliderWrapper')) || parent.currObjType.isFiltered) {
|
|
@@ -2612,6 +2673,12 @@ var Draw = /** @class */ (function () {
|
|
|
2612
2673
|
this.isNewPath = false;
|
|
2613
2674
|
parent.notify('toolbar', { prop: 'refresh-dropdown-btn', value: { isDisabled: false } });
|
|
2614
2675
|
parent.notify('toolbar', { prop: 'setCurrentToolbar', value: { type: 'main' } });
|
|
2676
|
+
if (isFinalCancel) {
|
|
2677
|
+
parent.noPushUndo = false;
|
|
2678
|
+
}
|
|
2679
|
+
parent.drawingShape = null;
|
|
2680
|
+
parent.notify('draw', { prop: 'resetTempObjColl' });
|
|
2681
|
+
parent.notify('draw', { prop: 'resetTempPointColl' });
|
|
2615
2682
|
};
|
|
2616
2683
|
Draw.prototype.cancelItems = function () {
|
|
2617
2684
|
var parent = this.parent;
|
|
@@ -2667,8 +2734,8 @@ var Draw = /** @class */ (function () {
|
|
|
2667
2734
|
parent.pointColl = obj2['prevObj']['pointColl'];
|
|
2668
2735
|
parent.freehandCounter = parent.pointColl.length;
|
|
2669
2736
|
parent.transform.straighten = 0;
|
|
2670
|
-
parent.notify('shape', { prop: '
|
|
2671
|
-
|
|
2737
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
2738
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
2672
2739
|
var currObj = parent.currSelectionPoint ?
|
|
2673
2740
|
extend({}, parent.currSelectionPoint, {}, true) : null;
|
|
2674
2741
|
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
@@ -2696,7 +2763,7 @@ var Draw = /** @class */ (function () {
|
|
|
2696
2763
|
this.cancelPen();
|
|
2697
2764
|
break;
|
|
2698
2765
|
case parent.activeObj.shape === 'text':
|
|
2699
|
-
this.cancelText(
|
|
2766
|
+
this.cancelText();
|
|
2700
2767
|
break;
|
|
2701
2768
|
case shapes.indexOf(parent.activeObj.shape) !== -1:
|
|
2702
2769
|
this.cancelShape();
|
|
@@ -2735,8 +2802,14 @@ var Draw = /** @class */ (function () {
|
|
|
2735
2802
|
value: { strokeSettings: parent.activeObj.strokeSettings, strokeColor: null, fillColor: null, strokeWidth: null } });
|
|
2736
2803
|
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'cancel' } });
|
|
2737
2804
|
parent.notify('selection', { prop: 'setFreehandDrawCustomized', value: { isFreehandDrawCustomized: false } });
|
|
2805
|
+
parent.objColl = extend([], this.tempObjColl, [], true);
|
|
2806
|
+
parent.pointColl = extend([], this.tempPointColl, [], true);
|
|
2807
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
2808
|
+
this.tempPointColl = {};
|
|
2809
|
+
this.renderImage();
|
|
2810
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok', isCancel: true } });
|
|
2738
2811
|
};
|
|
2739
|
-
Draw.prototype.cancelText = function (
|
|
2812
|
+
Draw.prototype.cancelText = function () {
|
|
2740
2813
|
var parent = this.parent;
|
|
2741
2814
|
parent.notify('shape', { prop: 'setTextSettings', onPropertyChange: false,
|
|
2742
2815
|
value: { textSettings: this.tempTextSettings, fontFamily: null, fontSize: null } });
|
|
@@ -2760,25 +2833,15 @@ var Draw = /** @class */ (function () {
|
|
|
2760
2833
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2761
2834
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2762
2835
|
}
|
|
2763
|
-
if (parent.activeObj.shape && parent.activeObj.keyHistory === 'Enter Text') {
|
|
2764
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2765
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2766
|
-
parent.notify('shape', { prop: 'draw-shape-text' });
|
|
2767
|
-
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'cancel' } });
|
|
2768
|
-
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
2769
|
-
}
|
|
2770
|
-
else if (parent.activeObj.shape) {
|
|
2771
|
-
parent.notify('shape', { prop: 'redraw-text' });
|
|
2772
|
-
parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
2773
|
-
if (!isCropSelection && parent.activeObj.topLeftCircle !== undefined) {
|
|
2774
|
-
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
|
|
2775
|
-
}
|
|
2776
|
-
parent.clearSelection();
|
|
2777
|
-
}
|
|
2778
2836
|
}
|
|
2779
2837
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
2780
2838
|
this.tempTextSettings = { text: 'Enter Text', fontFamily: parent.fontFamily.default, fontSize: null, fontRatio: null, bold: false,
|
|
2781
2839
|
italic: false, underline: false };
|
|
2840
|
+
parent.objColl = extend([], this.tempObjColl, [], true);
|
|
2841
|
+
parent.pointColl = extend([], this.tempPointColl, [], true);
|
|
2842
|
+
this.renderImage();
|
|
2843
|
+
this.tempObjColl = [];
|
|
2844
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok', isCancel: true } });
|
|
2782
2845
|
};
|
|
2783
2846
|
Draw.prototype.cancelShape = function () {
|
|
2784
2847
|
var parent = this.parent;
|
|
@@ -2818,9 +2881,24 @@ var Draw = /** @class */ (function () {
|
|
|
2818
2881
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2819
2882
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2820
2883
|
}
|
|
2884
|
+
var undoRedoObj = { undoRedoStep: null };
|
|
2885
|
+
parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
|
|
2886
|
+
if (object['appliedUndoRedoColl'][(undoRedoObj['undoRedoStep'] - 1)]) {
|
|
2887
|
+
parent.objColl =
|
|
2888
|
+
extend([], object['appliedUndoRedoColl'][(undoRedoObj['undoRedoStep'] - 1)].currentObjColl, [], true);
|
|
2889
|
+
}
|
|
2890
|
+
else {
|
|
2891
|
+
parent.objColl = [];
|
|
2892
|
+
}
|
|
2893
|
+
this.renderImage();
|
|
2821
2894
|
}
|
|
2822
2895
|
parent.currObjType.isDragging = false;
|
|
2823
2896
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
2897
|
+
parent.objColl = extend([], this.tempObjColl, [], true);
|
|
2898
|
+
parent.pointColl = extend([], this.tempPointColl, [], true);
|
|
2899
|
+
this.renderImage();
|
|
2900
|
+
this.tempObjColl = [];
|
|
2901
|
+
parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok', isCancel: true } });
|
|
2824
2902
|
};
|
|
2825
2903
|
Draw.prototype.cancelSelection = function () {
|
|
2826
2904
|
var parent = this.parent;
|
|
@@ -2833,6 +2911,7 @@ var Draw = /** @class */ (function () {
|
|
|
2833
2911
|
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: parent.activeObj } });
|
|
2834
2912
|
parent.notify('crop', { prop: 'resizeWrapper' });
|
|
2835
2913
|
this.updateCropSelObj();
|
|
2914
|
+
// eslint-disable-next-line max-len
|
|
2836
2915
|
if (this.tempStraightenDestPoints && JSON.stringify(this.tempStraightenDestPoints) !== JSON.stringify(this.straightenDestPoints)) {
|
|
2837
2916
|
this.straightenDestPoints = extend({}, this.tempStraightenDestPoints, {}, true);
|
|
2838
2917
|
}
|
|
@@ -3047,9 +3126,16 @@ var Draw = /** @class */ (function () {
|
|
|
3047
3126
|
actPoint.width = width;
|
|
3048
3127
|
actPoint.height = height;
|
|
3049
3128
|
}
|
|
3129
|
+
else if (width && height) {
|
|
3130
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
3131
|
+
actPoint.width = width;
|
|
3132
|
+
actPoint.height = height;
|
|
3133
|
+
actPoint.startX = destLeft + ((destWidth / 2) - (width / 2));
|
|
3134
|
+
actPoint.startY = destTop + ((destHeight / 2) - (height / 2));
|
|
3135
|
+
}
|
|
3050
3136
|
else {
|
|
3051
3137
|
if (isNullOrUndefined(parent.transform.zoomFactor) || parent.transform.zoomFactor === 0) {
|
|
3052
|
-
var
|
|
3138
|
+
var _b = parent.img, destLeft_1 = _b.destLeft, destTop_1 = _b.destTop, destWidth_1 = _b.destWidth, destHeight_1 = _b.destHeight;
|
|
3053
3139
|
var lowerCanvasWidth_1 = parent.lowerCanvas.width;
|
|
3054
3140
|
var lowerCanvasHeight_1 = parent.lowerCanvas.height;
|
|
3055
3141
|
var activePoint_1 = actPoint;
|
|
@@ -3079,7 +3165,7 @@ var Draw = /** @class */ (function () {
|
|
|
3079
3165
|
}
|
|
3080
3166
|
}
|
|
3081
3167
|
else {
|
|
3082
|
-
var
|
|
3168
|
+
var _c = parent.img, destLeft_2 = _c.destLeft, destTop_2 = _c.destTop, destWidth_2 = _c.destWidth, destHeight_2 = _c.destHeight;
|
|
3083
3169
|
var lowerCanvasWidth_2 = parent.lowerCanvas.width;
|
|
3084
3170
|
var lowerCanvasHeight_2 = parent.lowerCanvas.height;
|
|
3085
3171
|
var activePoint_2 = actPoint;
|
|
@@ -3090,7 +3176,7 @@ var Draw = /** @class */ (function () {
|
|
|
3090
3176
|
activePoint_2.endY = Math.min(destTop_2 + destHeight_2 + 15 < lowerCanvasHeight_2 ? destTop_2 + destHeight_2 - 15 :
|
|
3091
3177
|
lowerCanvasHeight_2 - 15, destTop_2 + destHeight_2);
|
|
3092
3178
|
}
|
|
3093
|
-
var
|
|
3179
|
+
var _d = parent.img, destLeft = _d.destLeft, destTop = _d.destTop, destWidth = _d.destWidth, destHeight = _d.destHeight;
|
|
3094
3180
|
var lowerCanvasWidth = parent.lowerCanvas.clientWidth;
|
|
3095
3181
|
var lowerCanvasHeight = parent.lowerCanvas.clientHeight;
|
|
3096
3182
|
var activePoint = actPoint;
|
|
@@ -3213,11 +3299,10 @@ var Draw = /** @class */ (function () {
|
|
|
3213
3299
|
var tempTogglePen = parent.togglePen;
|
|
3214
3300
|
parent.togglePen = false;
|
|
3215
3301
|
this.lowerContext.filter = 'none';
|
|
3216
|
-
parent.notify('shape', { prop: '
|
|
3302
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
3303
|
+
value: { ctx: this.lowerContext, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
|
|
3217
3304
|
parent.img.destLeft += parent.panPoint.totalPannedInternalPoint.x;
|
|
3218
3305
|
parent.img.destTop += parent.panPoint.totalPannedInternalPoint.y;
|
|
3219
|
-
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
3220
|
-
value: { context: this.lowerContext, points: null } });
|
|
3221
3306
|
parent.img.destLeft -= parent.panPoint.totalPannedInternalPoint.x;
|
|
3222
3307
|
parent.img.destTop -= parent.panPoint.totalPannedInternalPoint.y;
|
|
3223
3308
|
parent.togglePen = tempTogglePen;
|
|
@@ -3386,7 +3471,8 @@ var Draw = /** @class */ (function () {
|
|
|
3386
3471
|
parent.afterCropActions = afterCropActions;
|
|
3387
3472
|
if (!this.isCancelAction && !isAfterCropAction) {
|
|
3388
3473
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
3389
|
-
parent.notify('
|
|
3474
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
3475
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
3390
3476
|
parent.img.destLeft = obj.destPoints.startX;
|
|
3391
3477
|
parent.img.destTop = obj.destPoints.startY;
|
|
3392
3478
|
}
|
|
@@ -3426,28 +3512,22 @@ var Draw = /** @class */ (function () {
|
|
|
3426
3512
|
parent.img.destTop = parent.cropObj.destPoints.startY;
|
|
3427
3513
|
var activeObj = extend({}, obj.activeObj, {}, true);
|
|
3428
3514
|
this.lowerContext.filter = 'none';
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
3446
|
-
parent.img.destLeft = destPoints.startX;
|
|
3447
|
-
parent.img.destTop = destPoints.startY;
|
|
3448
|
-
parent.img.destWidth = destPoints.width;
|
|
3449
|
-
parent.img.destHeight = destPoints.height;
|
|
3450
|
-
}
|
|
3515
|
+
parent.img = { destLeft: obj.destPoints.startX, destTop: obj.destPoints.startY, destWidth: obj.destPoints.width,
|
|
3516
|
+
destHeight: obj.destPoints.height, srcLeft: obj.srcPoints.startX, srcTop: obj.srcPoints.startY,
|
|
3517
|
+
srcWidth: obj.srcPoints.width, srcHeight: obj.srcPoints.height };
|
|
3518
|
+
if (obj.activeObj.activePoint.width !== 0 && obj.activeObj.activePoint.height !== 0) {
|
|
3519
|
+
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
|
|
3520
|
+
height: parent.img.destHeight };
|
|
3521
|
+
parent.img.destLeft = obj.activeObj.activePoint.startX;
|
|
3522
|
+
parent.img.destTop = obj.activeObj.activePoint.startY;
|
|
3523
|
+
parent.img.destWidth = obj.activeObj.activePoint.width;
|
|
3524
|
+
parent.img.destHeight = obj.activeObj.activePoint.height;
|
|
3525
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
3526
|
+
value: { ctx: this.lowerContext, shape: 'zoom', pen: 'zoom', isPreventApply: null } });
|
|
3527
|
+
parent.img.destLeft = destPoints.startX;
|
|
3528
|
+
parent.img.destTop = destPoints.startY;
|
|
3529
|
+
parent.img.destWidth = destPoints.width;
|
|
3530
|
+
parent.img.destHeight = destPoints.height;
|
|
3451
3531
|
}
|
|
3452
3532
|
parent.activeObj = activeObj;
|
|
3453
3533
|
this.lowerContext.filter = temp;
|
|
@@ -3511,10 +3591,9 @@ var Draw = /** @class */ (function () {
|
|
|
3511
3591
|
}
|
|
3512
3592
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
3513
3593
|
value: { obj: { selPointColl: cropSelPointColl } } });
|
|
3514
|
-
parent.notify('shape', { prop: '
|
|
3515
|
-
value: {
|
|
3516
|
-
|
|
3517
|
-
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
3594
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
3595
|
+
value: { ctx: this.lowerContext, shape: 'pan', pen: 'pan', x: parent.panPoint.currentPannedPoint.x,
|
|
3596
|
+
y: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
3518
3597
|
}
|
|
3519
3598
|
this.adjustPanning(activeObj);
|
|
3520
3599
|
parent.activeObj = activeObj;
|
|
@@ -3571,17 +3650,15 @@ var Draw = /** @class */ (function () {
|
|
|
3571
3650
|
parent.freehandCounter = parent.pointColl.length;
|
|
3572
3651
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
3573
3652
|
value: { obj: { selPointColl: cropSelPointColl } } });
|
|
3574
|
-
parent.notify('shape', { prop: '
|
|
3575
|
-
value: {
|
|
3576
|
-
|
|
3577
|
-
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
3653
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
3654
|
+
value: { ctx: this.lowerContext, shape: 'pan', pen: 'pan', x: parent.panPoint.currentPannedPoint.x,
|
|
3655
|
+
y: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
3578
3656
|
}
|
|
3579
3657
|
}
|
|
3580
3658
|
};
|
|
3581
3659
|
Draw.prototype.panToSel = function () {
|
|
3582
3660
|
var parent = this.parent;
|
|
3583
3661
|
var activeObj = extend({}, parent.activeObj, {}, true);
|
|
3584
|
-
var img = parent.img;
|
|
3585
3662
|
var _a = activeObj.activePoint, startX = _a.startX, startY = _a.startY, width = _a.width, height = _a.height;
|
|
3586
3663
|
var straightenObj = { straightenPoint: null };
|
|
3587
3664
|
parent.notify('freehand-draw', { prop: 'getStraightenPoint', onPropertyChange: false,
|
|
@@ -3603,6 +3680,7 @@ var Draw = /** @class */ (function () {
|
|
|
3603
3680
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
3604
3681
|
var _b = parent.img, destLeft_3 = _b.destLeft, destTop_3 = _b.destTop, destWidth_3 = _b.destWidth, destHeight_3 = _b.destHeight;
|
|
3605
3682
|
var points = this.imgCanvasPoints;
|
|
3683
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3606
3684
|
points.forEach(function (point) {
|
|
3607
3685
|
point.x = (point.ratioX * destWidth_3) + destLeft_3;
|
|
3608
3686
|
point.y = (point.ratioY * destHeight_3) + destTop_3;
|
|
@@ -3627,8 +3705,8 @@ var Draw = /** @class */ (function () {
|
|
|
3627
3705
|
};
|
|
3628
3706
|
Draw.prototype.drawZoomPanImage = function (x, y) {
|
|
3629
3707
|
var parent = this.parent;
|
|
3630
|
-
parent.notify('shape', { prop: '
|
|
3631
|
-
|
|
3708
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
3709
|
+
value: { ctx: this.lowerContext, shape: 'pan', pen: 'pan', x: x, y: y, panRegion: '' } });
|
|
3632
3710
|
this.renderImage(true);
|
|
3633
3711
|
var obj = { width: 0, height: 0 };
|
|
3634
3712
|
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
@@ -3641,6 +3719,7 @@ var Draw = /** @class */ (function () {
|
|
|
3641
3719
|
parent.notify('crop', { prop: 'setTempFlipPanPoint', onPropertyChange: false, value: { point: { x: 0, y: 0 } } });
|
|
3642
3720
|
};
|
|
3643
3721
|
Draw.prototype.openNewImage = function () {
|
|
3722
|
+
var _this = this;
|
|
3644
3723
|
var parent = this.parent;
|
|
3645
3724
|
var id = parent.element.id;
|
|
3646
3725
|
var inMemoryContext = parent.inMemoryCanvas.getContext('2d');
|
|
@@ -3687,6 +3766,13 @@ var Draw = /** @class */ (function () {
|
|
|
3687
3766
|
}
|
|
3688
3767
|
}
|
|
3689
3768
|
this.imageOnLoad(this.openURL);
|
|
3769
|
+
if (typeof (this.openURL) !== 'string' || this.openURL.indexOf('localhost') === -1) {
|
|
3770
|
+
this.getImageSizeFromURL(this.openURL.toString(), function (imageSizeMB) {
|
|
3771
|
+
if (imageSizeMB !== null) {
|
|
3772
|
+
_this.parent.notify('toolbar', { prop: 'setInitialSize', value: { value: +imageSizeMB } });
|
|
3773
|
+
}
|
|
3774
|
+
});
|
|
3775
|
+
}
|
|
3690
3776
|
}
|
|
3691
3777
|
else {
|
|
3692
3778
|
this.fileName = 'ImageEditor';
|
|
@@ -3704,6 +3790,29 @@ var Draw = /** @class */ (function () {
|
|
|
3704
3790
|
parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
|
|
3705
3791
|
}
|
|
3706
3792
|
};
|
|
3793
|
+
Draw.prototype.getImageSizeFromURL = function (imageUrl, callback) {
|
|
3794
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3795
|
+
var response, contentLength, imageSizeMB, ex_1;
|
|
3796
|
+
return __generator(this, function (_a) {
|
|
3797
|
+
switch (_a.label) {
|
|
3798
|
+
case 0:
|
|
3799
|
+
_a.trys.push([0, 2, , 3]);
|
|
3800
|
+
return [4 /*yield*/, fetch(imageUrl, { method: 'HEAD' })];
|
|
3801
|
+
case 1:
|
|
3802
|
+
response = _a.sent();
|
|
3803
|
+
contentLength = parseInt(response.headers.get('content-length') || '0', 10);
|
|
3804
|
+
imageSizeMB = contentLength;
|
|
3805
|
+
callback(imageSizeMB);
|
|
3806
|
+
return [3 /*break*/, 3];
|
|
3807
|
+
case 2:
|
|
3808
|
+
ex_1 = _a.sent();
|
|
3809
|
+
console.log(ex_1.message);
|
|
3810
|
+
return [3 /*break*/, 3];
|
|
3811
|
+
case 3: return [2 /*return*/];
|
|
3812
|
+
}
|
|
3813
|
+
});
|
|
3814
|
+
});
|
|
3815
|
+
};
|
|
3707
3816
|
Draw.prototype.dlgBtnClick = function () {
|
|
3708
3817
|
this.parent.export();
|
|
3709
3818
|
this.applyDialogOption();
|
|
@@ -3765,7 +3874,10 @@ var Draw = /** @class */ (function () {
|
|
|
3765
3874
|
}
|
|
3766
3875
|
};
|
|
3767
3876
|
Draw.prototype.open = function (data) {
|
|
3768
|
-
document.getElementById(this.parent.element.id + '_dropArea')
|
|
3877
|
+
var dropArea = document.getElementById(this.parent.element.id + '_dropArea');
|
|
3878
|
+
if (dropArea) {
|
|
3879
|
+
dropArea.style.display = 'none';
|
|
3880
|
+
}
|
|
3769
3881
|
if (!this.parent.disabled) {
|
|
3770
3882
|
this.openURL = data;
|
|
3771
3883
|
this.restoreOldImage();
|
|
@@ -3786,7 +3898,10 @@ var Draw = /** @class */ (function () {
|
|
|
3786
3898
|
};
|
|
3787
3899
|
Draw.prototype.fileSelect = function (inputElement, args) {
|
|
3788
3900
|
var parent = this.parent;
|
|
3789
|
-
document.getElementById(parent.element.id + '_dropArea')
|
|
3901
|
+
var dropArea = document.getElementById(parent.element.id + '_dropArea');
|
|
3902
|
+
if (dropArea) {
|
|
3903
|
+
dropArea.style.display = 'none';
|
|
3904
|
+
}
|
|
3790
3905
|
if (!parent.disabled) {
|
|
3791
3906
|
var filesData = void 0;
|
|
3792
3907
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -3829,6 +3944,7 @@ var Draw = /** @class */ (function () {
|
|
|
3829
3944
|
var URL_1 = window.URL;
|
|
3830
3945
|
var url = URL_1.createObjectURL(filesData);
|
|
3831
3946
|
this.openURL = url;
|
|
3947
|
+
// eslint-disable-next-line max-len
|
|
3832
3948
|
if (parent.isImageLoaded && !parent.isChangesSaved && (this.isImageEdited || parent.pointColl.length > 0 || parent.objColl.length > 0)) {
|
|
3833
3949
|
this.isFileChanged = true;
|
|
3834
3950
|
this.showDialogPopup();
|
|
@@ -4293,9 +4409,8 @@ var Draw = /** @class */ (function () {
|
|
|
4293
4409
|
this.isRotateZoom = false;
|
|
4294
4410
|
parent.frameObj.type = 'none';
|
|
4295
4411
|
ctx.filter = 'none';
|
|
4296
|
-
parent.notify('shape', { prop: '
|
|
4297
|
-
|
|
4298
|
-
value: { context: ctx, points: null } });
|
|
4412
|
+
parent.notify('shape', { prop: 'drawAnnotations', onPropertyChange: false,
|
|
4413
|
+
value: { ctx: ctx, shape: 'iterate', pen: 'iterate', isPreventApply: null } });
|
|
4299
4414
|
parent.frameObj.type = 'bevel';
|
|
4300
4415
|
ctx.filter = filter === 'none' ? parent.canvasFilter : filter;
|
|
4301
4416
|
}
|
|
@@ -2,6 +2,7 @@ import { ImageEditor } from '../index';
|
|
|
2
2
|
export declare class Export {
|
|
3
3
|
private parent;
|
|
4
4
|
private lowerContext;
|
|
5
|
+
private imageQuality;
|
|
5
6
|
constructor(parent: ImageEditor);
|
|
6
7
|
destroy(): void;
|
|
7
8
|
private addEventListener;
|
|
@@ -15,6 +16,8 @@ export declare class Export {
|
|
|
15
16
|
private toBlobFn;
|
|
16
17
|
private exportToCanvas;
|
|
17
18
|
private drawAnnotation;
|
|
19
|
+
private drawShape;
|
|
20
|
+
private drawPen;
|
|
18
21
|
private downScaleImgCanvas;
|
|
19
22
|
private updateFrame;
|
|
20
23
|
private downloadImg;
|