@syncfusion/ej2-image-editor 22.1.39 → 22.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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 +216 -117
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +216 -117
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/image-editor/action/crop.d.ts +2 -0
- package/src/image-editor/action/crop.js +41 -27
- package/src/image-editor/action/draw.d.ts +1 -2
- package/src/image-editor/action/draw.js +60 -23
- package/src/image-editor/action/export.js +9 -2
- package/src/image-editor/action/filter.js +1 -8
- package/src/image-editor/action/freehand-draw.d.ts +1 -0
- package/src/image-editor/action/freehand-draw.js +38 -13
- package/src/image-editor/action/selection.js +28 -17
- package/src/image-editor/action/shape.js +31 -25
- package/src/image-editor/action/transform.js +2 -0
- package/src/image-editor/base/image-editor-model.d.ts +4 -4
- package/src/image-editor/base/image-editor.js +3 -2
- package/src/image-editor/base/interface.d.ts +4 -1
- package/src/image-editor/renderer/toolbar.js +3 -1
- package/.eslintrc.json +0 -260
- package/tslint.json +0 -111
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 22.
|
|
3
|
+
* version : 22.2.8
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-image-editor@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-image-editor@22.
|
|
3
|
+
"_id": "@syncfusion/ej2-image-editor@22.2.5",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-sor/6/3oqRiPiTr/G1l7iwiiL0g9iTfMVuLSoEC6vBk/PkySa+J2tARLRQJCYAhYwcNkszv8MShP9be8tL719w==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-image-editor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"/@syncfusion/ej2-react-image-editor",
|
|
24
24
|
"/@syncfusion/ej2-vue-image-editor"
|
|
25
25
|
],
|
|
26
|
-
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-22.
|
|
27
|
-
"_shasum": "
|
|
26
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-22.2.5.tgz",
|
|
27
|
+
"_shasum": "f71e3ab4f343ae4eea0e58e5bb2ba85bed46bab2",
|
|
28
28
|
"_spec": "@syncfusion/ej2-image-editor@*",
|
|
29
29
|
"_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
|
|
30
30
|
"author": {
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"bundleDependencies": false,
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@syncfusion/ej2-base": "~22.
|
|
36
|
-
"@syncfusion/ej2-buttons": "~22.
|
|
37
|
-
"@syncfusion/ej2-inputs": "~22.
|
|
38
|
-
"@syncfusion/ej2-navigations": "~22.
|
|
39
|
-
"@syncfusion/ej2-popups": "~22.
|
|
40
|
-
"@syncfusion/ej2-splitbuttons": "~22.
|
|
35
|
+
"@syncfusion/ej2-base": "~22.2.5",
|
|
36
|
+
"@syncfusion/ej2-buttons": "~22.2.8",
|
|
37
|
+
"@syncfusion/ej2-inputs": "~22.2.7",
|
|
38
|
+
"@syncfusion/ej2-navigations": "~22.2.8",
|
|
39
|
+
"@syncfusion/ej2-popups": "~22.2.7",
|
|
40
|
+
"@syncfusion/ej2-splitbuttons": "~22.2.8"
|
|
41
41
|
},
|
|
42
42
|
"deprecated": false,
|
|
43
43
|
"description": "Essential JS 2 ImageEditor",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
|
|
68
68
|
},
|
|
69
69
|
"typings": "index.d.ts",
|
|
70
|
-
"version": "22.
|
|
70
|
+
"version": "22.2.8",
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
73
73
|
}
|
|
@@ -8,6 +8,7 @@ export declare class Crop {
|
|
|
8
8
|
private cropDestPoints;
|
|
9
9
|
private tempFlipPanPoint;
|
|
10
10
|
private isPreventScaling;
|
|
11
|
+
private isInitCrop;
|
|
11
12
|
constructor(parent: ImageEditor);
|
|
12
13
|
destroy(): void;
|
|
13
14
|
private addEventListener;
|
|
@@ -20,6 +21,7 @@ export declare class Crop {
|
|
|
20
21
|
private updateCropObj;
|
|
21
22
|
private rotateCrop;
|
|
22
23
|
private revertTransform;
|
|
24
|
+
private resetZoom;
|
|
23
25
|
private flipCrop;
|
|
24
26
|
private cropObjColl;
|
|
25
27
|
private cropPointCollection;
|
|
@@ -5,6 +5,7 @@ var Crop = /** @class */ (function () {
|
|
|
5
5
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 }; // To redraw old image when navigate to crop tab
|
|
6
6
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
7
7
|
this.isPreventScaling = false;
|
|
8
|
+
this.isInitCrop = false;
|
|
8
9
|
this.parent = parent;
|
|
9
10
|
this.addEventListener();
|
|
10
11
|
}
|
|
@@ -19,7 +20,7 @@ var Crop = /** @class */ (function () {
|
|
|
19
20
|
this.parent.on('destroyed', this.destroy, this);
|
|
20
21
|
};
|
|
21
22
|
Crop.prototype.removeEventListener = function () {
|
|
22
|
-
this.parent.off('crop', this.
|
|
23
|
+
this.parent.off('crop', this.cropping);
|
|
23
24
|
this.parent.off('destroyed', this.destroy);
|
|
24
25
|
};
|
|
25
26
|
Crop.prototype.cropping = function (args) {
|
|
@@ -93,6 +94,7 @@ var Crop = /** @class */ (function () {
|
|
|
93
94
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 };
|
|
94
95
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
95
96
|
this.isPreventScaling = false;
|
|
97
|
+
this.isInitCrop = false;
|
|
96
98
|
};
|
|
97
99
|
Crop.prototype.cropImg = function (isRotateCrop) {
|
|
98
100
|
var parent = this.parent;
|
|
@@ -146,7 +148,7 @@ var Crop = /** @class */ (function () {
|
|
|
146
148
|
parent.img.destWidth = maxDimension.width;
|
|
147
149
|
parent.img.destHeight = maxDimension.height;
|
|
148
150
|
var temp = this.lowerContext.filter;
|
|
149
|
-
parent.notify('
|
|
151
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
150
152
|
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
151
153
|
this.lowerContext.filter = 'none';
|
|
152
154
|
var activeObj = extend({}, parent.activeObj, {}, true);
|
|
@@ -198,6 +200,8 @@ var Crop = /** @class */ (function () {
|
|
|
198
200
|
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: true } });
|
|
199
201
|
var coll = extend([], parent.rotateFlipColl, [], true);
|
|
200
202
|
this.panToSelRangle(true);
|
|
203
|
+
this.resetZoom();
|
|
204
|
+
var afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
201
205
|
this.revertTransform('initial', coll);
|
|
202
206
|
activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
203
207
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -206,6 +210,7 @@ var Crop = /** @class */ (function () {
|
|
|
206
210
|
parent.transform.degree = 0;
|
|
207
211
|
this.cropImg(true);
|
|
208
212
|
this.revertTransform('reverse', coll);
|
|
213
|
+
parent.afterCropActions = afterCropActions;
|
|
209
214
|
parent.currSelectionPoint = tempCurrSelObj;
|
|
210
215
|
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: preventSelObj['bool'] } });
|
|
211
216
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
@@ -256,18 +261,8 @@ var Crop = /** @class */ (function () {
|
|
|
256
261
|
}
|
|
257
262
|
}
|
|
258
263
|
};
|
|
259
|
-
Crop.prototype.
|
|
264
|
+
Crop.prototype.resetZoom = function () {
|
|
260
265
|
var parent = this.parent;
|
|
261
|
-
parent.notify('transform', { prop: 'setReverseFlip', onPropertyChange: false, value: { isReverseFlip: true } });
|
|
262
|
-
parent.panPoint.totalPannedPoint.x += this.tempFlipPanPoint.x;
|
|
263
|
-
parent.panPoint.totalPannedPoint.y += this.tempFlipPanPoint.y;
|
|
264
|
-
var tempCurrFlipState = parent.transform.currFlipState;
|
|
265
|
-
var obj = { flipColl: null };
|
|
266
|
-
parent.notify('transform', { prop: 'getFlipColl', onPropertyChange: false, value: { obj: obj } });
|
|
267
|
-
var tempFlipColl = obj['flipColl'];
|
|
268
|
-
parent.notify('transform', { prop: 'setFlipColl', onPropertyChange: false, value: { flipColl: [] } });
|
|
269
|
-
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
270
|
-
parent.objColl.push(parent.activeObj);
|
|
271
266
|
if (parent.transform.zoomFactor > 0) {
|
|
272
267
|
var zoomFactor = parent.transform.zoomFactor;
|
|
273
268
|
var isUndoRedo = parent.isUndoRedo;
|
|
@@ -279,11 +274,25 @@ var Crop = /** @class */ (function () {
|
|
|
279
274
|
parent.isUndoRedo = isUndoRedo;
|
|
280
275
|
parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
|
|
281
276
|
}
|
|
277
|
+
};
|
|
278
|
+
Crop.prototype.flipCrop = function () {
|
|
279
|
+
var parent = this.parent;
|
|
280
|
+
parent.notify('transform', { prop: 'setReverseFlip', onPropertyChange: false, value: { isReverseFlip: true } });
|
|
281
|
+
parent.panPoint.totalPannedPoint.x += this.tempFlipPanPoint.x;
|
|
282
|
+
parent.panPoint.totalPannedPoint.y += this.tempFlipPanPoint.y;
|
|
283
|
+
var tempCurrFlipState = parent.transform.currFlipState;
|
|
284
|
+
var obj = { flipColl: null };
|
|
285
|
+
parent.notify('transform', { prop: 'getFlipColl', onPropertyChange: false, value: { obj: obj } });
|
|
286
|
+
var tempFlipColl = obj['flipColl'];
|
|
287
|
+
parent.notify('transform', { prop: 'setFlipColl', onPropertyChange: false, value: { flipColl: [] } });
|
|
288
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
289
|
+
parent.objColl.push(parent.activeObj);
|
|
290
|
+
this.resetZoom();
|
|
282
291
|
parent.currSelectionPoint = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
283
292
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
284
293
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
285
294
|
var temp = this.lowerContext.filter;
|
|
286
|
-
parent.notify('
|
|
295
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
287
296
|
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
288
297
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
289
298
|
parent.objColl[i].shapeFlip = '';
|
|
@@ -304,7 +313,7 @@ var Crop = /** @class */ (function () {
|
|
|
304
313
|
parent.notify('draw', { prop: 'setDestPoints', onPropertyChange: false });
|
|
305
314
|
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
306
315
|
value: { type: 'initial', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
|
|
307
|
-
parent.notify('
|
|
316
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
308
317
|
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
309
318
|
this.lowerContext.filter = temp;
|
|
310
319
|
parent.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: false } });
|
|
@@ -426,6 +435,7 @@ var Crop = /** @class */ (function () {
|
|
|
426
435
|
Crop.prototype.setCurrSelPoints = function (isSetDimension) {
|
|
427
436
|
var parent = this.parent;
|
|
428
437
|
var destPoint = this.cropDestPoints;
|
|
438
|
+
var filter = this.lowerContext.filter;
|
|
429
439
|
parent.img.srcLeft = 0;
|
|
430
440
|
parent.img.srcTop = 0;
|
|
431
441
|
parent.img.srcWidth = parent.baseImg.width;
|
|
@@ -453,6 +463,7 @@ var Crop = /** @class */ (function () {
|
|
|
453
463
|
}
|
|
454
464
|
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
455
465
|
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
466
|
+
this.lowerContext.filter = filter;
|
|
456
467
|
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
457
468
|
value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: true } });
|
|
458
469
|
var cropObjColl = extend([], parent.objColl, null, true);
|
|
@@ -518,6 +529,16 @@ var Crop = /** @class */ (function () {
|
|
|
518
529
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
519
530
|
parent.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
520
531
|
value: { point: null } });
|
|
532
|
+
if (!this.isInitCrop && parent.transform.degree === 0 && parent.cropObj.currFlipState !== '' &&
|
|
533
|
+
parent.cropObj.cropZoom !== 0) {
|
|
534
|
+
this.isInitCrop = true;
|
|
535
|
+
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
536
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'croptransform',
|
|
537
|
+
isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
this.isInitCrop = false;
|
|
541
|
+
}
|
|
521
542
|
}
|
|
522
543
|
else {
|
|
523
544
|
var temp = this.lowerContext.filter;
|
|
@@ -533,18 +554,11 @@ var Crop = /** @class */ (function () {
|
|
|
533
554
|
var parent = this.parent;
|
|
534
555
|
var obj = extend({}, parent.currSelectionPoint, null, true);
|
|
535
556
|
parent.currSelectionPoint = null;
|
|
536
|
-
var panX = parent.transform.degree
|
|
537
|
-
isReverse ? -parent.cropObj.
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
|
|
542
|
-
if (parent.transform.degree === 0) {
|
|
543
|
-
parent.img.destLeft += panX;
|
|
544
|
-
parent.img.destTop += panY;
|
|
545
|
-
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
557
|
+
var panX = parent.transform.degree !== 0 ?
|
|
558
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x : 0;
|
|
559
|
+
var panY = parent.transform.degree !== 0 ?
|
|
560
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y : 0;
|
|
561
|
+
if (parent.transform.degree !== 0) {
|
|
548
562
|
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
549
563
|
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
550
564
|
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
@@ -3,8 +3,6 @@ export declare class Draw {
|
|
|
3
3
|
private parent;
|
|
4
4
|
private lowerContext;
|
|
5
5
|
private upperContext;
|
|
6
|
-
private cancelObjColl;
|
|
7
|
-
private cancelPointColl;
|
|
8
6
|
private isInitialLoading;
|
|
9
7
|
private fileName;
|
|
10
8
|
private fileType;
|
|
@@ -67,6 +65,7 @@ export declare class Draw {
|
|
|
67
65
|
private drawSelection;
|
|
68
66
|
private shapeCircle;
|
|
69
67
|
private shapeLine;
|
|
68
|
+
private manipulateSaveCtx;
|
|
70
69
|
private arrow;
|
|
71
70
|
private arrowSolid;
|
|
72
71
|
private arrowSquareStart;
|
|
@@ -2,8 +2,6 @@ import { extend, isNullOrUndefined, Browser, isBlazor, getComponent } from '@syn
|
|
|
2
2
|
import { Dialog, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
|
|
3
3
|
var Draw = /** @class */ (function () {
|
|
4
4
|
function Draw(parent) {
|
|
5
|
-
this.cancelObjColl = [];
|
|
6
|
-
this.cancelPointColl = [];
|
|
7
5
|
this.isInitialLoading = false; // Specifies whether image is loaded for the first time or not (for applying initial filter)
|
|
8
6
|
this.fileName = '';
|
|
9
7
|
this.isErrorImage = false;
|
|
@@ -223,7 +221,6 @@ var Draw = /** @class */ (function () {
|
|
|
223
221
|
};
|
|
224
222
|
Draw.prototype.reset = function () {
|
|
225
223
|
this.isInitialLoading = this.isErrorImage = this.isNewPath = false;
|
|
226
|
-
this.cancelObjColl = this.cancelPointColl = [];
|
|
227
224
|
this.isShapeTextInserted = false;
|
|
228
225
|
this.initZoomValue = null;
|
|
229
226
|
this.tempFilter = '';
|
|
@@ -1108,12 +1105,30 @@ var Draw = /** @class */ (function () {
|
|
|
1108
1105
|
canvasDraw.stroke();
|
|
1109
1106
|
canvasDraw.lineWidth = tempLineWidth;
|
|
1110
1107
|
};
|
|
1108
|
+
Draw.prototype.manipulateSaveCtx = function (canvasDraw, x, y) {
|
|
1109
|
+
if (canvasDraw !== this.lowerContext && canvasDraw !== this.upperContext) {
|
|
1110
|
+
var obj = { width: 0, height: 0 };
|
|
1111
|
+
this.parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
1112
|
+
value: { obj: obj, dimension: { width: canvasDraw.canvas.width, height: canvasDraw.canvas.height } } });
|
|
1113
|
+
var ratio = obj;
|
|
1114
|
+
if (x) {
|
|
1115
|
+
x *= (ratio.width);
|
|
1116
|
+
}
|
|
1117
|
+
if (y) {
|
|
1118
|
+
y *= (ratio.height);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return { x: x, y: y };
|
|
1122
|
+
};
|
|
1111
1123
|
Draw.prototype.arrow = function (canvasDraw, start) {
|
|
1112
1124
|
var parent = this.parent;
|
|
1113
1125
|
var actPoint = parent.activeObj.activePoint;
|
|
1114
1126
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
1115
|
-
var x = this.arrowDimension['arrow']['width']
|
|
1116
|
-
var y = this.arrowDimension['arrow']['height']
|
|
1127
|
+
var x = this.arrowDimension['arrow']['width'];
|
|
1128
|
+
var y = this.arrowDimension['arrow']['height'];
|
|
1129
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1130
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1131
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1117
1132
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1118
1133
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1119
1134
|
canvasDraw.fillStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
@@ -1148,8 +1163,11 @@ var Draw = /** @class */ (function () {
|
|
|
1148
1163
|
Draw.prototype.arrowSolid = function (canvasDraw, start) {
|
|
1149
1164
|
var parent = this.parent;
|
|
1150
1165
|
var actPoint = parent.activeObj.activePoint;
|
|
1151
|
-
var x = this.arrowDimension['arrowSolid']['width']
|
|
1152
|
-
var y = this.arrowDimension['arrowSolid']['height']
|
|
1166
|
+
var x = this.arrowDimension['arrowSolid']['width'];
|
|
1167
|
+
var y = this.arrowDimension['arrowSolid']['height'];
|
|
1168
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1169
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1170
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1153
1171
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1154
1172
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1155
1173
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -1199,8 +1217,11 @@ var Draw = /** @class */ (function () {
|
|
|
1199
1217
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
1200
1218
|
canvasDraw.beginPath();
|
|
1201
1219
|
canvasDraw.fillStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
1202
|
-
var x = this.arrowDimension['square']['width']
|
|
1203
|
-
var y = this.arrowDimension['square']['height']
|
|
1220
|
+
var x = this.arrowDimension['square']['width'];
|
|
1221
|
+
var y = this.arrowDimension['square']['height'];
|
|
1222
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1223
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1224
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1204
1225
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1205
1226
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1206
1227
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -1255,8 +1276,11 @@ var Draw = /** @class */ (function () {
|
|
|
1255
1276
|
Draw.prototype.arrowSquareEnd = function (canvasDraw) {
|
|
1256
1277
|
var parent = this.parent;
|
|
1257
1278
|
var actPoint = parent.activeObj.activePoint;
|
|
1258
|
-
var x = this.arrowDimension['square']['width']
|
|
1259
|
-
var y = this.arrowDimension['square']['height']
|
|
1279
|
+
var x = this.arrowDimension['square']['width'];
|
|
1280
|
+
var y = this.arrowDimension['square']['height'];
|
|
1281
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1282
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1283
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1260
1284
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1261
1285
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1262
1286
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -1318,7 +1342,9 @@ var Draw = /** @class */ (function () {
|
|
|
1318
1342
|
if ((start && parent.activeObj.triangleDirection === 'left') ||
|
|
1319
1343
|
(!start && parent.activeObj.triangleDirection === 'right')) {
|
|
1320
1344
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
1321
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
1345
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
1346
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
1347
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1322
1348
|
canvasDraw.beginPath();
|
|
1323
1349
|
canvasDraw.arc(actPoint.endX, actPoint.endY, circleRadius, 0, 2 * Math.PI);
|
|
1324
1350
|
canvasDraw.stroke();
|
|
@@ -1366,7 +1392,9 @@ var Draw = /** @class */ (function () {
|
|
|
1366
1392
|
else if ((start && parent.activeObj.triangleDirection === 'right') ||
|
|
1367
1393
|
(!start && parent.activeObj.triangleDirection === 'left')) {
|
|
1368
1394
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
1369
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
1395
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
1396
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
1397
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1370
1398
|
canvasDraw.beginPath();
|
|
1371
1399
|
canvasDraw.arc(actPoint.startX, actPoint.startY, circleRadius, 0, 2 * Math.PI);
|
|
1372
1400
|
canvasDraw.stroke();
|
|
@@ -1424,7 +1452,9 @@ var Draw = /** @class */ (function () {
|
|
|
1424
1452
|
(!start && (parent.activeObj.end === 'circleSolid' && parent.activeObj.start === 'none'))) {
|
|
1425
1453
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
1426
1454
|
}
|
|
1427
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
1455
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
1456
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
1457
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1428
1458
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1429
1459
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1430
1460
|
canvasDraw.save();
|
|
@@ -1445,7 +1475,9 @@ var Draw = /** @class */ (function () {
|
|
|
1445
1475
|
!start && (parent.activeObj.end === 'circleSolid' && parent.activeObj.start === 'none')) {
|
|
1446
1476
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
1447
1477
|
}
|
|
1448
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
1478
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
1479
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
1480
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1449
1481
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1450
1482
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1451
1483
|
canvasDraw.save();
|
|
@@ -1471,8 +1503,11 @@ var Draw = /** @class */ (function () {
|
|
|
1471
1503
|
(parent.activeObj.end === 'bar' && (parent.activeObj.start !== 'circle' && parent.activeObj.start !== 'square'))))) {
|
|
1472
1504
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
1473
1505
|
}
|
|
1474
|
-
var x = this.arrowDimension['bar']['width']
|
|
1475
|
-
var y = this.arrowDimension['bar']['height']
|
|
1506
|
+
var x = this.arrowDimension['bar']['width'];
|
|
1507
|
+
var y = this.arrowDimension['bar']['height'];
|
|
1508
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1509
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1510
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1476
1511
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1477
1512
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1478
1513
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -1493,8 +1528,11 @@ var Draw = /** @class */ (function () {
|
|
|
1493
1528
|
(!start && (parent.activeObj.end === 'bar' && parent.activeObj.start === 'none'))) {
|
|
1494
1529
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
1495
1530
|
}
|
|
1496
|
-
var x = this.arrowDimension['bar']['width']
|
|
1497
|
-
var y = this.arrowDimension['bar']['height']
|
|
1531
|
+
var x = this.arrowDimension['bar']['width'];
|
|
1532
|
+
var y = this.arrowDimension['bar']['height'];
|
|
1533
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1534
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1535
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1498
1536
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1499
1537
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1500
1538
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -2354,8 +2392,6 @@ var Draw = /** @class */ (function () {
|
|
|
2354
2392
|
parent.isCropTab = isCropTab;
|
|
2355
2393
|
this.resetPanPoints();
|
|
2356
2394
|
}
|
|
2357
|
-
this.cancelObjColl = extend([], parent.objColl, [], true);
|
|
2358
|
-
this.cancelPointColl = extend([], parent.pointColl, [], true);
|
|
2359
2395
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
2360
2396
|
parent.isCropTab = true;
|
|
2361
2397
|
parent.isCircleCrop = false;
|
|
@@ -2665,7 +2701,7 @@ var Draw = /** @class */ (function () {
|
|
|
2665
2701
|
parent.afterCropActions = obj.afterCropActions;
|
|
2666
2702
|
}
|
|
2667
2703
|
this.lowerContext.filter = obj.filter;
|
|
2668
|
-
parent.notify('filter', { prop: 'setBrightnessAdjusted', onPropertyChange: false, value: { isBrightnessAdjusted:
|
|
2704
|
+
parent.notify('filter', { prop: 'setBrightnessAdjusted', onPropertyChange: false, value: { isBrightnessAdjusted: obj.isBrightAdjust } });
|
|
2669
2705
|
var isCircleCrop = parent.isCircleCrop;
|
|
2670
2706
|
var currSelectionPoint;
|
|
2671
2707
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
@@ -2761,6 +2797,7 @@ var Draw = /** @class */ (function () {
|
|
|
2761
2797
|
this.setTransformColl(this.lowerContext, 'initial');
|
|
2762
2798
|
}
|
|
2763
2799
|
parent.notify('transform', { prop: 'setDestPointsForFlipState', onPropertyChange: false });
|
|
2800
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
2764
2801
|
this.lowerContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, parent.img.destLeft, parent.img.destTop, parent.img.destWidth, parent.img.destHeight);
|
|
2765
2802
|
if (isObj) {
|
|
2766
2803
|
this.updateCurrTransState('reverse');
|
|
@@ -3088,7 +3125,7 @@ var Draw = /** @class */ (function () {
|
|
|
3088
3125
|
object['isInitialLoaded'] = this.isInitialLoading;
|
|
3089
3126
|
};
|
|
3090
3127
|
Draw.prototype.getFileExtensionFromURL = function (url) {
|
|
3091
|
-
var lastDotIndex = url.lastIndexOf(
|
|
3128
|
+
var lastDotIndex = url.lastIndexOf('.');
|
|
3092
3129
|
if (lastDotIndex !== -1) {
|
|
3093
3130
|
return url.slice(lastDotIndex + 1).toLowerCase();
|
|
3094
3131
|
}
|
|
@@ -190,7 +190,6 @@ var Export = /** @class */ (function () {
|
|
|
190
190
|
id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
|
|
191
191
|
});
|
|
192
192
|
var tempContext = tempCanvas.getContext('2d');
|
|
193
|
-
tempContext.filter = this.lowerContext.filter;
|
|
194
193
|
tempCanvas.width = width;
|
|
195
194
|
tempCanvas.height = height;
|
|
196
195
|
var dimObj = { width: 0, height: 0 };
|
|
@@ -199,9 +198,9 @@ var Export = /** @class */ (function () {
|
|
|
199
198
|
var maxDimension = dimObj;
|
|
200
199
|
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
201
200
|
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
202
|
-
tempContext.filter = this.lowerContext.filter;
|
|
203
201
|
var temp = this.lowerContext.filter;
|
|
204
202
|
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
203
|
+
tempContext.filter = this.lowerContext.filter;
|
|
205
204
|
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
|
|
206
205
|
this.lowerContext.filter = temp;
|
|
207
206
|
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
@@ -232,6 +231,14 @@ var Export = /** @class */ (function () {
|
|
|
232
231
|
if (parent.objColl[i].shape === 'text') {
|
|
233
232
|
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
234
233
|
}
|
|
234
|
+
else if (parent.objColl[i].shape === 'path') {
|
|
235
|
+
for (var l = 0; l < parent.objColl[i].pointColl.length; l++) {
|
|
236
|
+
parent.objColl[i].pointColl[l].x =
|
|
237
|
+
(parent.objColl[i].pointColl[l].x - parent.img.destLeft) * ratio.width;
|
|
238
|
+
parent.objColl[i].pointColl[l].y =
|
|
239
|
+
(parent.objColl[i].pointColl[l].y - parent.img.destTop) * ratio.height;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
235
242
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
|
|
236
243
|
points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
|
|
237
244
|
}
|
|
@@ -421,7 +421,6 @@ var Filter = /** @class */ (function () {
|
|
|
421
421
|
var parent = this.parent;
|
|
422
422
|
parent.notify('freehand-draw', { prop: 'apply-pen-draw', onPropertyChange: false });
|
|
423
423
|
this.adjustmentLevel["" + type] = value;
|
|
424
|
-
var valueMap;
|
|
425
424
|
switch (type) {
|
|
426
425
|
case 'brightness':
|
|
427
426
|
case 'contrast':
|
|
@@ -474,8 +473,6 @@ var Filter = /** @class */ (function () {
|
|
|
474
473
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
|
|
475
474
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
476
475
|
this.updateAdj(type, value);
|
|
477
|
-
var filter = this.lowerContext.filter;
|
|
478
|
-
this.lowerContext.filter = this.appliedFilter;
|
|
479
476
|
parent.notify('undo-redo', {
|
|
480
477
|
prop: 'updateUndoRedoColl',
|
|
481
478
|
onPropertyChange: false,
|
|
@@ -492,7 +489,6 @@ var Filter = /** @class */ (function () {
|
|
|
492
489
|
isCircleCrop: null
|
|
493
490
|
}
|
|
494
491
|
});
|
|
495
|
-
this.lowerContext.filter = filter;
|
|
496
492
|
};
|
|
497
493
|
Filter.prototype.setFilter = function (type) {
|
|
498
494
|
var parent = this.parent;
|
|
@@ -510,15 +506,12 @@ var Filter = /** @class */ (function () {
|
|
|
510
506
|
value: { obj: selPointCollObj } });
|
|
511
507
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
512
508
|
this.updateAdj(type, null);
|
|
513
|
-
var filter = this.lowerContext.filter;
|
|
514
|
-
this.lowerContext.filter = this.appliedFilter;
|
|
515
509
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
516
510
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
517
511
|
value: { operation: type, previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
518
512
|
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
519
513
|
previousCropObj: prevCropObj, previousText: null,
|
|
520
514
|
currentText: null, previousFilter: prevFilter, isCircleCrop: null } });
|
|
521
|
-
this.lowerContext.filter = filter;
|
|
522
515
|
};
|
|
523
516
|
Filter.prototype.setAdjustment = function (type) {
|
|
524
517
|
var splitWords = this.lowerContext.filter.split(' ');
|
|
@@ -671,7 +664,7 @@ var Filter = /** @class */ (function () {
|
|
|
671
664
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
672
665
|
rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
|
|
673
666
|
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
674
|
-
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
667
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: this.isBrightnessAdjusted };
|
|
675
668
|
obj.cropZoom = parent.transform.cropZoomFactor;
|
|
676
669
|
obj.defaultZoom = parent.transform.defaultZoomFactor;
|
|
677
670
|
obj.zoomFactor = parent.zoomSettings.zoomFactor;
|