@syncfusion/ej2-image-editor 22.1.39 → 22.2.5
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 +8 -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 +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
|
@@ -10,6 +10,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
10
10
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 }; // To redraw old image when navigate to crop tab
|
|
11
11
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
12
12
|
this.isPreventScaling = false;
|
|
13
|
+
this.isInitCrop = false;
|
|
13
14
|
this.parent = parent;
|
|
14
15
|
this.addEventListener();
|
|
15
16
|
}
|
|
@@ -24,7 +25,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
24
25
|
this.parent.on('destroyed', this.destroy, this);
|
|
25
26
|
};
|
|
26
27
|
Crop.prototype.removeEventListener = function () {
|
|
27
|
-
this.parent.off('crop', this.
|
|
28
|
+
this.parent.off('crop', this.cropping);
|
|
28
29
|
this.parent.off('destroyed', this.destroy);
|
|
29
30
|
};
|
|
30
31
|
Crop.prototype.cropping = function (args) {
|
|
@@ -98,6 +99,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
98
99
|
this.cropDestPoints = { startX: 0, startY: 0, width: 0, height: 0 };
|
|
99
100
|
this.tempFlipPanPoint = { x: 0, y: 0 };
|
|
100
101
|
this.isPreventScaling = false;
|
|
102
|
+
this.isInitCrop = false;
|
|
101
103
|
};
|
|
102
104
|
Crop.prototype.cropImg = function (isRotateCrop) {
|
|
103
105
|
var parent = this.parent;
|
|
@@ -151,7 +153,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
151
153
|
parent.img.destWidth = maxDimension.width;
|
|
152
154
|
parent.img.destHeight = maxDimension.height;
|
|
153
155
|
var temp = this.lowerContext.filter;
|
|
154
|
-
parent.notify('
|
|
156
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
155
157
|
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);
|
|
156
158
|
this.lowerContext.filter = 'none';
|
|
157
159
|
var activeObj = extend({}, parent.activeObj, {}, true);
|
|
@@ -203,6 +205,8 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
203
205
|
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: true } });
|
|
204
206
|
var coll = extend([], parent.rotateFlipColl, [], true);
|
|
205
207
|
this.panToSelRangle(true);
|
|
208
|
+
this.resetZoom();
|
|
209
|
+
var afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
206
210
|
this.revertTransform('initial', coll);
|
|
207
211
|
activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
208
212
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -211,6 +215,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
211
215
|
parent.transform.degree = 0;
|
|
212
216
|
this.cropImg(true);
|
|
213
217
|
this.revertTransform('reverse', coll);
|
|
218
|
+
parent.afterCropActions = afterCropActions;
|
|
214
219
|
parent.currSelectionPoint = tempCurrSelObj;
|
|
215
220
|
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: preventSelObj['bool'] } });
|
|
216
221
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
@@ -261,18 +266,8 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
};
|
|
264
|
-
Crop.prototype.
|
|
269
|
+
Crop.prototype.resetZoom = function () {
|
|
265
270
|
var parent = this.parent;
|
|
266
|
-
parent.notify('transform', { prop: 'setReverseFlip', onPropertyChange: false, value: { isReverseFlip: true } });
|
|
267
|
-
parent.panPoint.totalPannedPoint.x += this.tempFlipPanPoint.x;
|
|
268
|
-
parent.panPoint.totalPannedPoint.y += this.tempFlipPanPoint.y;
|
|
269
|
-
var tempCurrFlipState = parent.transform.currFlipState;
|
|
270
|
-
var obj = { flipColl: null };
|
|
271
|
-
parent.notify('transform', { prop: 'getFlipColl', onPropertyChange: false, value: { obj: obj } });
|
|
272
|
-
var tempFlipColl = obj['flipColl'];
|
|
273
|
-
parent.notify('transform', { prop: 'setFlipColl', onPropertyChange: false, value: { flipColl: [] } });
|
|
274
|
-
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
275
|
-
parent.objColl.push(parent.activeObj);
|
|
276
271
|
if (parent.transform.zoomFactor > 0) {
|
|
277
272
|
var zoomFactor = parent.transform.zoomFactor;
|
|
278
273
|
var isUndoRedo = parent.isUndoRedo;
|
|
@@ -284,11 +279,25 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
284
279
|
parent.isUndoRedo = isUndoRedo;
|
|
285
280
|
parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
|
|
286
281
|
}
|
|
282
|
+
};
|
|
283
|
+
Crop.prototype.flipCrop = function () {
|
|
284
|
+
var parent = this.parent;
|
|
285
|
+
parent.notify('transform', { prop: 'setReverseFlip', onPropertyChange: false, value: { isReverseFlip: true } });
|
|
286
|
+
parent.panPoint.totalPannedPoint.x += this.tempFlipPanPoint.x;
|
|
287
|
+
parent.panPoint.totalPannedPoint.y += this.tempFlipPanPoint.y;
|
|
288
|
+
var tempCurrFlipState = parent.transform.currFlipState;
|
|
289
|
+
var obj = { flipColl: null };
|
|
290
|
+
parent.notify('transform', { prop: 'getFlipColl', onPropertyChange: false, value: { obj: obj } });
|
|
291
|
+
var tempFlipColl = obj['flipColl'];
|
|
292
|
+
parent.notify('transform', { prop: 'setFlipColl', onPropertyChange: false, value: { flipColl: [] } });
|
|
293
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
294
|
+
parent.objColl.push(parent.activeObj);
|
|
295
|
+
this.resetZoom();
|
|
287
296
|
parent.currSelectionPoint = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
288
297
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
289
298
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
290
299
|
var temp = this.lowerContext.filter;
|
|
291
|
-
parent.notify('
|
|
300
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
292
301
|
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);
|
|
293
302
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
294
303
|
parent.objColl[i].shapeFlip = '';
|
|
@@ -309,7 +318,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
309
318
|
parent.notify('draw', { prop: 'setDestPoints', onPropertyChange: false });
|
|
310
319
|
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
311
320
|
value: { type: 'initial', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
|
|
312
|
-
parent.notify('
|
|
321
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
313
322
|
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);
|
|
314
323
|
this.lowerContext.filter = temp;
|
|
315
324
|
parent.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: false } });
|
|
@@ -431,6 +440,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
431
440
|
Crop.prototype.setCurrSelPoints = function (isSetDimension) {
|
|
432
441
|
var parent = this.parent;
|
|
433
442
|
var destPoint = this.cropDestPoints;
|
|
443
|
+
var filter = this.lowerContext.filter;
|
|
434
444
|
parent.img.srcLeft = 0;
|
|
435
445
|
parent.img.srcTop = 0;
|
|
436
446
|
parent.img.srcWidth = parent.baseImg.width;
|
|
@@ -458,6 +468,7 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
458
468
|
}
|
|
459
469
|
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
460
470
|
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);
|
|
471
|
+
this.lowerContext.filter = filter;
|
|
461
472
|
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
462
473
|
value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: true } });
|
|
463
474
|
var cropObjColl = extend([], parent.objColl, null, true);
|
|
@@ -523,6 +534,16 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
523
534
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
524
535
|
parent.notify('transform', { prop: 'setTempPanMove', onPropertyChange: false,
|
|
525
536
|
value: { point: null } });
|
|
537
|
+
if (!this.isInitCrop && parent.transform.degree === 0 && parent.cropObj.currFlipState !== '' &&
|
|
538
|
+
parent.cropObj.cropZoom !== 0) {
|
|
539
|
+
this.isInitCrop = true;
|
|
540
|
+
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
541
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'croptransform',
|
|
542
|
+
isApplyBtn: false, isCropping: null, isZooming: null, cType: null } });
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
this.isInitCrop = false;
|
|
546
|
+
}
|
|
526
547
|
}
|
|
527
548
|
else {
|
|
528
549
|
var temp = this.lowerContext.filter;
|
|
@@ -538,18 +559,11 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
538
559
|
var parent = this.parent;
|
|
539
560
|
var obj = extend({}, parent.currSelectionPoint, null, true);
|
|
540
561
|
parent.currSelectionPoint = null;
|
|
541
|
-
var panX = parent.transform.degree
|
|
542
|
-
isReverse ? -parent.cropObj.
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
|
|
547
|
-
if (parent.transform.degree === 0) {
|
|
548
|
-
parent.img.destLeft += panX;
|
|
549
|
-
parent.img.destTop += panY;
|
|
550
|
-
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
562
|
+
var panX = parent.transform.degree !== 0 ?
|
|
563
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x : 0;
|
|
564
|
+
var panY = parent.transform.degree !== 0 ?
|
|
565
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y : 0;
|
|
566
|
+
if (parent.transform.degree !== 0) {
|
|
553
567
|
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
554
568
|
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
555
569
|
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
@@ -829,8 +843,6 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
829
843
|
|
|
830
844
|
var Draw = /** @__PURE__ @class */ (function () {
|
|
831
845
|
function Draw(parent) {
|
|
832
|
-
this.cancelObjColl = [];
|
|
833
|
-
this.cancelPointColl = [];
|
|
834
846
|
this.isInitialLoading = false; // Specifies whether image is loaded for the first time or not (for applying initial filter)
|
|
835
847
|
this.fileName = '';
|
|
836
848
|
this.isErrorImage = false;
|
|
@@ -1050,7 +1062,6 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1050
1062
|
};
|
|
1051
1063
|
Draw.prototype.reset = function () {
|
|
1052
1064
|
this.isInitialLoading = this.isErrorImage = this.isNewPath = false;
|
|
1053
|
-
this.cancelObjColl = this.cancelPointColl = [];
|
|
1054
1065
|
this.isShapeTextInserted = false;
|
|
1055
1066
|
this.initZoomValue = null;
|
|
1056
1067
|
this.tempFilter = '';
|
|
@@ -1935,12 +1946,30 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1935
1946
|
canvasDraw.stroke();
|
|
1936
1947
|
canvasDraw.lineWidth = tempLineWidth;
|
|
1937
1948
|
};
|
|
1949
|
+
Draw.prototype.manipulateSaveCtx = function (canvasDraw, x, y) {
|
|
1950
|
+
if (canvasDraw !== this.lowerContext && canvasDraw !== this.upperContext) {
|
|
1951
|
+
var obj = { width: 0, height: 0 };
|
|
1952
|
+
this.parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
1953
|
+
value: { obj: obj, dimension: { width: canvasDraw.canvas.width, height: canvasDraw.canvas.height } } });
|
|
1954
|
+
var ratio = obj;
|
|
1955
|
+
if (x) {
|
|
1956
|
+
x *= (ratio.width);
|
|
1957
|
+
}
|
|
1958
|
+
if (y) {
|
|
1959
|
+
y *= (ratio.height);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
return { x: x, y: y };
|
|
1963
|
+
};
|
|
1938
1964
|
Draw.prototype.arrow = function (canvasDraw, start) {
|
|
1939
1965
|
var parent = this.parent;
|
|
1940
1966
|
var actPoint = parent.activeObj.activePoint;
|
|
1941
1967
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
1942
|
-
var x = this.arrowDimension['arrow']['width']
|
|
1943
|
-
var y = this.arrowDimension['arrow']['height']
|
|
1968
|
+
var x = this.arrowDimension['arrow']['width'];
|
|
1969
|
+
var y = this.arrowDimension['arrow']['height'];
|
|
1970
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
1971
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
1972
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1944
1973
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1945
1974
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1946
1975
|
canvasDraw.fillStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
@@ -1975,8 +2004,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1975
2004
|
Draw.prototype.arrowSolid = function (canvasDraw, start) {
|
|
1976
2005
|
var parent = this.parent;
|
|
1977
2006
|
var actPoint = parent.activeObj.activePoint;
|
|
1978
|
-
var x = this.arrowDimension['arrowSolid']['width']
|
|
1979
|
-
var y = this.arrowDimension['arrowSolid']['height']
|
|
2007
|
+
var x = this.arrowDimension['arrowSolid']['width'];
|
|
2008
|
+
var y = this.arrowDimension['arrowSolid']['height'];
|
|
2009
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
2010
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2011
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
1980
2012
|
this.dx = actPoint.endX - actPoint.startX;
|
|
1981
2013
|
this.dy = actPoint.endY - actPoint.startY;
|
|
1982
2014
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -2026,8 +2058,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2026
2058
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
2027
2059
|
canvasDraw.beginPath();
|
|
2028
2060
|
canvasDraw.fillStyle = parent.activeObj.strokeSettings.strokeColor;
|
|
2029
|
-
var x = this.arrowDimension['square']['width']
|
|
2030
|
-
var y = this.arrowDimension['square']['height']
|
|
2061
|
+
var x = this.arrowDimension['square']['width'];
|
|
2062
|
+
var y = this.arrowDimension['square']['height'];
|
|
2063
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
2064
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2065
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
2031
2066
|
this.dx = actPoint.endX - actPoint.startX;
|
|
2032
2067
|
this.dy = actPoint.endY - actPoint.startY;
|
|
2033
2068
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -2082,8 +2117,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2082
2117
|
Draw.prototype.arrowSquareEnd = function (canvasDraw) {
|
|
2083
2118
|
var parent = this.parent;
|
|
2084
2119
|
var actPoint = parent.activeObj.activePoint;
|
|
2085
|
-
var x = this.arrowDimension['square']['width']
|
|
2086
|
-
var y = this.arrowDimension['square']['height']
|
|
2120
|
+
var x = this.arrowDimension['square']['width'];
|
|
2121
|
+
var y = this.arrowDimension['square']['height'];
|
|
2122
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
2123
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2124
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
2087
2125
|
this.dx = actPoint.endX - actPoint.startX;
|
|
2088
2126
|
this.dy = actPoint.endY - actPoint.startY;
|
|
2089
2127
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -2145,7 +2183,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2145
2183
|
if ((start && parent.activeObj.triangleDirection === 'left') ||
|
|
2146
2184
|
(!start && parent.activeObj.triangleDirection === 'right')) {
|
|
2147
2185
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
2148
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
2186
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
2187
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
2188
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2149
2189
|
canvasDraw.beginPath();
|
|
2150
2190
|
canvasDraw.arc(actPoint.endX, actPoint.endY, circleRadius, 0, 2 * Math.PI);
|
|
2151
2191
|
canvasDraw.stroke();
|
|
@@ -2193,7 +2233,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2193
2233
|
else if ((start && parent.activeObj.triangleDirection === 'right') ||
|
|
2194
2234
|
(!start && parent.activeObj.triangleDirection === 'left')) {
|
|
2195
2235
|
canvasDraw.lineWidth = (parent.activeObj.strokeSettings.strokeWidth);
|
|
2196
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
2236
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
2237
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
2238
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2197
2239
|
canvasDraw.beginPath();
|
|
2198
2240
|
canvasDraw.arc(actPoint.startX, actPoint.startY, circleRadius, 0, 2 * Math.PI);
|
|
2199
2241
|
canvasDraw.stroke();
|
|
@@ -2251,7 +2293,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2251
2293
|
(!start && (parent.activeObj.end === 'circleSolid' && parent.activeObj.start === 'none'))) {
|
|
2252
2294
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
2253
2295
|
}
|
|
2254
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
2296
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
2297
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
2298
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2255
2299
|
this.dx = actPoint.endX - actPoint.startX;
|
|
2256
2300
|
this.dy = actPoint.endY - actPoint.startY;
|
|
2257
2301
|
canvasDraw.save();
|
|
@@ -2272,7 +2316,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2272
2316
|
!start && (parent.activeObj.end === 'circleSolid' && parent.activeObj.start === 'none')) {
|
|
2273
2317
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
2274
2318
|
}
|
|
2275
|
-
var circleRadius = this.arrowDimension['circle']['width']
|
|
2319
|
+
var circleRadius = this.arrowDimension['circle']['width'];
|
|
2320
|
+
var point = this.manipulateSaveCtx(canvasDraw, circleRadius, null);
|
|
2321
|
+
circleRadius = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2276
2322
|
this.dx = actPoint.endX - actPoint.startX;
|
|
2277
2323
|
this.dy = actPoint.endY - actPoint.startY;
|
|
2278
2324
|
canvasDraw.save();
|
|
@@ -2298,8 +2344,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2298
2344
|
(parent.activeObj.end === 'bar' && (parent.activeObj.start !== 'circle' && parent.activeObj.start !== 'square'))))) {
|
|
2299
2345
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
2300
2346
|
}
|
|
2301
|
-
var x = this.arrowDimension['bar']['width']
|
|
2302
|
-
var y = this.arrowDimension['bar']['height']
|
|
2347
|
+
var x = this.arrowDimension['bar']['width'];
|
|
2348
|
+
var y = this.arrowDimension['bar']['height'];
|
|
2349
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
2350
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2351
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
2303
2352
|
this.dx = actPoint.endX - actPoint.startX;
|
|
2304
2353
|
this.dy = actPoint.endY - actPoint.startY;
|
|
2305
2354
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -2320,8 +2369,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2320
2369
|
(!start && (parent.activeObj.end === 'bar' && parent.activeObj.start === 'none'))) {
|
|
2321
2370
|
this.shapeLine(canvasDraw, actPoint.startX, actPoint.startY, actPoint.endX, actPoint.endY);
|
|
2322
2371
|
}
|
|
2323
|
-
var x = this.arrowDimension['bar']['width']
|
|
2324
|
-
var y = this.arrowDimension['bar']['height']
|
|
2372
|
+
var x = this.arrowDimension['bar']['width'];
|
|
2373
|
+
var y = this.arrowDimension['bar']['height'];
|
|
2374
|
+
var point = this.manipulateSaveCtx(canvasDraw, x, y);
|
|
2375
|
+
x = point.x + parent.activeObj.strokeSettings.strokeWidth;
|
|
2376
|
+
y = point.y + parent.activeObj.strokeSettings.strokeWidth;
|
|
2325
2377
|
this.dx = actPoint.endX - actPoint.startX;
|
|
2326
2378
|
this.dy = actPoint.endY - actPoint.startY;
|
|
2327
2379
|
var angle = Math.atan2(this.dy, this.dx);
|
|
@@ -3181,8 +3233,6 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3181
3233
|
parent.isCropTab = isCropTab;
|
|
3182
3234
|
this.resetPanPoints();
|
|
3183
3235
|
}
|
|
3184
|
-
this.cancelObjColl = extend([], parent.objColl, [], true);
|
|
3185
|
-
this.cancelPointColl = extend([], parent.pointColl, [], true);
|
|
3186
3236
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
3187
3237
|
parent.isCropTab = true;
|
|
3188
3238
|
parent.isCircleCrop = false;
|
|
@@ -3492,7 +3542,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3492
3542
|
parent.afterCropActions = obj.afterCropActions;
|
|
3493
3543
|
}
|
|
3494
3544
|
this.lowerContext.filter = obj.filter;
|
|
3495
|
-
parent.notify('filter', { prop: 'setBrightnessAdjusted', onPropertyChange: false, value: { isBrightnessAdjusted:
|
|
3545
|
+
parent.notify('filter', { prop: 'setBrightnessAdjusted', onPropertyChange: false, value: { isBrightnessAdjusted: obj.isBrightAdjust } });
|
|
3496
3546
|
var isCircleCrop = parent.isCircleCrop;
|
|
3497
3547
|
var currSelectionPoint;
|
|
3498
3548
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
@@ -3588,6 +3638,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3588
3638
|
this.setTransformColl(this.lowerContext, 'initial');
|
|
3589
3639
|
}
|
|
3590
3640
|
parent.notify('transform', { prop: 'setDestPointsForFlipState', onPropertyChange: false });
|
|
3641
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
3591
3642
|
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);
|
|
3592
3643
|
if (isObj) {
|
|
3593
3644
|
this.updateCurrTransState('reverse');
|
|
@@ -3915,7 +3966,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3915
3966
|
object['isInitialLoaded'] = this.isInitialLoading;
|
|
3916
3967
|
};
|
|
3917
3968
|
Draw.prototype.getFileExtensionFromURL = function (url) {
|
|
3918
|
-
var lastDotIndex = url.lastIndexOf(
|
|
3969
|
+
var lastDotIndex = url.lastIndexOf('.');
|
|
3919
3970
|
if (lastDotIndex !== -1) {
|
|
3920
3971
|
return url.slice(lastDotIndex + 1).toLowerCase();
|
|
3921
3972
|
}
|
|
@@ -4295,7 +4346,6 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4295
4346
|
id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
|
|
4296
4347
|
});
|
|
4297
4348
|
var tempContext = tempCanvas.getContext('2d');
|
|
4298
|
-
tempContext.filter = this.lowerContext.filter;
|
|
4299
4349
|
tempCanvas.width = width;
|
|
4300
4350
|
tempCanvas.height = height;
|
|
4301
4351
|
var dimObj = { width: 0, height: 0 };
|
|
@@ -4304,9 +4354,9 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4304
4354
|
var maxDimension = dimObj;
|
|
4305
4355
|
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
4306
4356
|
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
4307
|
-
tempContext.filter = this.lowerContext.filter;
|
|
4308
4357
|
var temp = this.lowerContext.filter;
|
|
4309
4358
|
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
4359
|
+
tempContext.filter = this.lowerContext.filter;
|
|
4310
4360
|
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
|
|
4311
4361
|
this.lowerContext.filter = temp;
|
|
4312
4362
|
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
@@ -4337,6 +4387,14 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4337
4387
|
if (parent.objColl[i].shape === 'text') {
|
|
4338
4388
|
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4339
4389
|
}
|
|
4390
|
+
else if (parent.objColl[i].shape === 'path') {
|
|
4391
|
+
for (var l = 0; l < parent.objColl[i].pointColl.length; l++) {
|
|
4392
|
+
parent.objColl[i].pointColl[l].x =
|
|
4393
|
+
(parent.objColl[i].pointColl[l].x - parent.img.destLeft) * ratio.width;
|
|
4394
|
+
parent.objColl[i].pointColl[l].y =
|
|
4395
|
+
(parent.objColl[i].pointColl[l].y - parent.img.destTop) * ratio.height;
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4340
4398
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
|
|
4341
4399
|
points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
|
|
4342
4400
|
}
|
|
@@ -4924,8 +4982,6 @@ var Filter = /** @__PURE__ @class */ (function () {
|
|
|
4924
4982
|
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
|
|
4925
4983
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
4926
4984
|
this.updateAdj(type, value);
|
|
4927
|
-
var filter = this.lowerContext.filter;
|
|
4928
|
-
this.lowerContext.filter = this.appliedFilter;
|
|
4929
4985
|
parent.notify('undo-redo', {
|
|
4930
4986
|
prop: 'updateUndoRedoColl',
|
|
4931
4987
|
onPropertyChange: false,
|
|
@@ -4942,7 +4998,6 @@ var Filter = /** @__PURE__ @class */ (function () {
|
|
|
4942
4998
|
isCircleCrop: null
|
|
4943
4999
|
}
|
|
4944
5000
|
});
|
|
4945
|
-
this.lowerContext.filter = filter;
|
|
4946
5001
|
};
|
|
4947
5002
|
Filter.prototype.setFilter = function (type) {
|
|
4948
5003
|
var parent = this.parent;
|
|
@@ -4960,15 +5015,12 @@ var Filter = /** @__PURE__ @class */ (function () {
|
|
|
4960
5015
|
value: { obj: selPointCollObj } });
|
|
4961
5016
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
4962
5017
|
this.updateAdj(type, null);
|
|
4963
|
-
var filter = this.lowerContext.filter;
|
|
4964
|
-
this.lowerContext.filter = this.appliedFilter;
|
|
4965
5018
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
4966
5019
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
4967
5020
|
value: { operation: type, previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
4968
5021
|
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
4969
5022
|
previousCropObj: prevCropObj, previousText: null,
|
|
4970
5023
|
currentText: null, previousFilter: prevFilter, isCircleCrop: null } });
|
|
4971
|
-
this.lowerContext.filter = filter;
|
|
4972
5024
|
};
|
|
4973
5025
|
Filter.prototype.setAdjustment = function (type) {
|
|
4974
5026
|
var splitWords = this.lowerContext.filter.split(' ');
|
|
@@ -5121,7 +5173,7 @@ var Filter = /** @__PURE__ @class */ (function () {
|
|
|
5121
5173
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
5122
5174
|
rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
|
|
5123
5175
|
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
5124
|
-
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
5176
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: this.isBrightnessAdjusted };
|
|
5125
5177
|
obj.cropZoom = parent.transform.cropZoomFactor;
|
|
5126
5178
|
obj.defaultZoom = parent.transform.defaultZoomFactor;
|
|
5127
5179
|
obj.zoomFactor = parent.zoomSettings.zoomFactor;
|
|
@@ -5158,6 +5210,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5158
5210
|
this.selPointColl = {};
|
|
5159
5211
|
this.currFHDIdx = 0; // Specifies id for every freehand drawing - uses while deleting
|
|
5160
5212
|
this.selPoints = [];
|
|
5213
|
+
this.dummyPoints = [];
|
|
5161
5214
|
this.tempFHDStyles = { strokeColor: null, fillColor: null, strokeWidth: null };
|
|
5162
5215
|
this.parent = parent;
|
|
5163
5216
|
this.addEventListener();
|
|
@@ -5311,6 +5364,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5311
5364
|
this.fhdObj = { lastWidth: 0, lastVelocity: 0, time: 0, pointX: 0, pointY: 0 };
|
|
5312
5365
|
this.isFreehandDrawing = this.isFreehandPointMoved = false;
|
|
5313
5366
|
this.selPoints = [];
|
|
5367
|
+
this.dummyPoints = [];
|
|
5314
5368
|
this.freehandDownPoint = { x: 0, y: 0 };
|
|
5315
5369
|
this.selPointColl = {};
|
|
5316
5370
|
this.fhdHovIdx = null;
|
|
@@ -5359,7 +5413,12 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5359
5413
|
if (parent.points[l + 1] && parent.points[l + 2] && parent.points[l + 2]) {
|
|
5360
5414
|
controlPoint1 = (this.calcCurveCP(parent.points[l + 0], parent.points[l + 1], parent.points[l + 2])).controlPoint2;
|
|
5361
5415
|
controlPoint2 = (this.calcCurveCP(parent.points[l + 1], parent.points[l + 2], parent.points[l + 3])).controlPoint1;
|
|
5362
|
-
|
|
5416
|
+
if (l === 0) {
|
|
5417
|
+
startPoint = parent.points[l];
|
|
5418
|
+
}
|
|
5419
|
+
else {
|
|
5420
|
+
startPoint = parent.points[l + 1];
|
|
5421
|
+
}
|
|
5363
5422
|
endPoint = parent.points[l + 2];
|
|
5364
5423
|
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
5365
5424
|
}
|
|
@@ -5426,6 +5485,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5426
5485
|
parent.pointColl[fhCnt].flipState = parent.transform.currFlipState;
|
|
5427
5486
|
parent.pointColl[fhCnt].id = 'pen_' + (this.currFHDIdx + 1);
|
|
5428
5487
|
parent.points = [];
|
|
5488
|
+
this.dummyPoints = [];
|
|
5429
5489
|
this.selPointColl[fhCnt] = {};
|
|
5430
5490
|
this.selPointColl[fhCnt].points = extend([], this.selPoints);
|
|
5431
5491
|
this.selPoints = [];
|
|
@@ -5473,15 +5533,21 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5473
5533
|
parent.points.push({ x: x, y: y, ratioX: (x - parent.img.destLeft) / parent.img.destWidth,
|
|
5474
5534
|
ratioY: (y - parent.img.destTop) / parent.img.destHeight,
|
|
5475
5535
|
time: this.fhdObj.time });
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5536
|
+
this.dummyPoints.push({ x: x, y: y, ratioX: (x - parent.img.destLeft) / parent.img.destWidth,
|
|
5537
|
+
ratioY: (y - parent.img.destTop) / parent.img.destHeight,
|
|
5538
|
+
time: this.fhdObj.time });
|
|
5539
|
+
if (this.dummyPoints.length > 2) {
|
|
5540
|
+
if (this.dummyPoints.length === 3) {
|
|
5541
|
+
this.dummyPoints.unshift(this.dummyPoints[0]);
|
|
5542
|
+
}
|
|
5543
|
+
var p0 = this.dummyPoints[0];
|
|
5544
|
+
var p1 = this.dummyPoints[1];
|
|
5545
|
+
var p2 = this.dummyPoints[2];
|
|
5546
|
+
var p3 = this.dummyPoints[3];
|
|
5481
5547
|
controlPoint1 = this.calcCurveCP(p0, p1, p2).controlPoint2;
|
|
5482
5548
|
controlPoint2 = this.calcCurveCP(p1, p2, p3).controlPoint1;
|
|
5483
|
-
startPoint =
|
|
5484
|
-
endPoint =
|
|
5549
|
+
startPoint = this.dummyPoints[1];
|
|
5550
|
+
endPoint = this.dummyPoints[2];
|
|
5485
5551
|
var minStrokeWidth = 0.5;
|
|
5486
5552
|
var maxStrokeWidth = 5;
|
|
5487
5553
|
if (!isNullOrUndefined(this.penStrokeWidth)) {
|
|
@@ -5489,6 +5555,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5489
5555
|
}
|
|
5490
5556
|
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
5491
5557
|
this.pointCounter++;
|
|
5558
|
+
this.dummyPoints.shift();
|
|
5492
5559
|
}
|
|
5493
5560
|
if (mouseDown) {
|
|
5494
5561
|
controlPoint1 = controlPoint2 = startPoint = endPoint = { x: x, y: y, time: new Date().getTime() };
|
|
@@ -5659,7 +5726,12 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5659
5726
|
if (parent.points[l + 1] && parent.points[l + 2] && parent.points[l + 2]) {
|
|
5660
5727
|
controlPoint1 = (this.calcCurveCP(parent.points[l + 0], parent.points[l + 1], parent.points[l + 2])).controlPoint2;
|
|
5661
5728
|
controlPoint2 = (this.calcCurveCP(parent.points[l + 1], parent.points[l + 2], parent.points[l + 3])).controlPoint1;
|
|
5662
|
-
|
|
5729
|
+
if (l === 0) {
|
|
5730
|
+
startPoint = parent.points[l];
|
|
5731
|
+
}
|
|
5732
|
+
else {
|
|
5733
|
+
startPoint = parent.points[l + 1];
|
|
5734
|
+
}
|
|
5663
5735
|
endPoint = parent.points[l + 2];
|
|
5664
5736
|
this.startDraw(context, controlPoint1, controlPoint2, startPoint, endPoint, minStrokeWidth, maxStrokeWidth);
|
|
5665
5737
|
}
|
|
@@ -5786,8 +5858,10 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5786
5858
|
if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
5787
5859
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5788
5860
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
|
|
5789
|
-
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[_this.fhdSelIdx].strokeColor =
|
|
5790
|
-
|
|
5861
|
+
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[_this.fhdSelIdx].strokeColor =
|
|
5862
|
+
shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5863
|
+
parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[_this.fhdSelIdx].strokeWidth =
|
|
5864
|
+
shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5791
5865
|
parent.pointColl[_this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5792
5866
|
_this.freehandRedraw(_this.upperContext);
|
|
5793
5867
|
parent.updateToolbar(parent.element, 'colorToolbar');
|
|
@@ -5795,8 +5869,10 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5795
5869
|
}
|
|
5796
5870
|
else {
|
|
5797
5871
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
5798
|
-
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[this.fhdSelIdx].strokeColor =
|
|
5799
|
-
|
|
5872
|
+
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[this.fhdSelIdx].strokeColor =
|
|
5873
|
+
shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5874
|
+
parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[this.fhdSelIdx].strokeWidth =
|
|
5875
|
+
shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5800
5876
|
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5801
5877
|
this.freehandRedraw(this.upperContext);
|
|
5802
5878
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
@@ -6115,6 +6191,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
6115
6191
|
var parent = this.parent;
|
|
6116
6192
|
if (value) {
|
|
6117
6193
|
parent.points = [];
|
|
6194
|
+
this.dummyPoints = [];
|
|
6118
6195
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
6119
6196
|
parent.togglePen = true;
|
|
6120
6197
|
parent.upperCanvas.style.cursor = parent.cursor = 'crosshair';
|
|
@@ -7041,12 +7118,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
7041
7118
|
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
7042
7119
|
var shapeResizingArgs = { action: 'resize', previousShapeSettings: previousShapeSettings };
|
|
7043
7120
|
var shapeMovingArgs = { action: 'move', previousShapeSettings: previousShapeSettings };
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
}
|
|
7047
|
-
if (isNullOrUndefined(this.shapeMovingArgs)) {
|
|
7048
|
-
this.shapeMovingArgs = shapeMovingArgs;
|
|
7049
|
-
}
|
|
7121
|
+
this.shapeResizingArgs = shapeResizingArgs;
|
|
7122
|
+
this.shapeMovingArgs = shapeMovingArgs;
|
|
7050
7123
|
if (parent.activeObj.shape === 'text' && this.dragElement !== '') {
|
|
7051
7124
|
parent.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
|
|
7052
7125
|
value: { obj: parent.activeObj, isTextArea: null } });
|
|
@@ -7245,8 +7318,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
7245
7318
|
parent.activeObj.activePoint.width = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.startX;
|
|
7246
7319
|
parent.activeObj.activePoint.height = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.startY;
|
|
7247
7320
|
var currentShapeSettings = this.updatePrevShapeSettings();
|
|
7248
|
-
shapeResizingArgs.currentShapeSettings = currentShapeSettings;
|
|
7249
|
-
shapeMovingArgs.currentShapeSettings = currentShapeSettings;
|
|
7321
|
+
shapeResizingArgs.currentShapeSettings = this.shapeResizingArgs.currentShapeSettings = currentShapeSettings;
|
|
7322
|
+
shapeMovingArgs.currentShapeSettings = this.shapeMovingArgs.currentShapeSettings = currentShapeSettings;
|
|
7250
7323
|
if (type === 'resize') {
|
|
7251
7324
|
this.isCropSelection = false;
|
|
7252
7325
|
var splitWords = void 0;
|
|
@@ -7257,7 +7330,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
7257
7330
|
this.isCropSelection = true;
|
|
7258
7331
|
}
|
|
7259
7332
|
if (!this.isCropSelection && this.parent.eventType !== 'resize' && isBlazor() && parent.events && this.parent.events.onShapeResizeStart.hasDelegate === true) {
|
|
7260
|
-
shapeResizingArgs.action = 'resize-start';
|
|
7333
|
+
shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-start';
|
|
7261
7334
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7262
7335
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeStart', shapeResizingArgs).then(function (shapeResizingArgs) {
|
|
7263
7336
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
@@ -7265,6 +7338,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
7265
7338
|
});
|
|
7266
7339
|
}
|
|
7267
7340
|
else if (!this.isCropSelection) {
|
|
7341
|
+
if (this.currentDrawingShape !== '') {
|
|
7342
|
+
shapeResizingArgs.action = 'drawing';
|
|
7343
|
+
}
|
|
7268
7344
|
parent.trigger('shapeChanging', shapeResizingArgs);
|
|
7269
7345
|
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
7270
7346
|
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
@@ -7281,9 +7357,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
7281
7357
|
startY: shapeResizingArgs.currentShapeSettings.startY,
|
|
7282
7358
|
width: shapeResizingArgs.currentShapeSettings.width,
|
|
7283
7359
|
height: shapeResizingArgs.currentShapeSettings.height } };
|
|
7284
|
-
|
|
7285
|
-
this.selectionResizingArgs = selectionResizingArgs;
|
|
7286
|
-
}
|
|
7360
|
+
this.selectionResizingArgs = selectionResizingArgs;
|
|
7287
7361
|
if (isBlazor() && isNullOrUndefined(this.parent.eventType) && parent.events &&
|
|
7288
7362
|
parent.events.onSelectionResizeStart.hasDelegate === true) {
|
|
7289
7363
|
selectionResizingArgs.action = 'resize-start';
|
|
@@ -9195,7 +9269,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9195
9269
|
else if (this.parent.eventType === 'resize') {
|
|
9196
9270
|
if (!this.isCropSelection && this.parent.events && this.parent.events.onShapeResizeEnd.hasDelegate === true) {
|
|
9197
9271
|
this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
9198
|
-
this.shapeResizingArgs.action = 'resize-end';
|
|
9272
|
+
this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
|
|
9199
9273
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9200
9274
|
this.parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs).then(function (shapeResizingArgs) {
|
|
9201
9275
|
_this.parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
@@ -9614,7 +9688,8 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9614
9688
|
isApply = false;
|
|
9615
9689
|
}
|
|
9616
9690
|
else if (parent.upperCanvas.style.cursor !== 'default' && parent.upperCanvas.style.cursor !== 'grab' &&
|
|
9617
|
-
parent.upperCanvas.style.cursor !== 'crosshair' && parent.upperCanvas.style.cursor !== 'pointer'
|
|
9691
|
+
parent.upperCanvas.style.cursor !== 'crosshair' && parent.upperCanvas.style.cursor !== 'pointer' &&
|
|
9692
|
+
parent.upperCanvas.style.cursor !== 'move') {
|
|
9618
9693
|
isApply = false;
|
|
9619
9694
|
}
|
|
9620
9695
|
else {
|
|
@@ -10361,10 +10436,21 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10361
10436
|
if (isNullOrUndefined(actObj.activePoint)) {
|
|
10362
10437
|
return;
|
|
10363
10438
|
}
|
|
10364
|
-
|
|
10365
|
-
|
|
10439
|
+
var radius = actObj.topLeftCircle ? actObj.topLeftCircle.radius : 0;
|
|
10440
|
+
if ((x >= Math.floor(actObj.activePoint.startX) &&
|
|
10441
|
+
x <= Math.ceil(actObj.activePoint.endX) &&
|
|
10442
|
+
y >= Math.floor(actObj.activePoint.startY) &&
|
|
10443
|
+
y <= Math.ceil(actObj.activePoint.endY))) {
|
|
10366
10444
|
isInside = true;
|
|
10367
10445
|
}
|
|
10446
|
+
else if (radius !== 0 && (x >= Math.floor(actObj.activePoint.startX) - radius &&
|
|
10447
|
+
x <= Math.ceil(actObj.activePoint.endX) + radius &&
|
|
10448
|
+
y >= Math.floor(actObj.activePoint.startY) - radius &&
|
|
10449
|
+
y <= Math.ceil(actObj.activePoint.endY) + radius)) {
|
|
10450
|
+
isInside = true;
|
|
10451
|
+
this.tempActiveObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
|
|
10452
|
+
flipObjColl: [], triangle: [], triangleRatio: [] };
|
|
10453
|
+
}
|
|
10368
10454
|
else if (actObj.shape === 'text' && this.dragElement !== '') {
|
|
10369
10455
|
isInside = true;
|
|
10370
10456
|
}
|
|
@@ -10453,7 +10539,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10453
10539
|
Selection.prototype.setTextBoxStylesToActObj = function () {
|
|
10454
10540
|
var parent = this.parent;
|
|
10455
10541
|
parent.activeObj.textSettings.fontFamily = parent.textArea.style.fontFamily;
|
|
10456
|
-
parent.activeObj.strokeSettings.strokeColor = parent.textArea.style.color !== ''
|
|
10542
|
+
parent.activeObj.strokeSettings.strokeColor = parent.textArea.style.color !== '' &&
|
|
10543
|
+
parent.textArea.style.color.split('(')[1] && parent.textArea.style.color.split('(')[1].split(',')[0] &&
|
|
10544
|
+
parent.textArea.style.color.split('(')[1].split(',')[1] && parent.textArea.style.color.split('(')[1].split(',')[2] ?
|
|
10457
10545
|
this.rgbToHex(parseFloat(parent.textArea.style.color.split('(')[1].split(',')[0]), parseFloat(parent.textArea.style.color.split('(')[1].split(',')[1]), parseFloat(parent.textArea.style.color.split('(')[1].split(',')[2])) :
|
|
10458
10546
|
parent.textArea.style.color;
|
|
10459
10547
|
if (parent.textArea.style.fontWeight === 'bold') {
|
|
@@ -11317,14 +11405,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11317
11405
|
if (x && y) {
|
|
11318
11406
|
if ((x !== parent.activeObj.activePoint.startX) && (y !== parent.activeObj.activePoint.startY)) {
|
|
11319
11407
|
this.updateTextFromTextArea();
|
|
11320
|
-
this.applyActObj();
|
|
11321
11408
|
}
|
|
11322
11409
|
}
|
|
11323
11410
|
else {
|
|
11324
11411
|
this.updateTextFromTextArea();
|
|
11325
|
-
this.apply(parent.activeObj.shape, parent.activeObj);
|
|
11326
|
-
parent.objColl.push(parent.activeObj);
|
|
11327
|
-
this.refreshActiveObj();
|
|
11328
11412
|
parent.textArea.style.transform = '';
|
|
11329
11413
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
11330
11414
|
}
|
|
@@ -11427,7 +11511,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11427
11511
|
parent.activeObj.strokeSettings.fillColor = shapeSettings.fillColor;
|
|
11428
11512
|
switch (parent.activeObj.shape) {
|
|
11429
11513
|
case 'ellipse':
|
|
11430
|
-
parent.activeObj.activePoint.width = shapeSettings.radius
|
|
11514
|
+
parent.activeObj.activePoint.width = shapeSettings.radius * 2;
|
|
11431
11515
|
break;
|
|
11432
11516
|
case 'line':
|
|
11433
11517
|
case 'arrow':
|
|
@@ -11503,23 +11587,20 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11503
11587
|
};
|
|
11504
11588
|
Shape.prototype.updateTextFromTextArea = function () {
|
|
11505
11589
|
var parent = this.parent;
|
|
11590
|
+
var allowUndoRedo = false;
|
|
11591
|
+
var prevCropObj = extend({}, parent.cropObj, {}, true);
|
|
11592
|
+
var object = { currObj: {} };
|
|
11593
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11594
|
+
var prevObj = object['currObj'];
|
|
11595
|
+
prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11596
|
+
prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11597
|
+
prevObj.afterCropActions = extend([], this.parent.afterCropActions, [], true);
|
|
11598
|
+
var selPointCollObj = { selPointColl: null };
|
|
11599
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11600
|
+
value: { obj: selPointCollObj } });
|
|
11601
|
+
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11506
11602
|
if (parent.activeObj.keyHistory !== parent.textArea.value) {
|
|
11507
|
-
|
|
11508
|
-
var object = { currObj: {} };
|
|
11509
|
-
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11510
|
-
var prevObj = object['currObj'];
|
|
11511
|
-
prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11512
|
-
prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11513
|
-
prevObj.afterCropActions = extend([], this.parent.afterCropActions, [], true);
|
|
11514
|
-
var selPointCollObj = { selPointColl: null };
|
|
11515
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11516
|
-
value: { obj: selPointCollObj } });
|
|
11517
|
-
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11518
|
-
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
11519
|
-
value: { operation: 'text', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
11520
|
-
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
11521
|
-
previousCropObj: prevCropObj, previousText: parent.activeObj.keyHistory,
|
|
11522
|
-
currentText: parent.textArea.value, previousFilter: null, isCircleCrop: null } });
|
|
11603
|
+
allowUndoRedo = true;
|
|
11523
11604
|
}
|
|
11524
11605
|
parent.activeObj.keyHistory = parent.textArea.value;
|
|
11525
11606
|
parent.textArea.style.display = 'none';
|
|
@@ -11543,6 +11624,19 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11543
11624
|
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: parent.activeObj.activePoint, obj: parent.activeObj,
|
|
11544
11625
|
isMouseMove: null, x: null, y: null } });
|
|
11545
11626
|
this.updImgRatioForActObj();
|
|
11627
|
+
if (allowUndoRedo) {
|
|
11628
|
+
this.apply(parent.activeObj.shape, parent.activeObj);
|
|
11629
|
+
parent.objColl.push(extend({}, parent.activeObj, {}, true));
|
|
11630
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
11631
|
+
value: { operation: 'text', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
11632
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
11633
|
+
previousCropObj: prevCropObj, previousText: parent.activeObj.keyHistory,
|
|
11634
|
+
currentText: parent.textArea.value, previousFilter: null, isCircleCrop: null } });
|
|
11635
|
+
}
|
|
11636
|
+
else {
|
|
11637
|
+
this.apply(parent.activeObj.shape, parent.activeObj);
|
|
11638
|
+
parent.objColl.push(extend({}, parent.activeObj, {}, true));
|
|
11639
|
+
}
|
|
11546
11640
|
};
|
|
11547
11641
|
Shape.prototype.iterateObjColl = function () {
|
|
11548
11642
|
var parent = this.parent;
|
|
@@ -12211,11 +12305,13 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
12211
12305
|
parent.activeObj.pointColl.pop();
|
|
12212
12306
|
}
|
|
12213
12307
|
this.updatePathRatio(parent.activeObj);
|
|
12308
|
+
parent.objColl.push(parent.activeObj);
|
|
12214
12309
|
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
12215
12310
|
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: prevObj.objColl,
|
|
12216
12311
|
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
12217
12312
|
previousCropObj: prevCropObj, previousText: null,
|
|
12218
12313
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
12314
|
+
parent.objColl.pop();
|
|
12219
12315
|
parent.notify('selection', { prop: 'mouseUpEventHandler', value: { e: e } });
|
|
12220
12316
|
parent.notify('draw', { prop: 'setNewPath', value: { bool: true } });
|
|
12221
12317
|
if (parent.objColl[parent.objColl.length - 1]) {
|
|
@@ -12637,8 +12733,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
12637
12733
|
var object = { arrowDimension: null };
|
|
12638
12734
|
parent.notify('draw', { prop: 'getArrowDimension', onPropertyChange: false, value: { obj: object } });
|
|
12639
12735
|
var length;
|
|
12640
|
-
|
|
12641
|
-
if (degree === 0 || degree === 180 || degree === -180) {
|
|
12736
|
+
if (Math.abs(obj.activePoint.width) > Math.abs(obj.activePoint.height)) {
|
|
12642
12737
|
length = Math.abs(obj.activePoint.width);
|
|
12643
12738
|
}
|
|
12644
12739
|
else {
|
|
@@ -12658,8 +12753,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
12658
12753
|
var object = { arrowDimension: null };
|
|
12659
12754
|
this.parent.notify('draw', { prop: 'getArrowDimension', onPropertyChange: false, value: { obj: object } });
|
|
12660
12755
|
var length;
|
|
12661
|
-
|
|
12662
|
-
if (degree === 0 || degree === 180 || degree === -180) {
|
|
12756
|
+
if (Math.abs(obj.activePoint.width) > Math.abs(obj.activePoint.height)) {
|
|
12663
12757
|
length = Math.abs(obj.activePoint.width);
|
|
12664
12758
|
}
|
|
12665
12759
|
else {
|
|
@@ -14693,6 +14787,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14693
14787
|
};
|
|
14694
14788
|
Transform.prototype.drawPannImage = function (point) {
|
|
14695
14789
|
var parent = this.parent;
|
|
14790
|
+
var filter = this.lowerContext.filter;
|
|
14696
14791
|
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
|
|
14697
14792
|
height: parent.img.destHeight };
|
|
14698
14793
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
@@ -14709,6 +14804,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14709
14804
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
14710
14805
|
value: { context: this.lowerContext, isSave: null, isFlip: true } });
|
|
14711
14806
|
}
|
|
14807
|
+
this.lowerContext.filter = filter;
|
|
14712
14808
|
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
14713
14809
|
value: { type: 'reverse', isPreventDestination: null, isRotatePan: null } });
|
|
14714
14810
|
parent.img.destLeft = destPoints.startX;
|
|
@@ -16310,7 +16406,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16310
16406
|
_this.cropObj = { cropZoom: 0, defaultZoom: 0, totalPannedPoint: { x: 0, y: 0 }, totalPannedClientPoint: { x: 0, y: 0 },
|
|
16311
16407
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {}, rotateFlipColl: [],
|
|
16312
16408
|
degree: 0, currFlipState: '', destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
16313
|
-
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '',
|
|
16409
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false,
|
|
16410
|
+
zoomFactor: 0, previousZoomValue: 0 };
|
|
16314
16411
|
// Stored transformations performed after cropping
|
|
16315
16412
|
/** @hidden */
|
|
16316
16413
|
_this.afterCropActions = [];
|
|
@@ -16889,7 +16986,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16889
16986
|
totalPannedInternalPoint: { x: 0, y: 0 }, tempFlipPanPoint: { x: 0, y: 0 }, activeObj: {},
|
|
16890
16987
|
rotateFlipColl: [], degree: 0, currFlipState: '', zoomFactor: 0, previousZoomValue: 0,
|
|
16891
16988
|
destPoints: { startX: 0, startY: 0, width: 0, height: 0 },
|
|
16892
|
-
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '' };
|
|
16989
|
+
srcPoints: { startX: 0, startY: 0, width: 0, height: 0 }, filter: '', isBrightAdjust: false };
|
|
16893
16990
|
this.afterCropActions = [];
|
|
16894
16991
|
this.currentFilter = '';
|
|
16895
16992
|
var obj_1 = { initialZoomValue: false };
|
|
@@ -20550,7 +20647,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20550
20647
|
}
|
|
20551
20648
|
spanElem_3.className = 'e-pen-stroke-width';
|
|
20552
20649
|
strokeWidthBtn.appendChild(spanElem_3);
|
|
20553
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
20554
20650
|
var drpDownBtn_2 = new DropDownButton({ items: strokeWidthItems,
|
|
20555
20651
|
open: function (args) {
|
|
20556
20652
|
if (Browser.isDevice) {
|
|
@@ -21481,6 +21577,9 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21481
21577
|
};
|
|
21482
21578
|
ToolbarModule.prototype.updateToolbarItems = function () {
|
|
21483
21579
|
var parent = this.parent;
|
|
21580
|
+
if (!parent.isImageLoaded) {
|
|
21581
|
+
return;
|
|
21582
|
+
}
|
|
21484
21583
|
var selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
|
|
21485
21584
|
var selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
|
|
21486
21585
|
var selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
|