@syncfusion/ej2-image-editor 22.1.36 → 22.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/CHANGELOG.md +16 -0
- 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 +351 -278
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +353 -279
- 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 +89 -97
- package/src/image-editor/action/draw.js +88 -71
- package/src/image-editor/action/export.js +49 -66
- package/src/image-editor/action/freehand-draw.js +25 -1
- package/src/image-editor/action/selection.d.ts +1 -0
- package/src/image-editor/action/selection.js +26 -7
- package/src/image-editor/action/shape.d.ts +2 -0
- package/src/image-editor/action/shape.js +51 -22
- package/src/image-editor/action/transform.js +10 -0
- package/src/image-editor/action/undo-redo.js +4 -2
- package/src/image-editor/base/image-editor.js +8 -8
- package/src/image-editor/base/interface.d.ts +6 -2
- package/src/image-editor/renderer/toolbar.js +4 -5
- package/styles/bootstrap-dark.css +20 -8
- package/styles/bootstrap.css +20 -8
- package/styles/bootstrap4.css +20 -8
- package/styles/bootstrap5-dark.css +20 -8
- package/styles/bootstrap5.css +20 -8
- package/styles/fabric-dark.css +20 -8
- package/styles/fabric.css +20 -8
- package/styles/fluent-dark.css +20 -8
- package/styles/fluent.css +20 -8
- package/styles/highcontrast-light.css +20 -8
- package/styles/highcontrast.css +20 -8
- package/styles/image-editor/_layout.scss +20 -2
- package/styles/image-editor/bootstrap-dark.css +20 -8
- package/styles/image-editor/bootstrap.css +20 -8
- package/styles/image-editor/bootstrap4.css +20 -8
- package/styles/image-editor/bootstrap5-dark.css +20 -8
- package/styles/image-editor/bootstrap5.css +20 -8
- package/styles/image-editor/fabric-dark.css +20 -8
- package/styles/image-editor/fabric.css +20 -8
- package/styles/image-editor/fluent-dark.css +20 -8
- package/styles/image-editor/fluent.css +20 -8
- package/styles/image-editor/highcontrast-light.css +20 -8
- package/styles/image-editor/highcontrast.css +20 -8
- package/styles/image-editor/material-dark.css +20 -8
- package/styles/image-editor/material.css +20 -8
- package/styles/image-editor/material3-dark.css +20 -8
- package/styles/image-editor/material3.css +20 -8
- package/styles/image-editor/tailwind-dark.css +20 -8
- package/styles/image-editor/tailwind.css +20 -8
- package/styles/material-dark.css +20 -8
- package/styles/material.css +20 -8
- package/styles/material3-dark.css +20 -8
- package/styles/material3.css +20 -8
- package/styles/tailwind-dark.css +20 -8
- package/styles/tailwind.css +20 -8
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 22.1.
|
|
3
|
+
* version : 22.1.38
|
|
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@
|
|
3
|
+
"_id": "@syncfusion/ej2-image-editor@22.1.37",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-pnIOBRAel6w8cpx97w+1usYXz8emVF6Vhzp7Gqnt+k2DX8J0T6VBP1A887/QCMCZYjZHjpMY6sL+NIA69bdgqg==",
|
|
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-
|
|
27
|
-
"_shasum": "
|
|
26
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-22.1.37.tgz",
|
|
27
|
+
"_shasum": "f11dd540d6652c63f4a94d6073d9a3bebdf47eea",
|
|
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.1.
|
|
36
|
-
"@syncfusion/ej2-buttons": "~
|
|
37
|
-
"@syncfusion/ej2-inputs": "~22.1.
|
|
38
|
-
"@syncfusion/ej2-navigations": "~22.1.
|
|
39
|
-
"@syncfusion/ej2-popups": "~22.1.
|
|
40
|
-
"@syncfusion/ej2-splitbuttons": "~22.1.
|
|
35
|
+
"@syncfusion/ej2-base": "~22.1.38",
|
|
36
|
+
"@syncfusion/ej2-buttons": "~22.1.38",
|
|
37
|
+
"@syncfusion/ej2-inputs": "~22.1.38",
|
|
38
|
+
"@syncfusion/ej2-navigations": "~22.1.38",
|
|
39
|
+
"@syncfusion/ej2-popups": "~22.1.38",
|
|
40
|
+
"@syncfusion/ej2-splitbuttons": "~22.1.37"
|
|
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.1.
|
|
70
|
+
"version": "22.1.38",
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
73
73
|
}
|
|
@@ -19,11 +19,13 @@ export declare class Crop {
|
|
|
19
19
|
private cropImg;
|
|
20
20
|
private updateCropObj;
|
|
21
21
|
private rotateCrop;
|
|
22
|
+
private revertTransform;
|
|
22
23
|
private flipCrop;
|
|
23
24
|
private cropObjColl;
|
|
24
25
|
private cropPointCollection;
|
|
25
26
|
private cropFreehandDrawColl;
|
|
26
27
|
private setCurrSelPoints;
|
|
28
|
+
private panToSelRangle;
|
|
27
29
|
private cropCircle;
|
|
28
30
|
private getCurrCropState;
|
|
29
31
|
private isInitialRotate;
|
|
@@ -41,7 +41,7 @@ var Crop = /** @class */ (function () {
|
|
|
41
41
|
this.crop(args.value['obj']);
|
|
42
42
|
break;
|
|
43
43
|
case 'calcRatio':
|
|
44
|
-
this.calcRatio(args.value['obj']);
|
|
44
|
+
this.calcRatio(args.value['obj'], args.value['dimension']);
|
|
45
45
|
break;
|
|
46
46
|
case 'isObjInImage':
|
|
47
47
|
this.isObjInImage(args.value['obj'], args.value['object']);
|
|
@@ -187,112 +187,74 @@ var Crop = /** @class */ (function () {
|
|
|
187
187
|
Crop.prototype.rotateCrop = function () {
|
|
188
188
|
var parent = this.parent;
|
|
189
189
|
var shape = parent.activeObj.shape || '';
|
|
190
|
-
var tempDegree = parent.transform.degree;
|
|
191
190
|
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
192
191
|
parent.currSelectionPoint = extend({}, parent.activeObj, {}, true);
|
|
193
192
|
parent.objColl.push(parent.activeObj);
|
|
194
193
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
195
|
-
this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
|
|
196
|
-
parent.notify('draw', { prop: 'setClientTransDim', onPropertyChange: false,
|
|
197
|
-
value: { isPreventDimension: null } });
|
|
198
|
-
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
199
|
-
parent.transform.degree = 0;
|
|
200
|
-
var temp = this.lowerContext.filter;
|
|
201
|
-
parent.notify('finetune', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
202
|
-
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);
|
|
203
|
-
this.lowerContext.filter = temp;
|
|
204
|
-
var length = 0;
|
|
205
|
-
if (tempDegree === 90 || tempDegree === -270) {
|
|
206
|
-
length = 3;
|
|
207
|
-
}
|
|
208
|
-
else if (tempDegree === 180 || tempDegree === -180) {
|
|
209
|
-
length = 2;
|
|
210
|
-
}
|
|
211
|
-
else if (tempDegree === 270 || tempDegree === -90) {
|
|
212
|
-
length = 1;
|
|
213
|
-
}
|
|
214
|
-
for (var i = 0; i < length; i++) {
|
|
215
|
-
parent.notify('shape', { prop: 'rotateObjColl', onPropertyChange: false });
|
|
216
|
-
parent.notify('freehand-draw', { prop: 'rotateFhdColl', onPropertyChange: false });
|
|
217
|
-
}
|
|
218
194
|
var activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
parent.transform.degree = tempDegree;
|
|
227
|
-
var flipState = this.getCurrCropState('initial');
|
|
228
|
-
parent.transform.degree = 0;
|
|
229
|
-
parent.notify('shape', { prop: 'redrawObj', onPropertyChange: false, value: { degree: flipState } });
|
|
230
|
-
parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
|
|
231
|
-
value: { value: flipState } });
|
|
232
|
-
}
|
|
233
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
234
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
195
|
+
var tempCurrSelObj = extend({}, parent.currSelectionPoint, {}, true);
|
|
196
|
+
var preventSelObj = { bool: null };
|
|
197
|
+
parent.notify('transform', { prop: 'getPreventSelect', onPropertyChange: false, value: { obj: preventSelObj } });
|
|
198
|
+
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: true } });
|
|
199
|
+
var coll = extend([], parent.rotateFlipColl, [], true);
|
|
200
|
+
this.panToSelRangle(true);
|
|
201
|
+
this.revertTransform('initial', coll);
|
|
235
202
|
activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
236
203
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
237
204
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
238
205
|
parent.objColl.pop();
|
|
239
206
|
parent.transform.degree = 0;
|
|
240
207
|
this.cropImg(true);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
parent.transform
|
|
244
|
-
parent.notify('draw', { prop: '
|
|
245
|
-
parent.notify('draw', { prop: '
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
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);
|
|
249
|
-
this.lowerContext.filter = temp;
|
|
250
|
-
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
251
|
-
value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
|
|
252
|
-
length = 0;
|
|
253
|
-
if (tempDegree === 90 || tempDegree === -270) {
|
|
254
|
-
length = 1;
|
|
255
|
-
}
|
|
256
|
-
else if (tempDegree === 180 || tempDegree === -180) {
|
|
257
|
-
length = 2;
|
|
258
|
-
}
|
|
259
|
-
else if (tempDegree === 270 || tempDegree === -90) {
|
|
260
|
-
length = 3;
|
|
208
|
+
this.revertTransform('reverse', coll);
|
|
209
|
+
parent.currSelectionPoint = tempCurrSelObj;
|
|
210
|
+
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: preventSelObj['bool'] } });
|
|
211
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
212
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
213
|
+
if (shape === 'crop-circle') {
|
|
214
|
+
this.cropCircle(this.lowerContext);
|
|
261
215
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
216
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
217
|
+
parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
|
|
218
|
+
};
|
|
219
|
+
Crop.prototype.revertTransform = function (type, coll) {
|
|
220
|
+
var parent = this.parent;
|
|
221
|
+
var obj = { isRotate: false };
|
|
222
|
+
if (type === 'initial') {
|
|
223
|
+
for (var i = coll.length - 1; i >= 0; i--) {
|
|
224
|
+
switch (coll[i]) {
|
|
225
|
+
case 90:
|
|
226
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
|
|
227
|
+
break;
|
|
228
|
+
case -90:
|
|
229
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
265
236
|
}
|
|
266
|
-
|
|
237
|
+
else {
|
|
267
238
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
268
239
|
parent.objColl[i].shapeFlip = '';
|
|
269
240
|
}
|
|
270
241
|
for (var i = 0; i < parent.freehandCounter; i++) {
|
|
271
242
|
parent.pointColl[i].shapeFlip = '';
|
|
272
243
|
}
|
|
273
|
-
var
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
244
|
+
for (var i = 0, len = coll.length; i < len; i++) {
|
|
245
|
+
switch (coll[i]) {
|
|
246
|
+
case 90:
|
|
247
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
|
|
248
|
+
break;
|
|
249
|
+
case -90:
|
|
250
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
|
|
251
|
+
break;
|
|
252
|
+
default:
|
|
253
|
+
parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
285
256
|
}
|
|
286
257
|
}
|
|
287
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
288
|
-
this.lowerContext.filter = temp;
|
|
289
|
-
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
290
|
-
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
291
|
-
if (shape === 'crop-circle') {
|
|
292
|
-
this.cropCircle(this.lowerContext);
|
|
293
|
-
}
|
|
294
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
295
|
-
parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
|
|
296
258
|
};
|
|
297
259
|
Crop.prototype.flipCrop = function () {
|
|
298
260
|
var parent = this.parent;
|
|
@@ -493,6 +455,15 @@ var Crop = /** @class */ (function () {
|
|
|
493
455
|
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);
|
|
494
456
|
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
495
457
|
value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: true } });
|
|
458
|
+
var cropObjColl = extend([], parent.objColl, null, true);
|
|
459
|
+
var cropPointColl = extend([], parent.pointColl, null, true);
|
|
460
|
+
parent.objColl = [];
|
|
461
|
+
parent.pointColl = [];
|
|
462
|
+
parent.freehandCounter = 0;
|
|
463
|
+
this.panToSelRangle();
|
|
464
|
+
parent.objColl = cropObjColl;
|
|
465
|
+
parent.pointColl = cropPointColl;
|
|
466
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
496
467
|
if (parent.cropObj.activeObj.shape) {
|
|
497
468
|
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
|
|
498
469
|
height: parent.img.destHeight };
|
|
@@ -509,8 +480,8 @@ var Crop = /** @class */ (function () {
|
|
|
509
480
|
parent.img.destWidth = destPoints.width;
|
|
510
481
|
parent.img.destHeight = destPoints.height;
|
|
511
482
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
512
|
-
|
|
513
|
-
|
|
483
|
+
cropObjColl = extend([], parent.objColl, null, true);
|
|
484
|
+
cropPointColl = extend([], parent.pointColl, null, true);
|
|
514
485
|
parent.objColl = [];
|
|
515
486
|
parent.pointColl = [];
|
|
516
487
|
parent.freehandCounter = 0;
|
|
@@ -521,9 +492,12 @@ var Crop = /** @class */ (function () {
|
|
|
521
492
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
522
493
|
value: { obj: { selPointColl: [] } } });
|
|
523
494
|
parent.cropObj.filter = this.lowerContext.filter;
|
|
495
|
+
var actObj = extend({}, parent.currSelectionPoint, null, true);
|
|
524
496
|
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: null } });
|
|
497
|
+
parent.activeObj = extend({}, actObj, null, true);
|
|
525
498
|
var activeObj = extend({}, parent.activeObj, null, true);
|
|
526
499
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
500
|
+
this.panToSelRangle();
|
|
527
501
|
parent.objColl = cropObjColl;
|
|
528
502
|
parent.pointColl = cropPointColl;
|
|
529
503
|
parent.freehandCounter = parent.pointColl.length;
|
|
@@ -555,6 +529,25 @@ var Crop = /** @class */ (function () {
|
|
|
555
529
|
parent.currSelectionPoint = null;
|
|
556
530
|
}
|
|
557
531
|
};
|
|
532
|
+
Crop.prototype.panToSelRangle = function (isReverse) {
|
|
533
|
+
var parent = this.parent;
|
|
534
|
+
var panX = parent.transform.degree === 0 ?
|
|
535
|
+
isReverse ? -parent.cropObj.totalPannedPoint.x : parent.cropObj.totalPannedPoint.x :
|
|
536
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x;
|
|
537
|
+
var panY = parent.transform.degree === 0 ?
|
|
538
|
+
isReverse ? -parent.cropObj.totalPannedPoint.y : parent.cropObj.totalPannedPoint.y :
|
|
539
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
|
|
540
|
+
if (parent.transform.degree === 0) {
|
|
541
|
+
parent.img.destLeft += panX;
|
|
542
|
+
parent.img.destTop += panY;
|
|
543
|
+
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
547
|
+
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
548
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
549
|
+
}
|
|
550
|
+
};
|
|
558
551
|
Crop.prototype.cropCircle = function (context, isSave, isFlip) {
|
|
559
552
|
var parent = this.parent;
|
|
560
553
|
if (isFlip && parent.transform.currFlipState !== '') {
|
|
@@ -563,9 +556,9 @@ var Crop = /** @class */ (function () {
|
|
|
563
556
|
}
|
|
564
557
|
context.globalCompositeOperation = 'destination-in';
|
|
565
558
|
context.beginPath();
|
|
566
|
-
var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) :
|
|
567
|
-
var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) :
|
|
568
|
-
var radius = parent.img.destWidth / 2;
|
|
559
|
+
var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
|
|
560
|
+
var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
|
|
561
|
+
var radius = isSave ? context.canvas.width / 2 : parent.img.destWidth / 2;
|
|
569
562
|
context.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
570
563
|
context.closePath();
|
|
571
564
|
context.fill();
|
|
@@ -744,7 +737,6 @@ var Crop = /** @class */ (function () {
|
|
|
744
737
|
}
|
|
745
738
|
this.cropImg();
|
|
746
739
|
parent.transform.zoomFactor = 0;
|
|
747
|
-
parent.zoomSettings.zoomFactor = 1;
|
|
748
740
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
749
741
|
parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
|
|
750
742
|
value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
|
|
@@ -770,17 +762,17 @@ var Crop = /** @class */ (function () {
|
|
|
770
762
|
}
|
|
771
763
|
}
|
|
772
764
|
};
|
|
773
|
-
Crop.prototype.calcRatio = function (obj) {
|
|
765
|
+
Crop.prototype.calcRatio = function (obj, dimension) {
|
|
774
766
|
var parent = this.parent;
|
|
775
767
|
var widthRatio;
|
|
776
768
|
var heightRatio;
|
|
777
769
|
if (parent.transform.degree === 0 || parent.transform.degree % 180 === 0) {
|
|
778
|
-
widthRatio = parent.baseImg.width / parent.img.destWidth;
|
|
779
|
-
heightRatio = parent.baseImg.height / parent.img.destHeight;
|
|
770
|
+
widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
|
|
771
|
+
heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
|
|
780
772
|
}
|
|
781
773
|
else {
|
|
782
|
-
widthRatio = parent.baseImg.height / parent.img.destWidth;
|
|
783
|
-
heightRatio = parent.baseImg.width / parent.img.destHeight;
|
|
774
|
+
widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
|
|
775
|
+
heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
|
|
784
776
|
}
|
|
785
777
|
if (obj) {
|
|
786
778
|
obj['width'] = widthRatio;
|
|
@@ -286,6 +286,10 @@ var Draw = /** @class */ (function () {
|
|
|
286
286
|
parent.activeObj = extend({}, obj, {}, true);
|
|
287
287
|
}
|
|
288
288
|
this.updateActiveObject();
|
|
289
|
+
if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
|
|
290
|
+
isNullOrUndefined(parent.activeObj.activePoint.startY)) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
289
293
|
if (parent.currObjType.isText) {
|
|
290
294
|
var obj_2 = { keyHistory: '' };
|
|
291
295
|
parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj_2 } });
|
|
@@ -956,12 +960,14 @@ var Draw = /** @class */ (function () {
|
|
|
956
960
|
if (degree < 0) {
|
|
957
961
|
degree = 360 + degree;
|
|
958
962
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
963
|
+
if (parent.activeObj.flipObjColl) {
|
|
964
|
+
for (var i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
|
|
965
|
+
if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
966
|
+
isHorizontalflip = true;
|
|
967
|
+
}
|
|
968
|
+
else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
969
|
+
isVerticalflip = true;
|
|
970
|
+
}
|
|
965
971
|
}
|
|
966
972
|
}
|
|
967
973
|
switch (degree) {
|
|
@@ -1540,17 +1546,18 @@ var Draw = /** @class */ (function () {
|
|
|
1540
1546
|
parent.activeObj.textSettings.fontFamily;
|
|
1541
1547
|
if (parent.activeObj.flipObjColl.length === 4) {
|
|
1542
1548
|
parent.activeObj.flipObjColl = [];
|
|
1549
|
+
parent.activeObj.shapeFlip = '';
|
|
1543
1550
|
}
|
|
1544
1551
|
for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
|
|
1545
1552
|
if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
|
|
1546
1553
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
1547
1554
|
canvasDraw.scale(-1, 1);
|
|
1548
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
1555
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
1549
1556
|
}
|
|
1550
1557
|
else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
|
|
1551
1558
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
1552
1559
|
canvasDraw.scale(1, -1);
|
|
1553
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
1560
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
1554
1561
|
}
|
|
1555
1562
|
}
|
|
1556
1563
|
if (parent.activeObj.shapeDegree !== parent.transform.degree) {
|
|
@@ -1563,12 +1570,12 @@ var Draw = /** @class */ (function () {
|
|
|
1563
1570
|
if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
|
|
1564
1571
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
1565
1572
|
canvasDraw.scale(-1, 1);
|
|
1566
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
1573
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
1567
1574
|
}
|
|
1568
1575
|
else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
|
|
1569
1576
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
1570
1577
|
canvasDraw.scale(1, -1);
|
|
1571
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
1578
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
1572
1579
|
}
|
|
1573
1580
|
}
|
|
1574
1581
|
}
|
|
@@ -1604,6 +1611,7 @@ var Draw = /** @class */ (function () {
|
|
|
1604
1611
|
this.updateActiveObject(actPoint, parent.activeObj);
|
|
1605
1612
|
}
|
|
1606
1613
|
}
|
|
1614
|
+
return actPoint;
|
|
1607
1615
|
};
|
|
1608
1616
|
Draw.prototype.rotateText = function (canvasDraw) {
|
|
1609
1617
|
var parent = this.parent;
|
|
@@ -1617,6 +1625,9 @@ var Draw = /** @class */ (function () {
|
|
|
1617
1625
|
else {
|
|
1618
1626
|
degree = parent.transform.degree - parent.activeObj.shapeDegree;
|
|
1619
1627
|
}
|
|
1628
|
+
if (degree === -450) {
|
|
1629
|
+
degree = -90;
|
|
1630
|
+
}
|
|
1620
1631
|
if (degree < 0) {
|
|
1621
1632
|
degree = 360 + degree;
|
|
1622
1633
|
}
|
|
@@ -2942,11 +2953,8 @@ var Draw = /** @class */ (function () {
|
|
|
2942
2953
|
}
|
|
2943
2954
|
}
|
|
2944
2955
|
else {
|
|
2945
|
-
if (parent.element.querySelector('#' + parent.element.id + '
|
|
2946
|
-
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '
|
|
2947
|
-
}
|
|
2948
|
-
else {
|
|
2949
|
-
parent.toolbarHeight = 0;
|
|
2956
|
+
if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
2957
|
+
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
2950
2958
|
}
|
|
2951
2959
|
}
|
|
2952
2960
|
parent.reset();
|
|
@@ -2989,8 +2997,8 @@ var Draw = /** @class */ (function () {
|
|
|
2989
2997
|
parent.clearContext(this.lowerContext);
|
|
2990
2998
|
parent.clearContext(this.upperContext);
|
|
2991
2999
|
parent.clearContext(inMemoryContext);
|
|
2992
|
-
parent.inMemoryCanvas.width =
|
|
2993
|
-
parent.inMemoryCanvas.height =
|
|
3000
|
+
parent.inMemoryCanvas.width = this.openURL.width;
|
|
3001
|
+
parent.inMemoryCanvas.height = this.openURL.height;
|
|
2994
3002
|
inMemoryContext.putImageData(this.openURL, 0, 0);
|
|
2995
3003
|
parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
|
|
2996
3004
|
}
|
|
@@ -3146,75 +3154,84 @@ var Draw = /** @class */ (function () {
|
|
|
3146
3154
|
Draw.prototype.moveToSelectionRange = function (type, activeObj) {
|
|
3147
3155
|
var parent = this.parent;
|
|
3148
3156
|
if (parent.activeObj.shape) {
|
|
3149
|
-
|
|
3157
|
+
var isRotated = false;
|
|
3158
|
+
for (var i = 0; i < parent.rotateFlipColl.length; i++) {
|
|
3159
|
+
if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
|
|
3160
|
+
isRotated = true;
|
|
3161
|
+
break;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
if (isRotated) {
|
|
3150
3165
|
var zoomFactor = parent.transform.zoomFactor;
|
|
3151
3166
|
parent.objColl.push(parent.activeObj);
|
|
3152
3167
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3153
|
-
if (
|
|
3154
|
-
if (parent.
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3168
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3169
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3170
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3171
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3172
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3173
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3174
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3175
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3176
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3177
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3178
|
+
}
|
|
3179
|
+
break;
|
|
3162
3180
|
}
|
|
3163
|
-
|
|
3181
|
+
zoomFactor += 0.1;
|
|
3182
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3183
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3164
3184
|
}
|
|
3165
|
-
zoomFactor += 0.1;
|
|
3166
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3167
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3168
3185
|
}
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3186
|
+
else {
|
|
3187
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3188
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3189
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3190
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3191
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3192
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3193
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
3194
|
+
}
|
|
3195
|
+
break;
|
|
3178
3196
|
}
|
|
3179
|
-
|
|
3197
|
+
zoomFactor -= .1;
|
|
3198
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3199
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3180
3200
|
}
|
|
3181
|
-
zoomFactor -= .1;
|
|
3182
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3183
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3184
3201
|
}
|
|
3185
3202
|
}
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3203
|
+
else {
|
|
3204
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
3205
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3206
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
3207
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3208
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3209
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3210
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3211
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3212
|
+
}
|
|
3213
|
+
break;
|
|
3196
3214
|
}
|
|
3197
|
-
|
|
3215
|
+
zoomFactor += 0.1;
|
|
3216
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3217
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3198
3218
|
}
|
|
3199
|
-
zoomFactor += 0.1;
|
|
3200
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3201
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3202
3219
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3220
|
+
else {
|
|
3221
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3222
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
3223
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3224
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3225
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3226
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3227
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
3228
|
+
}
|
|
3229
|
+
break;
|
|
3212
3230
|
}
|
|
3213
|
-
|
|
3231
|
+
zoomFactor -= .1;
|
|
3232
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3233
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3214
3234
|
}
|
|
3215
|
-
zoomFactor -= .1;
|
|
3216
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3217
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3218
3235
|
}
|
|
3219
3236
|
}
|
|
3220
3237
|
}
|