@syncfusion/ej2-image-editor 22.1.37 → 22.1.39
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 +342 -273
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +344 -274
- 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 +10 -10
- package/src/image-editor/action/crop.d.ts +2 -0
- package/src/image-editor/action/crop.js +92 -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 +24 -1
- package/src/image-editor/action/selection.js +17 -7
- package/src/image-editor/action/shape.d.ts +2 -0
- package/src/image-editor/action/shape.js +54 -22
- package/src/image-editor/action/transform.js +10 -0
- package/src/image-editor/base/image-editor.js +7 -5
- 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
|
@@ -163,8 +163,19 @@ var Export = /** @class */ (function () {
|
|
|
163
163
|
};
|
|
164
164
|
Export.prototype.exportToCanvas = function (object) {
|
|
165
165
|
var parent = this.parent;
|
|
166
|
+
var width;
|
|
167
|
+
var height;
|
|
168
|
+
if (parent.currSelectionPoint) {
|
|
169
|
+
width = parent.img.srcWidth;
|
|
170
|
+
height = parent.img.srcHeight;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
width = parent.baseImg.width;
|
|
174
|
+
height = parent.baseImg.height;
|
|
175
|
+
}
|
|
166
176
|
var obj = { width: 0, height: 0 };
|
|
167
|
-
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
177
|
+
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
178
|
+
value: { obj: obj, dimension: { width: width, height: height } } });
|
|
168
179
|
var ratio = obj;
|
|
169
180
|
var tempContextFilter = this.lowerContext.filter;
|
|
170
181
|
// Manipulating blur value
|
|
@@ -175,42 +186,30 @@ var Export = /** @class */ (function () {
|
|
|
175
186
|
splitWords[5] = 'blur(' + value + 'px)';
|
|
176
187
|
this.lowerContext.filter = splitWords.join(' ');
|
|
177
188
|
}
|
|
178
|
-
var maxDimension;
|
|
179
189
|
var tempCanvas = parent.createElement('canvas', {
|
|
180
190
|
id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
|
|
181
191
|
});
|
|
182
192
|
var tempContext = tempCanvas.getContext('2d');
|
|
183
193
|
tempContext.filter = this.lowerContext.filter;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
198
|
-
value: { width: parent.baseImg.width, height: parent.baseImg.height, obj: obj_2 } });
|
|
199
|
-
maxDimension = obj_2;
|
|
200
|
-
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
201
|
-
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
202
|
-
tempContext.filter = this.lowerContext.filter;
|
|
203
|
-
var temp = this.lowerContext.filter;
|
|
204
|
-
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
205
|
-
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.baseImg.width, parent.baseImg.height);
|
|
206
|
-
this.lowerContext.filter = temp;
|
|
207
|
-
}
|
|
194
|
+
tempCanvas.width = width;
|
|
195
|
+
tempCanvas.height = height;
|
|
196
|
+
var dimObj = { width: 0, height: 0 };
|
|
197
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
198
|
+
value: { width: width, height: height, obj: dimObj } });
|
|
199
|
+
var maxDimension = dimObj;
|
|
200
|
+
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
201
|
+
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
202
|
+
tempContext.filter = this.lowerContext.filter;
|
|
203
|
+
var temp = this.lowerContext.filter;
|
|
204
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
205
|
+
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
|
|
206
|
+
this.lowerContext.filter = temp;
|
|
208
207
|
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
209
208
|
this.updateSaveContext(tempContext);
|
|
210
209
|
this.exportTransformedImage(tempContext);
|
|
211
210
|
}
|
|
212
211
|
if (parent.objColl.length > 0) {
|
|
213
|
-
var
|
|
212
|
+
var temp_1 = tempContext.filter;
|
|
214
213
|
tempContext.filter = 'none';
|
|
215
214
|
var tempObjColl = extend([], parent.objColl, [], true);
|
|
216
215
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
@@ -223,22 +222,20 @@ var Export = /** @class */ (function () {
|
|
|
223
222
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
224
223
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
225
224
|
// Manipulating points
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
236
|
-
}
|
|
225
|
+
activePoint.startX *= ratio.width;
|
|
226
|
+
activePoint.startY *= ratio.height;
|
|
227
|
+
activePoint.endX *= ratio.width;
|
|
228
|
+
activePoint.endY *= ratio.height;
|
|
229
|
+
activePoint.width = activePoint.endX - activePoint.startX;
|
|
230
|
+
activePoint.height = activePoint.endY - activePoint.startY;
|
|
231
|
+
parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
232
|
+
if (parent.objColl[i].shape === 'text') {
|
|
233
|
+
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
237
234
|
}
|
|
238
235
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
|
|
239
236
|
points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
|
|
240
237
|
}
|
|
241
|
-
tempContext.filter =
|
|
238
|
+
tempContext.filter = temp_1;
|
|
242
239
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
243
240
|
parent.objColl = tempObjColl;
|
|
244
241
|
}
|
|
@@ -249,18 +246,10 @@ var Export = /** @class */ (function () {
|
|
|
249
246
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
250
247
|
parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
|
|
251
248
|
var len = parent.points.length;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
260
|
-
for (var l = 0; l < len; l++) {
|
|
261
|
-
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
262
|
-
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
263
|
-
}
|
|
249
|
+
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
250
|
+
for (var l = 0; l < len; l++) {
|
|
251
|
+
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
252
|
+
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
264
253
|
}
|
|
265
254
|
}
|
|
266
255
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
@@ -272,6 +261,7 @@ var Export = /** @class */ (function () {
|
|
|
272
261
|
value: { context: tempContext, isSave: true, isFlip: null } });
|
|
273
262
|
}
|
|
274
263
|
this.lowerContext.filter = tempContextFilter;
|
|
264
|
+
parent.canvasFilter = tempContextFilter;
|
|
275
265
|
if (object) {
|
|
276
266
|
object['canvas'] = tempCanvas;
|
|
277
267
|
}
|
|
@@ -306,17 +296,10 @@ var Export = /** @class */ (function () {
|
|
|
306
296
|
};
|
|
307
297
|
Export.prototype.exportRotate = function (tempContext, degree) {
|
|
308
298
|
var parent = this.parent;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
tempContext.drawImage(parent.inMemoryCanvas, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
317
|
-
tempContext.rotate(Math.PI / 180 * degree);
|
|
318
|
-
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
319
|
-
}
|
|
299
|
+
this.setMaxDim(parent.transform.degree, tempContext.canvas);
|
|
300
|
+
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
301
|
+
tempContext.rotate(Math.PI / 180 * degree);
|
|
302
|
+
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
320
303
|
this.updateSaveContext(tempContext);
|
|
321
304
|
};
|
|
322
305
|
Export.prototype.exportFlip = function (tempContext, flipHorizontal, flipVertical) {
|
|
@@ -343,12 +326,12 @@ var Export = /** @class */ (function () {
|
|
|
343
326
|
var newWidth;
|
|
344
327
|
var newHeight;
|
|
345
328
|
if (degree % 90 === 0 && degree % 180 !== 0) {
|
|
346
|
-
newWidth = this.parent.baseImg.height;
|
|
347
|
-
newHeight = this.parent.baseImg.width;
|
|
329
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
330
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
348
331
|
}
|
|
349
332
|
else if (degree % 180 === 0 || degree === 0) {
|
|
350
|
-
newWidth = this.parent.baseImg.width;
|
|
351
|
-
newHeight = this.parent.baseImg.height;
|
|
333
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
334
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
352
335
|
}
|
|
353
336
|
tempCanvas.width = newWidth;
|
|
354
337
|
tempCanvas.height = newHeight;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventHandler, extend, isBlazor, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
+
import { ShapeType } from '../index';
|
|
2
3
|
var FreehandDrawing = /** @class */ (function () {
|
|
3
4
|
function FreehandDrawing(parent) {
|
|
4
5
|
this.fhdObj = { lastWidth: 0, lastVelocity: 0, time: 0, pointX: 0, pointY: 0 };
|
|
@@ -604,6 +605,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
604
605
|
}
|
|
605
606
|
};
|
|
606
607
|
FreehandDrawing.prototype.selectFhd = function (index) {
|
|
608
|
+
var _this = this;
|
|
607
609
|
var parent = this.parent;
|
|
608
610
|
parent.notify('selection', { prop: 'setFreehandDrawEditing', onPropertyChange: false, value: { bool: true } });
|
|
609
611
|
if (index || index === 0) {
|
|
@@ -628,7 +630,28 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
628
630
|
var obj = { bool: false };
|
|
629
631
|
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
630
632
|
if (obj['bool']) {
|
|
631
|
-
|
|
633
|
+
var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
|
|
634
|
+
startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
|
|
635
|
+
strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
|
|
636
|
+
points: parent.pointColl[this.fhdSelIdx].points };
|
|
637
|
+
var shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
|
|
638
|
+
currentShapeSettings: shapeSettings };
|
|
639
|
+
if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
640
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
641
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
|
|
642
|
+
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[_this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
643
|
+
parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[_this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
644
|
+
parent.pointColl[_this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
645
|
+
_this.freehandRedraw(_this.upperContext);
|
|
646
|
+
parent.updateToolbar(parent.element, 'colorToolbar');
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
651
|
+
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
652
|
+
parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
653
|
+
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
654
|
+
this.freehandRedraw(this.upperContext);
|
|
632
655
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
633
656
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
634
657
|
}
|
|
@@ -240,6 +240,9 @@ var Selection = /** @class */ (function () {
|
|
|
240
240
|
case 'unWireEvent':
|
|
241
241
|
this.unwireEvent();
|
|
242
242
|
break;
|
|
243
|
+
case 'updPtCollForShpRot':
|
|
244
|
+
this.updPtCollForShpRot(args.value['obj']);
|
|
245
|
+
break;
|
|
243
246
|
}
|
|
244
247
|
};
|
|
245
248
|
Selection.prototype.getModuleName = function () {
|
|
@@ -3101,6 +3104,9 @@ var Selection = /** @class */ (function () {
|
|
|
3101
3104
|
if (!this.isFhdEditing) {
|
|
3102
3105
|
this.applyCurrActObj(x, y);
|
|
3103
3106
|
parent.currObjType.isResize = false;
|
|
3107
|
+
if (!isBlazor()) {
|
|
3108
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
3109
|
+
}
|
|
3104
3110
|
}
|
|
3105
3111
|
}
|
|
3106
3112
|
if (parent.activeObj) {
|
|
@@ -4424,8 +4430,10 @@ var Selection = /** @class */ (function () {
|
|
|
4424
4430
|
fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
|
|
4425
4431
|
radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
|
|
4426
4432
|
length: parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ? parent.activeObj.activePoint.width : null,
|
|
4427
|
-
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
4433
|
+
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
4434
|
+
(parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
|
|
4428
4435
|
fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
|
|
4436
|
+
fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
|
|
4429
4437
|
fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
|
|
4430
4438
|
color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
|
|
4431
4439
|
};
|
|
@@ -4469,12 +4477,14 @@ var Selection = /** @class */ (function () {
|
|
|
4469
4477
|
if (degree < 0) {
|
|
4470
4478
|
degree = 360 + degree;
|
|
4471
4479
|
}
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4480
|
+
if (obj.flipObjColl) {
|
|
4481
|
+
for (var i = 0; i < obj.flipObjColl.length; i++) {
|
|
4482
|
+
if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
4483
|
+
isHorizontalflip = true;
|
|
4484
|
+
}
|
|
4485
|
+
else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
4486
|
+
isVerticalflip = true;
|
|
4487
|
+
}
|
|
4478
4488
|
}
|
|
4479
4489
|
}
|
|
4480
4490
|
if (degree === 0 || degree === 360) {
|
|
@@ -26,7 +26,9 @@ export declare class Shape {
|
|
|
26
26
|
private setDimension;
|
|
27
27
|
private getArrowType;
|
|
28
28
|
private drawShape;
|
|
29
|
+
private initShapeProps;
|
|
29
30
|
private setPointCollForLineAndArrow;
|
|
31
|
+
private prevObjColl;
|
|
30
32
|
private drawShapeText;
|
|
31
33
|
private drawShapeTextEvent;
|
|
32
34
|
private initializeTextShape;
|
|
@@ -38,7 +38,7 @@ var Shape = /** @class */ (function () {
|
|
|
38
38
|
this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
|
|
39
39
|
break;
|
|
40
40
|
case 'drawRectangle':
|
|
41
|
-
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['
|
|
41
|
+
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
|
|
42
42
|
break;
|
|
43
43
|
case 'drawText':
|
|
44
44
|
this.drawText(args.value['x'], args.value['y'], args.value['text'], args.value['fontFamily'], args.value['fontSize'], args.value['bold'], args.value['italic'], args.value['color']);
|
|
@@ -229,10 +229,10 @@ var Shape = /** @class */ (function () {
|
|
|
229
229
|
{ text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
230
230
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
231
231
|
};
|
|
232
|
-
Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
232
|
+
Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
|
|
233
233
|
this.initializeShape('ellipse');
|
|
234
234
|
var start = x && y ? { x: x, y: y } : null;
|
|
235
|
-
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
235
|
+
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
|
|
236
236
|
};
|
|
237
237
|
Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
238
238
|
this.initializeShape('line');
|
|
@@ -263,10 +263,10 @@ var Shape = /** @class */ (function () {
|
|
|
263
263
|
var height = endY - startY;
|
|
264
264
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
265
265
|
};
|
|
266
|
-
Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
266
|
+
Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
|
|
267
267
|
this.initializeShape('rectangle');
|
|
268
268
|
var start = x && y ? { x: x, y: y } : null;
|
|
269
|
-
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
269
|
+
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
|
|
270
270
|
};
|
|
271
271
|
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
272
272
|
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
|
|
@@ -305,7 +305,7 @@ var Shape = /** @class */ (function () {
|
|
|
305
305
|
}
|
|
306
306
|
return arrowType;
|
|
307
307
|
};
|
|
308
|
-
Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
|
|
308
|
+
Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
|
|
309
309
|
var _this = this;
|
|
310
310
|
var parent = this.parent;
|
|
311
311
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
@@ -374,10 +374,7 @@ var Shape = /** @class */ (function () {
|
|
|
374
374
|
parent.activeObj.triangleDirection = 'right';
|
|
375
375
|
}
|
|
376
376
|
parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
|
|
377
|
-
|
|
378
|
-
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
379
|
-
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
380
|
-
parent.activeObj.flipObjColl = [];
|
|
377
|
+
this.initShapeProps();
|
|
381
378
|
var obj = { shapeSettingsObj: {} };
|
|
382
379
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
383
380
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
@@ -389,6 +386,10 @@ var Shape = /** @class */ (function () {
|
|
|
389
386
|
_this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
390
387
|
_this.setDimension(width, height);
|
|
391
388
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
389
|
+
if (degree) {
|
|
390
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
391
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
392
|
+
}
|
|
392
393
|
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
|
|
393
394
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
394
395
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
|
|
@@ -403,6 +404,10 @@ var Shape = /** @class */ (function () {
|
|
|
403
404
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
404
405
|
this.setDimension(width, height);
|
|
405
406
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
407
|
+
if (degree) {
|
|
408
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
409
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
410
|
+
}
|
|
406
411
|
if (!isBlazor()) {
|
|
407
412
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
408
413
|
}
|
|
@@ -423,6 +428,13 @@ var Shape = /** @class */ (function () {
|
|
|
423
428
|
}
|
|
424
429
|
}
|
|
425
430
|
};
|
|
431
|
+
Shape.prototype.initShapeProps = function () {
|
|
432
|
+
var parent = this.parent;
|
|
433
|
+
parent.activeObj.shapeDegree = parent.transform.degree;
|
|
434
|
+
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
435
|
+
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
436
|
+
parent.activeObj.flipObjColl = [];
|
|
437
|
+
};
|
|
426
438
|
Shape.prototype.setPointCollForLineAndArrow = function () {
|
|
427
439
|
var parent = this.parent;
|
|
428
440
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
@@ -437,6 +449,19 @@ var Shape = /** @class */ (function () {
|
|
|
437
449
|
}
|
|
438
450
|
}
|
|
439
451
|
};
|
|
452
|
+
Shape.prototype.prevObjColl = function () {
|
|
453
|
+
var parent = this.parent;
|
|
454
|
+
var object = { currObj: {} };
|
|
455
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
456
|
+
this.prevObj = object['currObj'];
|
|
457
|
+
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
458
|
+
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
459
|
+
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
460
|
+
var selPointCollObj = { selPointColl: null };
|
|
461
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
462
|
+
value: { obj: selPointCollObj } });
|
|
463
|
+
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
464
|
+
};
|
|
440
465
|
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
|
|
441
466
|
var _this = this;
|
|
442
467
|
var parent = this.parent;
|
|
@@ -449,16 +474,7 @@ var Shape = /** @class */ (function () {
|
|
|
449
474
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
450
475
|
parent.togglePen = false;
|
|
451
476
|
this.redrawActObj();
|
|
452
|
-
|
|
453
|
-
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
454
|
-
this.prevObj = object['currObj'];
|
|
455
|
-
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
456
|
-
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
457
|
-
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
458
|
-
var selPointCollObj = { selPointColl: null };
|
|
459
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
460
|
-
value: { obj: selPointCollObj } });
|
|
461
|
-
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
477
|
+
this.prevObjColl();
|
|
462
478
|
this.refreshActiveObj();
|
|
463
479
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
464
480
|
parent.currObjType.isCustomCrop = false;
|
|
@@ -549,6 +565,9 @@ var Shape = /** @class */ (function () {
|
|
|
549
565
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
550
566
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
551
567
|
}
|
|
568
|
+
else {
|
|
569
|
+
parent.updateToolbar(parent.element, 'text');
|
|
570
|
+
}
|
|
552
571
|
};
|
|
553
572
|
Shape.prototype.initializeTextShape = function (text, fontFamily, fontSize, bold, italic, strokeColor) {
|
|
554
573
|
var parent = this.parent;
|
|
@@ -697,9 +716,12 @@ var Shape = /** @class */ (function () {
|
|
|
697
716
|
parent.activeObj.activePoint.width = shapeSettings.length;
|
|
698
717
|
break;
|
|
699
718
|
case 'text':
|
|
700
|
-
parent.activeObj.keyHistory = shapeSettings.text;
|
|
719
|
+
parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
|
|
701
720
|
parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
|
|
702
721
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
|
|
722
|
+
parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
|
|
723
|
+
break;
|
|
724
|
+
case 'rectangle':
|
|
703
725
|
break;
|
|
704
726
|
}
|
|
705
727
|
if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
|
|
@@ -1565,6 +1587,7 @@ var Shape = /** @class */ (function () {
|
|
|
1565
1587
|
if (actObj.flipObjColl.length === 4) {
|
|
1566
1588
|
actObj.flipObjColl = [];
|
|
1567
1589
|
flip = '';
|
|
1590
|
+
actObj.shapeFlip = '';
|
|
1568
1591
|
}
|
|
1569
1592
|
if (flip === '' && actObj.flipObjColl.length > 1) {
|
|
1570
1593
|
flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
|
|
@@ -2216,6 +2239,10 @@ var Shape = /** @class */ (function () {
|
|
|
2216
2239
|
shapeDetails.fontStyle.push('italic');
|
|
2217
2240
|
}
|
|
2218
2241
|
break;
|
|
2242
|
+
case 'path':
|
|
2243
|
+
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
2244
|
+
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
2245
|
+
break;
|
|
2219
2246
|
}
|
|
2220
2247
|
return shapeDetails;
|
|
2221
2248
|
};
|
|
@@ -2486,7 +2513,12 @@ var Shape = /** @class */ (function () {
|
|
|
2486
2513
|
this.lowerContext.filter = object['canvasFilter'];
|
|
2487
2514
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
2488
2515
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
2489
|
-
|
|
2516
|
+
if (!isBlazor()) {
|
|
2517
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
2518
|
+
}
|
|
2519
|
+
else {
|
|
2520
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
2521
|
+
}
|
|
2490
2522
|
}
|
|
2491
2523
|
};
|
|
2492
2524
|
Shape.prototype.getMaxText = function (isTextBox, text, obj) {
|
|
@@ -144,6 +144,12 @@ var Transform = /** @class */ (function () {
|
|
|
144
144
|
this.cropDimension.width = args.value['width'];
|
|
145
145
|
this.cropDimension.height = args.value['height'];
|
|
146
146
|
break;
|
|
147
|
+
case 'getPreventSelect':
|
|
148
|
+
args.value['obj']['bool'] = this.isPreventSelect;
|
|
149
|
+
break;
|
|
150
|
+
case 'setPreventSelect':
|
|
151
|
+
this.isPreventSelect = args.value['bool'];
|
|
152
|
+
break;
|
|
147
153
|
case 'reset':
|
|
148
154
|
this.reset();
|
|
149
155
|
break;
|
|
@@ -1268,6 +1274,9 @@ var Transform = /** @class */ (function () {
|
|
|
1268
1274
|
parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
|
|
1269
1275
|
value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
|
|
1270
1276
|
parent.objColl[i].flipObjColl = flipObjColl['collection'];
|
|
1277
|
+
if (parent.objColl[i].flipObjColl.length === 0) {
|
|
1278
|
+
parent.objColl[i].shapeFlip = '';
|
|
1279
|
+
}
|
|
1271
1280
|
}
|
|
1272
1281
|
}
|
|
1273
1282
|
if (tempZoomFactor !== 0) {
|
|
@@ -1633,6 +1642,7 @@ var Transform = /** @class */ (function () {
|
|
|
1633
1642
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1634
1643
|
this.lowerContext.filter = tempFilter;
|
|
1635
1644
|
parent.initialAdjustmentValue = tempFilter;
|
|
1645
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
1636
1646
|
if (parent.isImageLoaded) {
|
|
1637
1647
|
showSpinner(parent.element);
|
|
1638
1648
|
parent.element.style.opacity = '0.5';
|
|
@@ -439,7 +439,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
439
439
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
440
440
|
this.lowerContext.filter = this.getDefaultFilter();
|
|
441
441
|
this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
442
|
-
this.
|
|
442
|
+
this.canvasFilter = this.lowerContext.filter;
|
|
443
443
|
this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
|
|
444
444
|
if (this.cssClass) {
|
|
445
445
|
addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
|
|
@@ -1441,8 +1441,10 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1441
1441
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
1442
1442
|
var data = this.getImageData();
|
|
1443
1443
|
if (!isBlazor()) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1444
|
+
if (!Browser.isDevice) {
|
|
1445
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
1446
|
+
isApplyBtn: true, isCropping: false } });
|
|
1447
|
+
}
|
|
1446
1448
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
1447
1449
|
}
|
|
1448
1450
|
this.objColl = objColl;
|
|
@@ -2057,8 +2059,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
2057
2059
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2058
2060
|
this.element = element;
|
|
2059
2061
|
var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
2060
|
-
if (this.element.querySelector('#' + this.element.id + '
|
|
2061
|
-
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '
|
|
2062
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
|
|
2063
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
2062
2064
|
}
|
|
2063
2065
|
else {
|
|
2064
2066
|
this.toolbarHeight = 0;
|
|
@@ -110,8 +110,8 @@ export interface CropEventArgs {
|
|
|
110
110
|
*/
|
|
111
111
|
endPoint: Point;
|
|
112
112
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
* Specifies whether to prevent scale-based cropping in the image editor.
|
|
114
|
+
*/
|
|
115
115
|
preventScaling: boolean;
|
|
116
116
|
/**
|
|
117
117
|
* Defines whether to cancel the cropping action of image editor.
|
|
@@ -373,6 +373,10 @@ export interface ShapeSettings {
|
|
|
373
373
|
* Returns the font size of the text.
|
|
374
374
|
*/
|
|
375
375
|
fontSize?: number;
|
|
376
|
+
/**
|
|
377
|
+
* Returns the font family of the text.
|
|
378
|
+
*/
|
|
379
|
+
fontFamily?: string;
|
|
376
380
|
/**
|
|
377
381
|
* Returns the font style of the text.
|
|
378
382
|
*/
|
|
@@ -198,9 +198,6 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
198
198
|
case 'getCanvasFilter':
|
|
199
199
|
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
200
200
|
break;
|
|
201
|
-
case 'setCanvasFilter':
|
|
202
|
-
parent.canvasFilter = args.value['filter'];
|
|
203
|
-
break;
|
|
204
201
|
case 'getDefToolbarItems':
|
|
205
202
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
206
203
|
break;
|
|
@@ -1606,7 +1603,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1606
1603
|
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
1607
1604
|
return;
|
|
1608
1605
|
}
|
|
1609
|
-
var
|
|
1606
|
+
var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
|
|
1607
|
+
var args = { toolbarType: item };
|
|
1610
1608
|
if (type !== 'filter' && type !== 'color') {
|
|
1611
1609
|
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
1612
1610
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
@@ -2822,7 +2820,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
2822
2820
|
var parent = this.parent;
|
|
2823
2821
|
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
2824
2822
|
parent.currObjType.isFiltered) {
|
|
2825
|
-
parent.initialAdjustmentValue =
|
|
2823
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
2824
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
2826
2825
|
parent.currObjType.isFiltered = false;
|
|
2827
2826
|
}
|
|
2828
2827
|
};
|