@syncfusion/ej2-image-editor 22.1.34 → 22.1.37
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 +1018 -1064
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +1016 -1066
- 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 +9 -9
- package/src/image-editor/action/crop.d.ts +1 -0
- package/src/image-editor/action/crop.js +12 -1
- package/src/image-editor/action/draw.d.ts +4 -1
- package/src/image-editor/action/draw.js +137 -127
- package/src/image-editor/action/filter.js +1 -1
- package/src/image-editor/action/freehand-draw.js +9 -9
- package/src/image-editor/action/selection.d.ts +1 -1
- package/src/image-editor/action/selection.js +64 -226
- package/src/image-editor/action/shape.d.ts +1 -0
- package/src/image-editor/action/shape.js +97 -9
- package/src/image-editor/action/transform.js +211 -22
- package/src/image-editor/action/undo-redo.js +9 -7
- package/src/image-editor/base/image-editor-model.d.ts +2 -2
- package/src/image-editor/base/image-editor.d.ts +0 -15
- package/src/image-editor/base/image-editor.js +35 -225
- package/src/image-editor/base/interface.d.ts +11 -3
- package/src/image-editor/renderer/toolbar.js +362 -363
- package/styles/highcontrast-light.css +2 -2
- package/styles/highcontrast.css +6 -1
- package/styles/image-editor/_highcontrast-definition.scss +1 -1
- package/styles/image-editor/_highcontrast-light-definition.scss +1 -1
- package/styles/image-editor/_theme.scss +2 -4
- package/styles/image-editor/highcontrast-light.css +2 -2
- package/styles/image-editor/highcontrast.css +6 -1
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.37
|
|
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.36",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-ckJ9WXGq8Evlr/L+ToszUEaW5o17UvtPdFBxX8U+ZNvAQHyWiJeH0hrSMUTBRnXzwXpqwhIuUQBEIvA61tjOPw==",
|
|
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-
|
|
27
|
-
"_shasum": "
|
|
26
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-22.1.36.tgz",
|
|
27
|
+
"_shasum": "88ab5df13c6b37ffda89a70889cabfc031c1c454",
|
|
28
28
|
"_spec": "@syncfusion/ej2-image-editor@*",
|
|
29
29
|
"_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
|
|
30
30
|
"author": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"bundleDependencies": false,
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@syncfusion/ej2-base": "~22.1.34",
|
|
36
|
-
"@syncfusion/ej2-buttons": "~22.1.
|
|
36
|
+
"@syncfusion/ej2-buttons": "~22.1.36",
|
|
37
37
|
"@syncfusion/ej2-inputs": "~22.1.34",
|
|
38
|
-
"@syncfusion/ej2-navigations": "~22.1.
|
|
39
|
-
"@syncfusion/ej2-popups": "~22.1.
|
|
40
|
-
"@syncfusion/ej2-splitbuttons": "~22.1.
|
|
38
|
+
"@syncfusion/ej2-navigations": "~22.1.36",
|
|
39
|
+
"@syncfusion/ej2-popups": "~22.1.37",
|
|
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.37",
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
73
73
|
}
|
|
@@ -4,6 +4,7 @@ var Crop = /** @class */ (function () {
|
|
|
4
4
|
this.croppedDegree = 0; // Specifies the degree when crop is performed
|
|
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
|
+
this.isPreventScaling = false;
|
|
7
8
|
this.parent = parent;
|
|
8
9
|
this.addEventListener();
|
|
9
10
|
}
|
|
@@ -66,6 +67,9 @@ var Crop = /** @class */ (function () {
|
|
|
66
67
|
this.tempFlipPanPoint.y += args.value['point'].y;
|
|
67
68
|
}
|
|
68
69
|
break;
|
|
70
|
+
case 'getPreventScaling':
|
|
71
|
+
args.value['obj']['bool'] = this.isPreventScaling;
|
|
72
|
+
break;
|
|
69
73
|
case 'reset':
|
|
70
74
|
this.reset();
|
|
71
75
|
break;
|
|
@@ -88,6 +92,7 @@ var Crop = /** @class */ (function () {
|
|
|
88
92
|
this.croppedDegree = 0;
|
|
89
93
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 };
|
|
90
94
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
95
|
+
this.isPreventScaling = false;
|
|
91
96
|
};
|
|
92
97
|
Crop.prototype.cropImg = function (isRotateCrop) {
|
|
93
98
|
var parent = this.parent;
|
|
@@ -705,7 +710,7 @@ var Crop = /** @class */ (function () {
|
|
|
705
710
|
}
|
|
706
711
|
var transitionArgs = { cancel: false, startPoint: { x: parent.activeObj.activePoint.startX,
|
|
707
712
|
y: parent.activeObj.activePoint.startY }, endPoint: { x: parent.activeObj.activePoint.endX,
|
|
708
|
-
y: parent.activeObj.activePoint.endY } };
|
|
713
|
+
y: parent.activeObj.activePoint.endY }, preventScaling: false };
|
|
709
714
|
if (!object_1['isCropToolbar'] && isBlazor() && parent.events && parent.events.cropping.hasDelegate === true) {
|
|
710
715
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
711
716
|
parent.dotNetRef.invokeMethodAsync('CropEventAsync', 'OnCrop', transitionArgs).then(function (args) {
|
|
@@ -731,6 +736,12 @@ var Crop = /** @class */ (function () {
|
|
|
731
736
|
obj.isCrop = true;
|
|
732
737
|
var prevCropObj = extend({}, parent.cropObj, {}, true);
|
|
733
738
|
var prevObj = extend({}, this.prevCropCurrObj, {}, true);
|
|
739
|
+
if (transitionArgs.preventScaling) {
|
|
740
|
+
this.isPreventScaling = true;
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
this.isPreventScaling = false;
|
|
744
|
+
}
|
|
734
745
|
this.cropImg();
|
|
735
746
|
parent.transform.zoomFactor = 0;
|
|
736
747
|
parent.zoomSettings.zoomFactor = 1;
|
|
@@ -87,6 +87,7 @@ export declare class Draw {
|
|
|
87
87
|
private drawImgToCanvas;
|
|
88
88
|
private renderImage;
|
|
89
89
|
private imageOnLoad;
|
|
90
|
+
private errorLoading;
|
|
90
91
|
private updateCanvas;
|
|
91
92
|
private performCancel;
|
|
92
93
|
private cancelItems;
|
|
@@ -94,7 +95,6 @@ export declare class Draw {
|
|
|
94
95
|
private cancelText;
|
|
95
96
|
private cancelShape;
|
|
96
97
|
private cancelSelection;
|
|
97
|
-
private cancelZoom;
|
|
98
98
|
private updateFlipPan;
|
|
99
99
|
private select;
|
|
100
100
|
private drawNewSelection;
|
|
@@ -119,4 +119,7 @@ export declare class Draw {
|
|
|
119
119
|
private getFileExtensionFromURL;
|
|
120
120
|
private fileSelect;
|
|
121
121
|
private checkToolbarTemplate;
|
|
122
|
+
private moveToSelectionRange;
|
|
123
|
+
private isSelectionBiggerThanCanvas;
|
|
124
|
+
private isSelectionOutsideCanvas;
|
|
122
125
|
}
|
|
@@ -173,10 +173,6 @@ var Draw = /** @class */ (function () {
|
|
|
173
173
|
case 'setPrevActObj':
|
|
174
174
|
this.prevActObj = args.value['prevActObj'];
|
|
175
175
|
break;
|
|
176
|
-
case 'getZoomCrop':
|
|
177
|
-
args.value['obj']['width'] = this.zoomCrop.width;
|
|
178
|
-
args.value['obj']['height'] = this.zoomCrop.height;
|
|
179
|
-
break;
|
|
180
176
|
case 'setZoomCropWidth':
|
|
181
177
|
this.zoomCrop.width = args.value['width'];
|
|
182
178
|
this.zoomCrop.height = args.value['height'];
|
|
@@ -205,6 +201,9 @@ var Draw = /** @class */ (function () {
|
|
|
205
201
|
case 'setArrowDimension':
|
|
206
202
|
this.arrowDimension = args.value['arrowDimension'];
|
|
207
203
|
break;
|
|
204
|
+
case 'moveToSelectionRange':
|
|
205
|
+
this.moveToSelectionRange(args.value['type'], args.value['activeObj']);
|
|
206
|
+
break;
|
|
208
207
|
}
|
|
209
208
|
};
|
|
210
209
|
Draw.prototype.getModuleName = function () {
|
|
@@ -492,8 +491,10 @@ var Draw = /** @class */ (function () {
|
|
|
492
491
|
};
|
|
493
492
|
Draw.prototype.adjToCenter = function () {
|
|
494
493
|
var parent = this.parent;
|
|
495
|
-
var diffX = ((parent.lowerCanvas.width) / 2) - (parent.activeObj.activePoint.endX -
|
|
496
|
-
|
|
494
|
+
var diffX = ((parent.lowerCanvas.width) / 2) - (parent.activeObj.activePoint.endX -
|
|
495
|
+
parent.activeObj.activePoint.width / 2);
|
|
496
|
+
var diffY = ((parent.lowerCanvas.height) / 2) - (parent.activeObj.activePoint.endY -
|
|
497
|
+
parent.activeObj.activePoint.height / 2);
|
|
497
498
|
parent.activeObj.activePoint.startX += diffX;
|
|
498
499
|
parent.activeObj.activePoint.endX += diffX;
|
|
499
500
|
parent.activeObj.activePoint.startY += diffY;
|
|
@@ -1940,11 +1941,22 @@ var Draw = /** @class */ (function () {
|
|
|
1940
1941
|
// proxy.reset();
|
|
1941
1942
|
// proxy.parent.baseImg.src = proxy.baseImgSrc;
|
|
1942
1943
|
proxy.isErrorImage = true;
|
|
1944
|
+
proxy.errorLoading();
|
|
1943
1945
|
};
|
|
1944
1946
|
};
|
|
1947
|
+
Draw.prototype.errorLoading = function () {
|
|
1948
|
+
var parent = this.parent;
|
|
1949
|
+
var fileOpened = { fileName: null, fileType: null, isValidImage: false };
|
|
1950
|
+
if (isBlazor() && parent.events && parent.events.fileOpened.hasDelegate === true) {
|
|
1951
|
+
parent.dotNetRef.invokeMethodAsync('FileOpenEventAsync', 'FileOpened', fileOpened);
|
|
1952
|
+
}
|
|
1953
|
+
else {
|
|
1954
|
+
parent.trigger('fileOpened', fileOpened);
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1945
1957
|
Draw.prototype.updateCanvas = function () {
|
|
1946
1958
|
var parent = this.parent;
|
|
1947
|
-
var fileOpened = { fileName: this.fileName, fileType: this.fileType };
|
|
1959
|
+
var fileOpened = { fileName: this.fileName, fileType: this.fileType, isValidImage: true };
|
|
1948
1960
|
parent.img.srcWidth = parent.baseImg.width;
|
|
1949
1961
|
parent.img.srcHeight = parent.baseImg.height;
|
|
1950
1962
|
var obj = { width: 0, height: 0 };
|
|
@@ -2123,10 +2135,6 @@ var Draw = /** @class */ (function () {
|
|
|
2123
2135
|
else if (isCropSelection) {
|
|
2124
2136
|
this.cancelSelection();
|
|
2125
2137
|
}
|
|
2126
|
-
else if ((parent.transform.zoomFactor !== this.tempZoomFactor) || isCropSelection &&
|
|
2127
|
-
isNullOrUndefined(parent.currSelectionPoint)) {
|
|
2128
|
-
this.cancelZoom();
|
|
2129
|
-
}
|
|
2130
2138
|
else {
|
|
2131
2139
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2132
2140
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -2146,7 +2154,6 @@ var Draw = /** @class */ (function () {
|
|
|
2146
2154
|
};
|
|
2147
2155
|
Draw.prototype.cancelPen = function () {
|
|
2148
2156
|
var parent = this.parent;
|
|
2149
|
-
var isCropSelection = false;
|
|
2150
2157
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2151
2158
|
parent.togglePen = false;
|
|
2152
2159
|
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
@@ -2269,114 +2276,6 @@ var Draw = /** @class */ (function () {
|
|
|
2269
2276
|
}
|
|
2270
2277
|
}
|
|
2271
2278
|
};
|
|
2272
|
-
Draw.prototype.cancelZoom = function () {
|
|
2273
|
-
var parent = this.parent;
|
|
2274
|
-
var length = parent.transform.cropZoomFactor - this.tempZoomFactor;
|
|
2275
|
-
parent.transform.zoomFactor = parent.transform.cropZoomFactor;
|
|
2276
|
-
if (isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
2277
|
-
if ((parent.transform.degree === 0 && parent.panPoint.totalPannedPoint.x === 0 && parent.panPoint.totalPannedPoint.y === 0)
|
|
2278
|
-
|| (parent.transform.degree !== 0 && parent.panPoint.totalPannedInternalPoint.x === 0 &&
|
|
2279
|
-
parent.panPoint.totalPannedInternalPoint.y === 0 && parent.panPoint.totalPannedClientPoint.x === 0 &&
|
|
2280
|
-
parent.panPoint.totalPannedClientPoint.y === 0)) {
|
|
2281
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2282
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2283
|
-
if (length > 0) {
|
|
2284
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2285
|
-
value: { zoomFactor: -length, zoomPoint: null } });
|
|
2286
|
-
}
|
|
2287
|
-
else {
|
|
2288
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2289
|
-
value: { zoomFactor: Math.abs(length), zoomPoint: null } });
|
|
2290
|
-
}
|
|
2291
|
-
parent.transform.cropZoomFactor = this.tempZoomFactor;
|
|
2292
|
-
parent.currObjType.isCustomCrop = false;
|
|
2293
|
-
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
2294
|
-
parent.currObjType.isCustomCrop = false;
|
|
2295
|
-
this.tempStrokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
2296
|
-
var eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
|
|
2297
|
-
if (!isBlazor()) {
|
|
2298
|
-
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
|
|
2299
|
-
}
|
|
2300
|
-
else {
|
|
2301
|
-
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
2302
|
-
}
|
|
2303
|
-
return;
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
if (isNullOrUndefined(parent.cropObj.activeObj.shape)) {
|
|
2307
|
-
if (parent.transform.degree === 0) {
|
|
2308
|
-
var activeObj = extend({}, parent.activeObj, {});
|
|
2309
|
-
parent.img.destLeft += (-parent.panPoint.totalPannedPoint.x);
|
|
2310
|
-
parent.img.destTop += (-parent.panPoint.totalPannedPoint.y);
|
|
2311
|
-
parent.notify('transform', { prop: 'drawPannImage', onPropertyChange: false,
|
|
2312
|
-
value: { point: { x: -parent.panPoint.totalPannedPoint.x, y: -parent.panPoint.totalPannedPoint.y } } });
|
|
2313
|
-
this.updateFlipPan(activeObj);
|
|
2314
|
-
parent.panPoint.totalPannedPoint = { x: 0, y: 0 };
|
|
2315
|
-
}
|
|
2316
|
-
else {
|
|
2317
|
-
parent.panPoint.totalPannedClientPoint = { x: -parent.panPoint.totalPannedClientPoint.x,
|
|
2318
|
-
y: -parent.panPoint.totalPannedClientPoint.y };
|
|
2319
|
-
parent.panPoint.totalPannedInternalPoint = { x: -parent.panPoint.totalPannedInternalPoint.x,
|
|
2320
|
-
y: -parent.panPoint.totalPannedInternalPoint.y };
|
|
2321
|
-
parent.notify('transform', { prop: 'rotatePan', onPropertyChange: false,
|
|
2322
|
-
value: { isCropSelection: true, isDefaultZoom: null } });
|
|
2323
|
-
parent.panPoint.totalPannedClientPoint = { x: 0, y: 0 };
|
|
2324
|
-
parent.panPoint.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
2325
|
-
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
2326
|
-
}
|
|
2327
|
-
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
2328
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
2329
|
-
if (length > 0) {
|
|
2330
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2331
|
-
value: { zoomFactor: -length, zoomPoint: null } });
|
|
2332
|
-
}
|
|
2333
|
-
else {
|
|
2334
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
2335
|
-
value: { zoomFactor: Math.abs(length), zoomPoint: null } });
|
|
2336
|
-
}
|
|
2337
|
-
parent.transform.cropZoomFactor = this.tempZoomFactor;
|
|
2338
|
-
}
|
|
2339
|
-
else {
|
|
2340
|
-
this.isCancelAction = true;
|
|
2341
|
-
parent.objColl = [];
|
|
2342
|
-
parent.pointColl = [];
|
|
2343
|
-
var freehandCounter = parent.freehandCounter;
|
|
2344
|
-
parent.freehandCounter = 0;
|
|
2345
|
-
var object = { selPointColl: null };
|
|
2346
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
2347
|
-
value: { obj: object } });
|
|
2348
|
-
var cropSelPointColl = object['selPointColl'];
|
|
2349
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
2350
|
-
value: { obj: { selPointColl: [] } } });
|
|
2351
|
-
var cropObj = extend({}, parent.cropObj, {});
|
|
2352
|
-
var afterCropActions = extend([], parent.afterCropActions, {}, true);
|
|
2353
|
-
this.setCurrentObj();
|
|
2354
|
-
parent.notify('crop', { prop: 'cropImg', onPropertyChange: false, value: { isRotateCrop: null } });
|
|
2355
|
-
parent.cropObj = cropObj;
|
|
2356
|
-
parent.afterCropActions = afterCropActions;
|
|
2357
|
-
parent.objColl = extend([], this.cancelObjColl, [], true);
|
|
2358
|
-
parent.pointColl = extend([], this.cancelPointColl, [], true);
|
|
2359
|
-
parent.freehandCounter = freehandCounter;
|
|
2360
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
2361
|
-
value: { obj: { selPointColl: cropSelPointColl } } });
|
|
2362
|
-
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
2363
|
-
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
2364
|
-
value: { context: this.lowerContext, points: null } });
|
|
2365
|
-
this.clearOuterCanvas(this.lowerContext);
|
|
2366
|
-
if (parent.isCircleCrop) {
|
|
2367
|
-
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
2368
|
-
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
2369
|
-
}
|
|
2370
|
-
this.isCancelAction = false;
|
|
2371
|
-
}
|
|
2372
|
-
parent.transform.zoomFactor = parent.transform.defaultZoomFactor;
|
|
2373
|
-
if (!isBlazor()) {
|
|
2374
|
-
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
2375
|
-
}
|
|
2376
|
-
else {
|
|
2377
|
-
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
2279
|
Draw.prototype.updateFlipPan = function (tempSelectionObj) {
|
|
2381
2280
|
var parent = this.parent;
|
|
2382
2281
|
if (parent.transform.currFlipState !== '') {
|
|
@@ -3038,13 +2937,8 @@ var Draw = /** @class */ (function () {
|
|
|
3038
2937
|
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
|
|
3039
2938
|
if (obj['defToolbarItems'].length === 0 &&
|
|
3040
2939
|
(isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
}
|
|
3044
|
-
else if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
3045
|
-
var height = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3046
|
-
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
|
|
3047
|
-
}
|
|
2940
|
+
var height = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
2941
|
+
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: height } });
|
|
3048
2942
|
}
|
|
3049
2943
|
}
|
|
3050
2944
|
else {
|
|
@@ -3201,6 +3095,7 @@ var Draw = /** @class */ (function () {
|
|
|
3201
3095
|
var fileData = filesData;
|
|
3202
3096
|
var fileExtension = fileData.name && fileData.name.split('.')[1].toLowerCase();
|
|
3203
3097
|
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
3098
|
+
this.errorLoading();
|
|
3204
3099
|
return;
|
|
3205
3100
|
}
|
|
3206
3101
|
showSpinner(parent.element);
|
|
@@ -3248,6 +3143,121 @@ var Draw = /** @class */ (function () {
|
|
|
3248
3143
|
this.imageOnLoad(url.toString());
|
|
3249
3144
|
inputElement.value = '';
|
|
3250
3145
|
};
|
|
3146
|
+
Draw.prototype.moveToSelectionRange = function (type, activeObj) {
|
|
3147
|
+
var parent = this.parent;
|
|
3148
|
+
if (parent.activeObj.shape) {
|
|
3149
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3150
|
+
var zoomFactor = parent.transform.zoomFactor;
|
|
3151
|
+
parent.objColl.push(parent.activeObj);
|
|
3152
|
+
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3153
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3154
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3155
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3156
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3157
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3158
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3159
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3160
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3161
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3162
|
+
}
|
|
3163
|
+
break;
|
|
3164
|
+
}
|
|
3165
|
+
zoomFactor += 0.1;
|
|
3166
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3167
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
else {
|
|
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;
|
|
3180
|
+
}
|
|
3181
|
+
zoomFactor -= .1;
|
|
3182
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3183
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
else {
|
|
3188
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
3189
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3190
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
3191
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3192
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3193
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3194
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3195
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3196
|
+
}
|
|
3197
|
+
break;
|
|
3198
|
+
}
|
|
3199
|
+
zoomFactor += 0.1;
|
|
3200
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3201
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
else {
|
|
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;
|
|
3214
|
+
}
|
|
3215
|
+
zoomFactor -= .1;
|
|
3216
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3217
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
var panX = (parent.lowerCanvas.clientWidth / 2) - (parent.objColl[parent.objColl.length - 1].activePoint.startX +
|
|
3222
|
+
(parent.objColl[parent.objColl.length - 1].activePoint.width / 2));
|
|
3223
|
+
var panY = (parent.lowerCanvas.clientHeight / 2) - (parent.objColl[parent.objColl.length - 1].activePoint.startY +
|
|
3224
|
+
(parent.objColl[parent.objColl.length - 1].activePoint.height / 2));
|
|
3225
|
+
if (parent.transform.degree === 0) {
|
|
3226
|
+
parent.img.destLeft += panX;
|
|
3227
|
+
parent.img.destTop += panY;
|
|
3228
|
+
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
3229
|
+
}
|
|
3230
|
+
else {
|
|
3231
|
+
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
3232
|
+
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
3233
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
3234
|
+
}
|
|
3235
|
+
parent.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
3236
|
+
value: { point: null } });
|
|
3237
|
+
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1]);
|
|
3238
|
+
parent.objColl.pop();
|
|
3239
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
Draw.prototype.isSelectionBiggerThanCanvas = function (obj) {
|
|
3244
|
+
var isBigger = false;
|
|
3245
|
+
if (obj.activePoint.startX <= this.parent.img.destLeft ||
|
|
3246
|
+
obj.activePoint.startY <= this.parent.img.destTop ||
|
|
3247
|
+
obj.activePoint.endX >= this.parent.img.destLeft + this.parent.img.destWidth ||
|
|
3248
|
+
obj.activePoint.endY >= this.parent.img.destTop + this.parent.img.destHeight) {
|
|
3249
|
+
isBigger = true;
|
|
3250
|
+
}
|
|
3251
|
+
return isBigger;
|
|
3252
|
+
};
|
|
3253
|
+
Draw.prototype.isSelectionOutsideCanvas = function (obj) {
|
|
3254
|
+
var isOutside = false;
|
|
3255
|
+
if ((obj.activePoint.height < this.parent.lowerCanvas.height - this.parent.toolbarHeight) ||
|
|
3256
|
+
(obj.activePoint.width < this.parent.lowerCanvas.width)) {
|
|
3257
|
+
isOutside = true;
|
|
3258
|
+
}
|
|
3259
|
+
return isOutside;
|
|
3260
|
+
};
|
|
3251
3261
|
return Draw;
|
|
3252
3262
|
}());
|
|
3253
3263
|
export { Draw };
|
|
@@ -89,7 +89,7 @@ var Filter = /** @class */ (function () {
|
|
|
89
89
|
};
|
|
90
90
|
Filter.prototype.updatePrivateVariables = function () {
|
|
91
91
|
var parent = this.parent;
|
|
92
|
-
if (
|
|
92
|
+
if (parent.lowerCanvas) {
|
|
93
93
|
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
94
94
|
}
|
|
95
95
|
};
|
|
@@ -702,7 +702,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
702
702
|
FreehandDrawing.prototype.updateFHDCurPts = function () {
|
|
703
703
|
var parent = this.parent;
|
|
704
704
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
705
|
-
if (
|
|
705
|
+
if (this.selPointColl[n]) {
|
|
706
706
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
707
707
|
this.pointCounter = 0;
|
|
708
708
|
var len = this.selPoints.length;
|
|
@@ -730,7 +730,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
730
730
|
}
|
|
731
731
|
// Update rotation points for each point for cursor styles
|
|
732
732
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
733
|
-
if (
|
|
733
|
+
if (this.selPointColl[n]) {
|
|
734
734
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
735
735
|
this.pointCounter = 0;
|
|
736
736
|
var len = this.selPoints.length;
|
|
@@ -786,7 +786,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
786
786
|
}
|
|
787
787
|
// Update flip value for each points for cursor styles
|
|
788
788
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
789
|
-
if (
|
|
789
|
+
if (this.selPointColl[n]) {
|
|
790
790
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
791
791
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
792
792
|
this.pointCounter = 0;
|
|
@@ -833,7 +833,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
833
833
|
}
|
|
834
834
|
// Update flip value for each points for cursor styles
|
|
835
835
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
836
|
-
if (
|
|
836
|
+
if (this.selPointColl[n]) {
|
|
837
837
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
838
838
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
839
839
|
this.pointCounter = 0;
|
|
@@ -884,7 +884,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
887
|
-
if (
|
|
887
|
+
if (this.selPointColl[n]) {
|
|
888
888
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
889
889
|
this.pointCounter = 0;
|
|
890
890
|
var len = this.selPoints.length;
|
|
@@ -919,7 +919,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
919
919
|
}
|
|
920
920
|
// Updating each points for cursor styles for panning
|
|
921
921
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
922
|
-
if (
|
|
922
|
+
if (this.selPointColl[n]) {
|
|
923
923
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
924
924
|
this.pointCounter = 0;
|
|
925
925
|
var len = this.selPoints.length;
|
|
@@ -982,13 +982,13 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
982
982
|
FreehandDrawing.prototype.isFHDIdx = function (index, obj) {
|
|
983
983
|
var isIndex = false;
|
|
984
984
|
for (var i = 0; i < this.parent.freehandCounter; i++) {
|
|
985
|
-
if (
|
|
985
|
+
if (this.parent.pointColl[i].id &&
|
|
986
986
|
parseInt(this.parent.pointColl[i].id.split('_')[1], 10) - 1 === index) {
|
|
987
987
|
isIndex = true;
|
|
988
988
|
break;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
if (
|
|
991
|
+
if (obj) {
|
|
992
992
|
obj['isIndex'] = isIndex;
|
|
993
993
|
}
|
|
994
994
|
return isIndex;
|
|
@@ -997,7 +997,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
997
997
|
var parent = this.parent;
|
|
998
998
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
999
999
|
var obj = { selPointColl: extend([], this.selPointColl) };
|
|
1000
|
-
if (
|
|
1000
|
+
if (obj['selPointColl'][n]) {
|
|
1001
1001
|
this.selPoints = extend([], obj['selPointColl'][n].points, []);
|
|
1002
1002
|
this.pointCounter = 0;
|
|
1003
1003
|
var len = this.selPoints.length;
|
|
@@ -109,11 +109,11 @@ export declare class Selection {
|
|
|
109
109
|
private canvasMouseMoveHandler;
|
|
110
110
|
private canvasMouseUpHandler;
|
|
111
111
|
private touchStartHandler;
|
|
112
|
+
private unwireEvent;
|
|
112
113
|
private keyDownEventHandler;
|
|
113
114
|
private isKeyBoardCrop;
|
|
114
115
|
private beforeSaveEvent;
|
|
115
116
|
private handleScroll;
|
|
116
|
-
private adjustToScreen;
|
|
117
117
|
private textKeyDown;
|
|
118
118
|
private clearSelection;
|
|
119
119
|
private setDragDirection;
|