@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
|
@@ -46,7 +46,7 @@ class Crop {
|
|
|
46
46
|
this.crop(args.value['obj']);
|
|
47
47
|
break;
|
|
48
48
|
case 'calcRatio':
|
|
49
|
-
this.calcRatio(args.value['obj']);
|
|
49
|
+
this.calcRatio(args.value['obj'], args.value['dimension']);
|
|
50
50
|
break;
|
|
51
51
|
case 'isObjInImage':
|
|
52
52
|
this.isObjInImage(args.value['obj'], args.value['object']);
|
|
@@ -192,112 +192,74 @@ class Crop {
|
|
|
192
192
|
rotateCrop() {
|
|
193
193
|
const parent = this.parent;
|
|
194
194
|
const shape = parent.activeObj.shape || '';
|
|
195
|
-
const tempDegree = parent.transform.degree;
|
|
196
195
|
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
197
196
|
parent.currSelectionPoint = extend({}, parent.activeObj, {}, true);
|
|
198
197
|
parent.objColl.push(parent.activeObj);
|
|
199
198
|
parent.activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
200
|
-
this.lowerContext.setTransform(1, 0, 0, 1, 0, 0);
|
|
201
|
-
parent.notify('draw', { prop: 'setClientTransDim', onPropertyChange: false,
|
|
202
|
-
value: { isPreventDimension: null } });
|
|
203
|
-
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
204
|
-
parent.transform.degree = 0;
|
|
205
|
-
const temp = this.lowerContext.filter;
|
|
206
|
-
parent.notify('finetune', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
207
|
-
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);
|
|
208
|
-
this.lowerContext.filter = temp;
|
|
209
|
-
let length = 0;
|
|
210
|
-
if (tempDegree === 90 || tempDegree === -270) {
|
|
211
|
-
length = 3;
|
|
212
|
-
}
|
|
213
|
-
else if (tempDegree === 180 || tempDegree === -180) {
|
|
214
|
-
length = 2;
|
|
215
|
-
}
|
|
216
|
-
else if (tempDegree === 270 || tempDegree === -90) {
|
|
217
|
-
length = 1;
|
|
218
|
-
}
|
|
219
|
-
for (let i = 0; i < length; i++) {
|
|
220
|
-
parent.notify('shape', { prop: 'rotateObjColl', onPropertyChange: false });
|
|
221
|
-
parent.notify('freehand-draw', { prop: 'rotateFhdColl', onPropertyChange: false });
|
|
222
|
-
}
|
|
223
199
|
let activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
parent.transform.degree = tempDegree;
|
|
232
|
-
const flipState = this.getCurrCropState('initial');
|
|
233
|
-
parent.transform.degree = 0;
|
|
234
|
-
parent.notify('shape', { prop: 'redrawObj', onPropertyChange: false, value: { degree: flipState } });
|
|
235
|
-
parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
|
|
236
|
-
value: { value: flipState } });
|
|
237
|
-
}
|
|
238
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
239
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
200
|
+
const tempCurrSelObj = extend({}, parent.currSelectionPoint, {}, true);
|
|
201
|
+
const preventSelObj = { bool: null };
|
|
202
|
+
parent.notify('transform', { prop: 'getPreventSelect', onPropertyChange: false, value: { obj: preventSelObj } });
|
|
203
|
+
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: true } });
|
|
204
|
+
const coll = extend([], parent.rotateFlipColl, [], true);
|
|
205
|
+
this.panToSelRangle(true);
|
|
206
|
+
this.revertTransform('initial', coll);
|
|
240
207
|
activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
241
208
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
242
209
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
243
210
|
parent.objColl.pop();
|
|
244
211
|
parent.transform.degree = 0;
|
|
245
212
|
this.cropImg(true);
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
parent.transform
|
|
249
|
-
parent.notify('draw', { prop: '
|
|
250
|
-
parent.notify('draw', { prop: '
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
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);
|
|
254
|
-
this.lowerContext.filter = temp;
|
|
255
|
-
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
256
|
-
value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: null } });
|
|
257
|
-
length = 0;
|
|
258
|
-
if (tempDegree === 90 || tempDegree === -270) {
|
|
259
|
-
length = 1;
|
|
260
|
-
}
|
|
261
|
-
else if (tempDegree === 180 || tempDegree === -180) {
|
|
262
|
-
length = 2;
|
|
263
|
-
}
|
|
264
|
-
else if (tempDegree === 270 || tempDegree === -90) {
|
|
265
|
-
length = 3;
|
|
213
|
+
this.revertTransform('reverse', coll);
|
|
214
|
+
parent.currSelectionPoint = tempCurrSelObj;
|
|
215
|
+
parent.notify('transform', { prop: 'setPreventSelect', onPropertyChange: false, value: { bool: preventSelObj['bool'] } });
|
|
216
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
217
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
218
|
+
if (shape === 'crop-circle') {
|
|
219
|
+
this.cropCircle(this.lowerContext);
|
|
266
220
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
221
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
222
|
+
parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
|
|
223
|
+
}
|
|
224
|
+
revertTransform(type, coll) {
|
|
225
|
+
const parent = this.parent;
|
|
226
|
+
const obj = { isRotate: false };
|
|
227
|
+
if (type === 'initial') {
|
|
228
|
+
for (let i = coll.length - 1; i >= 0; i--) {
|
|
229
|
+
switch (coll[i]) {
|
|
230
|
+
case 90:
|
|
231
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
|
|
232
|
+
break;
|
|
233
|
+
case -90:
|
|
234
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
|
|
235
|
+
break;
|
|
236
|
+
default:
|
|
237
|
+
parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
270
241
|
}
|
|
271
|
-
|
|
242
|
+
else {
|
|
272
243
|
for (let i = 0, len = parent.objColl.length; i < len; i++) {
|
|
273
244
|
parent.objColl[i].shapeFlip = '';
|
|
274
245
|
}
|
|
275
246
|
for (let i = 0; i < parent.freehandCounter; i++) {
|
|
276
247
|
parent.pointColl[i].shapeFlip = '';
|
|
277
248
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
249
|
+
for (let i = 0, len = coll.length; i < len; i++) {
|
|
250
|
+
switch (coll[i]) {
|
|
251
|
+
case 90:
|
|
252
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: 90, obj: obj } });
|
|
253
|
+
break;
|
|
254
|
+
case -90:
|
|
255
|
+
parent.notify('transform', { prop: 'rotate', value: { degree: -90, obj: obj } });
|
|
256
|
+
break;
|
|
257
|
+
default:
|
|
258
|
+
parent.notify('transform', { prop: 'flipImage', value: { direction: parent.toPascalCase(coll[i]) } });
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
290
261
|
}
|
|
291
262
|
}
|
|
292
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
293
|
-
this.lowerContext.filter = temp;
|
|
294
|
-
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
295
|
-
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
296
|
-
if (shape === 'crop-circle') {
|
|
297
|
-
this.cropCircle(this.lowerContext);
|
|
298
|
-
}
|
|
299
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
300
|
-
parent.notify('draw', { prop: 'resetPanPoints', onPropertyChange: false });
|
|
301
263
|
}
|
|
302
264
|
flipCrop() {
|
|
303
265
|
const parent = this.parent;
|
|
@@ -498,6 +460,15 @@ class Crop {
|
|
|
498
460
|
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);
|
|
499
461
|
parent.notify('draw', { prop: 'currTransState', onPropertyChange: false,
|
|
500
462
|
value: { type: 'reverse', isPreventDestination: null, context: null, isPreventCircleCrop: true } });
|
|
463
|
+
let cropObjColl = extend([], parent.objColl, null, true);
|
|
464
|
+
let cropPointColl = extend([], parent.pointColl, null, true);
|
|
465
|
+
parent.objColl = [];
|
|
466
|
+
parent.pointColl = [];
|
|
467
|
+
parent.freehandCounter = 0;
|
|
468
|
+
this.panToSelRangle();
|
|
469
|
+
parent.objColl = cropObjColl;
|
|
470
|
+
parent.pointColl = cropPointColl;
|
|
471
|
+
parent.freehandCounter = parent.pointColl.length;
|
|
501
472
|
if (parent.cropObj.activeObj.shape) {
|
|
502
473
|
const destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
|
|
503
474
|
height: parent.img.destHeight };
|
|
@@ -514,8 +485,8 @@ class Crop {
|
|
|
514
485
|
parent.img.destWidth = destPoints.width;
|
|
515
486
|
parent.img.destHeight = destPoints.height;
|
|
516
487
|
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
517
|
-
|
|
518
|
-
|
|
488
|
+
cropObjColl = extend([], parent.objColl, null, true);
|
|
489
|
+
cropPointColl = extend([], parent.pointColl, null, true);
|
|
519
490
|
parent.objColl = [];
|
|
520
491
|
parent.pointColl = [];
|
|
521
492
|
parent.freehandCounter = 0;
|
|
@@ -526,9 +497,12 @@ class Crop {
|
|
|
526
497
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
527
498
|
value: { obj: { selPointColl: [] } } });
|
|
528
499
|
parent.cropObj.filter = this.lowerContext.filter;
|
|
500
|
+
const actObj = extend({}, parent.currSelectionPoint, null, true);
|
|
529
501
|
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: null } });
|
|
502
|
+
parent.activeObj = extend({}, actObj, null, true);
|
|
530
503
|
const activeObj = extend({}, parent.activeObj, null, true);
|
|
531
504
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
505
|
+
this.panToSelRangle();
|
|
532
506
|
parent.objColl = cropObjColl;
|
|
533
507
|
parent.pointColl = cropPointColl;
|
|
534
508
|
parent.freehandCounter = parent.pointColl.length;
|
|
@@ -560,6 +534,28 @@ class Crop {
|
|
|
560
534
|
parent.currSelectionPoint = null;
|
|
561
535
|
}
|
|
562
536
|
}
|
|
537
|
+
panToSelRangle(isReverse) {
|
|
538
|
+
const parent = this.parent;
|
|
539
|
+
const obj = extend({}, parent.currSelectionPoint, null, true);
|
|
540
|
+
parent.currSelectionPoint = null;
|
|
541
|
+
const panX = parent.transform.degree === 0 ?
|
|
542
|
+
isReverse ? -parent.cropObj.totalPannedPoint.x : parent.cropObj.totalPannedPoint.x :
|
|
543
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x;
|
|
544
|
+
const panY = parent.transform.degree === 0 ?
|
|
545
|
+
isReverse ? -parent.cropObj.totalPannedPoint.y : parent.cropObj.totalPannedPoint.y :
|
|
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 {
|
|
553
|
+
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
554
|
+
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
555
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
556
|
+
}
|
|
557
|
+
parent.currSelectionPoint = obj;
|
|
558
|
+
}
|
|
563
559
|
cropCircle(context, isSave, isFlip) {
|
|
564
560
|
const parent = this.parent;
|
|
565
561
|
if (isFlip && parent.transform.currFlipState !== '') {
|
|
@@ -568,9 +564,9 @@ class Crop {
|
|
|
568
564
|
}
|
|
569
565
|
context.globalCompositeOperation = 'destination-in';
|
|
570
566
|
context.beginPath();
|
|
571
|
-
const centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) :
|
|
572
|
-
const centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) :
|
|
573
|
-
const radius = parent.img.destWidth / 2;
|
|
567
|
+
const centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
|
|
568
|
+
const centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
|
|
569
|
+
const radius = isSave ? context.canvas.width / 2 : parent.img.destWidth / 2;
|
|
574
570
|
context.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
575
571
|
context.closePath();
|
|
576
572
|
context.fill();
|
|
@@ -748,7 +744,6 @@ class Crop {
|
|
|
748
744
|
}
|
|
749
745
|
this.cropImg();
|
|
750
746
|
parent.transform.zoomFactor = 0;
|
|
751
|
-
parent.zoomSettings.zoomFactor = 1;
|
|
752
747
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
753
748
|
parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
|
|
754
749
|
value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
|
|
@@ -774,17 +769,17 @@ class Crop {
|
|
|
774
769
|
}
|
|
775
770
|
}
|
|
776
771
|
}
|
|
777
|
-
calcRatio(obj) {
|
|
772
|
+
calcRatio(obj, dimension) {
|
|
778
773
|
const parent = this.parent;
|
|
779
774
|
let widthRatio;
|
|
780
775
|
let heightRatio;
|
|
781
776
|
if (parent.transform.degree === 0 || parent.transform.degree % 180 === 0) {
|
|
782
|
-
widthRatio = parent.baseImg.width / parent.img.destWidth;
|
|
783
|
-
heightRatio = parent.baseImg.height / parent.img.destHeight;
|
|
777
|
+
widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
|
|
778
|
+
heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
|
|
784
779
|
}
|
|
785
780
|
else {
|
|
786
|
-
widthRatio = parent.baseImg.height / parent.img.destWidth;
|
|
787
|
-
heightRatio = parent.baseImg.width / parent.img.destHeight;
|
|
781
|
+
widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
|
|
782
|
+
heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
|
|
788
783
|
}
|
|
789
784
|
if (obj) {
|
|
790
785
|
obj['width'] = widthRatio;
|
|
@@ -1116,6 +1111,10 @@ class Draw {
|
|
|
1116
1111
|
parent.activeObj = extend({}, obj, {}, true);
|
|
1117
1112
|
}
|
|
1118
1113
|
this.updateActiveObject();
|
|
1114
|
+
if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
|
|
1115
|
+
isNullOrUndefined(parent.activeObj.activePoint.startY)) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1119
1118
|
if (parent.currObjType.isText) {
|
|
1120
1119
|
const obj = { keyHistory: '' };
|
|
1121
1120
|
parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj } });
|
|
@@ -1786,12 +1785,14 @@ class Draw {
|
|
|
1786
1785
|
if (degree < 0) {
|
|
1787
1786
|
degree = 360 + degree;
|
|
1788
1787
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1788
|
+
if (parent.activeObj.flipObjColl) {
|
|
1789
|
+
for (let i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
|
|
1790
|
+
if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
1791
|
+
isHorizontalflip = true;
|
|
1792
|
+
}
|
|
1793
|
+
else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
1794
|
+
isVerticalflip = true;
|
|
1795
|
+
}
|
|
1795
1796
|
}
|
|
1796
1797
|
}
|
|
1797
1798
|
switch (degree) {
|
|
@@ -2332,7 +2333,7 @@ class Draw {
|
|
|
2332
2333
|
}
|
|
2333
2334
|
shapeText(canvasDraw) {
|
|
2334
2335
|
const parent = this.parent;
|
|
2335
|
-
|
|
2336
|
+
let actPoint = parent.activeObj.activePoint;
|
|
2336
2337
|
const rows = parent.activeObj.keyHistory.split('\n');
|
|
2337
2338
|
const height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
|
|
2338
2339
|
const lineHeight = ((height * rows.length) - (parent.activeObj.textSettings.fontSize * rows.length)) / rows.length;
|
|
@@ -2370,17 +2371,18 @@ class Draw {
|
|
|
2370
2371
|
parent.activeObj.textSettings.fontFamily;
|
|
2371
2372
|
if (parent.activeObj.flipObjColl.length === 4) {
|
|
2372
2373
|
parent.activeObj.flipObjColl = [];
|
|
2374
|
+
parent.activeObj.shapeFlip = '';
|
|
2373
2375
|
}
|
|
2374
2376
|
for (let j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
|
|
2375
2377
|
if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
|
|
2376
2378
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
2377
2379
|
canvasDraw.scale(-1, 1);
|
|
2378
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
2380
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
2379
2381
|
}
|
|
2380
2382
|
else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
|
|
2381
2383
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
2382
2384
|
canvasDraw.scale(1, -1);
|
|
2383
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
2385
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
2384
2386
|
}
|
|
2385
2387
|
}
|
|
2386
2388
|
if (parent.activeObj.shapeDegree !== parent.transform.degree) {
|
|
@@ -2393,12 +2395,12 @@ class Draw {
|
|
|
2393
2395
|
if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
|
|
2394
2396
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
2395
2397
|
canvasDraw.scale(-1, 1);
|
|
2396
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
2398
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
2397
2399
|
}
|
|
2398
2400
|
else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
|
|
2399
2401
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
2400
2402
|
canvasDraw.scale(1, -1);
|
|
2401
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
2403
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
2402
2404
|
}
|
|
2403
2405
|
}
|
|
2404
2406
|
}
|
|
@@ -2434,6 +2436,7 @@ class Draw {
|
|
|
2434
2436
|
this.updateActiveObject(actPoint, parent.activeObj);
|
|
2435
2437
|
}
|
|
2436
2438
|
}
|
|
2439
|
+
return actPoint;
|
|
2437
2440
|
}
|
|
2438
2441
|
rotateText(canvasDraw) {
|
|
2439
2442
|
const parent = this.parent;
|
|
@@ -2447,6 +2450,9 @@ class Draw {
|
|
|
2447
2450
|
else {
|
|
2448
2451
|
degree = parent.transform.degree - parent.activeObj.shapeDegree;
|
|
2449
2452
|
}
|
|
2453
|
+
if (degree === -450) {
|
|
2454
|
+
degree = -90;
|
|
2455
|
+
}
|
|
2450
2456
|
if (degree < 0) {
|
|
2451
2457
|
degree = 360 + degree;
|
|
2452
2458
|
}
|
|
@@ -3770,11 +3776,8 @@ class Draw {
|
|
|
3770
3776
|
}
|
|
3771
3777
|
}
|
|
3772
3778
|
else {
|
|
3773
|
-
if (parent.element.querySelector('#' + parent.element.id + '
|
|
3774
|
-
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '
|
|
3775
|
-
}
|
|
3776
|
-
else {
|
|
3777
|
-
parent.toolbarHeight = 0;
|
|
3779
|
+
if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
3780
|
+
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3778
3781
|
}
|
|
3779
3782
|
}
|
|
3780
3783
|
parent.reset();
|
|
@@ -3817,8 +3820,8 @@ class Draw {
|
|
|
3817
3820
|
parent.clearContext(this.lowerContext);
|
|
3818
3821
|
parent.clearContext(this.upperContext);
|
|
3819
3822
|
parent.clearContext(inMemoryContext);
|
|
3820
|
-
parent.inMemoryCanvas.width =
|
|
3821
|
-
parent.inMemoryCanvas.height =
|
|
3823
|
+
parent.inMemoryCanvas.width = this.openURL.width;
|
|
3824
|
+
parent.inMemoryCanvas.height = this.openURL.height;
|
|
3822
3825
|
inMemoryContext.putImageData(this.openURL, 0, 0);
|
|
3823
3826
|
parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
|
|
3824
3827
|
}
|
|
@@ -3974,75 +3977,84 @@ class Draw {
|
|
|
3974
3977
|
moveToSelectionRange(type, activeObj) {
|
|
3975
3978
|
const parent = this.parent;
|
|
3976
3979
|
if (parent.activeObj.shape) {
|
|
3977
|
-
|
|
3980
|
+
let isRotated = false;
|
|
3981
|
+
for (let i = 0; i < parent.rotateFlipColl.length; i++) {
|
|
3982
|
+
if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
|
|
3983
|
+
isRotated = true;
|
|
3984
|
+
break;
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
if (isRotated) {
|
|
3978
3988
|
let zoomFactor = parent.transform.zoomFactor;
|
|
3979
3989
|
parent.objColl.push(parent.activeObj);
|
|
3980
3990
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3981
|
-
if (
|
|
3982
|
-
if (parent.
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3991
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3992
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3993
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3994
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3995
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3996
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3997
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3998
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3999
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4000
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4001
|
+
}
|
|
4002
|
+
break;
|
|
3990
4003
|
}
|
|
3991
|
-
|
|
4004
|
+
zoomFactor += 0.1;
|
|
4005
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4006
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3992
4007
|
}
|
|
3993
|
-
zoomFactor += 0.1;
|
|
3994
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3995
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3996
4008
|
}
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4009
|
+
else {
|
|
4010
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4011
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
4012
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4013
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4014
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4015
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4016
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4017
|
+
}
|
|
4018
|
+
break;
|
|
4006
4019
|
}
|
|
4007
|
-
|
|
4020
|
+
zoomFactor -= .1;
|
|
4021
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4022
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4008
4023
|
}
|
|
4009
|
-
zoomFactor -= .1;
|
|
4010
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4011
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4012
4024
|
}
|
|
4013
4025
|
}
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4026
|
+
else {
|
|
4027
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
4028
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4029
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4030
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4031
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4032
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4033
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4034
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4035
|
+
}
|
|
4036
|
+
break;
|
|
4024
4037
|
}
|
|
4025
|
-
|
|
4038
|
+
zoomFactor += 0.1;
|
|
4039
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4040
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4026
4041
|
}
|
|
4027
|
-
zoomFactor += 0.1;
|
|
4028
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4029
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4030
4042
|
}
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4043
|
+
else {
|
|
4044
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4045
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4046
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4047
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4048
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4049
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4050
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4051
|
+
}
|
|
4052
|
+
break;
|
|
4040
4053
|
}
|
|
4041
|
-
|
|
4054
|
+
zoomFactor -= .1;
|
|
4055
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4056
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4042
4057
|
}
|
|
4043
|
-
zoomFactor -= .1;
|
|
4044
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4045
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4046
4058
|
}
|
|
4047
4059
|
}
|
|
4048
4060
|
}
|
|
@@ -4250,8 +4262,19 @@ class Export {
|
|
|
4250
4262
|
}
|
|
4251
4263
|
exportToCanvas(object) {
|
|
4252
4264
|
const parent = this.parent;
|
|
4265
|
+
let width;
|
|
4266
|
+
let height;
|
|
4267
|
+
if (parent.currSelectionPoint) {
|
|
4268
|
+
width = parent.img.srcWidth;
|
|
4269
|
+
height = parent.img.srcHeight;
|
|
4270
|
+
}
|
|
4271
|
+
else {
|
|
4272
|
+
width = parent.baseImg.width;
|
|
4273
|
+
height = parent.baseImg.height;
|
|
4274
|
+
}
|
|
4253
4275
|
const obj = { width: 0, height: 0 };
|
|
4254
|
-
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
4276
|
+
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
4277
|
+
value: { obj: obj, dimension: { width: width, height: height } } });
|
|
4255
4278
|
const ratio = obj;
|
|
4256
4279
|
const tempContextFilter = this.lowerContext.filter;
|
|
4257
4280
|
// Manipulating blur value
|
|
@@ -4262,36 +4285,24 @@ class Export {
|
|
|
4262
4285
|
splitWords[5] = 'blur(' + value + 'px)';
|
|
4263
4286
|
this.lowerContext.filter = splitWords.join(' ');
|
|
4264
4287
|
}
|
|
4265
|
-
let maxDimension;
|
|
4266
4288
|
const tempCanvas = parent.createElement('canvas', {
|
|
4267
4289
|
id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
|
|
4268
4290
|
});
|
|
4269
4291
|
const tempContext = tempCanvas.getContext('2d');
|
|
4270
4292
|
tempContext.filter = this.lowerContext.filter;
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
4285
|
-
value: { width: parent.baseImg.width, height: parent.baseImg.height, obj: obj } });
|
|
4286
|
-
maxDimension = obj;
|
|
4287
|
-
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
4288
|
-
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
4289
|
-
tempContext.filter = this.lowerContext.filter;
|
|
4290
|
-
const temp = this.lowerContext.filter;
|
|
4291
|
-
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
4292
|
-
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.baseImg.width, parent.baseImg.height);
|
|
4293
|
-
this.lowerContext.filter = temp;
|
|
4294
|
-
}
|
|
4293
|
+
tempCanvas.width = width;
|
|
4294
|
+
tempCanvas.height = height;
|
|
4295
|
+
const dimObj = { width: 0, height: 0 };
|
|
4296
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
4297
|
+
value: { width: width, height: height, obj: dimObj } });
|
|
4298
|
+
const maxDimension = dimObj;
|
|
4299
|
+
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
4300
|
+
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
4301
|
+
tempContext.filter = this.lowerContext.filter;
|
|
4302
|
+
const temp = this.lowerContext.filter;
|
|
4303
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
4304
|
+
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
|
|
4305
|
+
this.lowerContext.filter = temp;
|
|
4295
4306
|
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
4296
4307
|
this.updateSaveContext(tempContext);
|
|
4297
4308
|
this.exportTransformedImage(tempContext);
|
|
@@ -4310,17 +4321,15 @@ class Export {
|
|
|
4310
4321
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
4311
4322
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
4312
4323
|
// Manipulating points
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4323
|
-
}
|
|
4324
|
+
activePoint.startX *= ratio.width;
|
|
4325
|
+
activePoint.startY *= ratio.height;
|
|
4326
|
+
activePoint.endX *= ratio.width;
|
|
4327
|
+
activePoint.endY *= ratio.height;
|
|
4328
|
+
activePoint.width = activePoint.endX - activePoint.startX;
|
|
4329
|
+
activePoint.height = activePoint.endY - activePoint.startY;
|
|
4330
|
+
parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4331
|
+
if (parent.objColl[i].shape === 'text') {
|
|
4332
|
+
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4324
4333
|
}
|
|
4325
4334
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
|
|
4326
4335
|
points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
|
|
@@ -4336,18 +4345,10 @@ class Export {
|
|
|
4336
4345
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
4337
4346
|
parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
|
|
4338
4347
|
const len = parent.points.length;
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
}
|
|
4344
|
-
}
|
|
4345
|
-
else {
|
|
4346
|
-
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4347
|
-
for (let l = 0; l < len; l++) {
|
|
4348
|
-
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
4349
|
-
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
4350
|
-
}
|
|
4348
|
+
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4349
|
+
for (let l = 0; l < len; l++) {
|
|
4350
|
+
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
4351
|
+
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
4351
4352
|
}
|
|
4352
4353
|
}
|
|
4353
4354
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
@@ -4359,6 +4360,7 @@ class Export {
|
|
|
4359
4360
|
value: { context: tempContext, isSave: true, isFlip: null } });
|
|
4360
4361
|
}
|
|
4361
4362
|
this.lowerContext.filter = tempContextFilter;
|
|
4363
|
+
parent.canvasFilter = tempContextFilter;
|
|
4362
4364
|
if (object) {
|
|
4363
4365
|
object['canvas'] = tempCanvas;
|
|
4364
4366
|
}
|
|
@@ -4393,17 +4395,10 @@ class Export {
|
|
|
4393
4395
|
}
|
|
4394
4396
|
exportRotate(tempContext, degree) {
|
|
4395
4397
|
const parent = this.parent;
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
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);
|
|
4401
|
-
}
|
|
4402
|
-
else {
|
|
4403
|
-
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
4404
|
-
tempContext.rotate(Math.PI / 180 * degree);
|
|
4405
|
-
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
4406
|
-
}
|
|
4398
|
+
this.setMaxDim(parent.transform.degree, tempContext.canvas);
|
|
4399
|
+
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
4400
|
+
tempContext.rotate(Math.PI / 180 * degree);
|
|
4401
|
+
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
4407
4402
|
this.updateSaveContext(tempContext);
|
|
4408
4403
|
}
|
|
4409
4404
|
exportFlip(tempContext, flipHorizontal, flipVertical) {
|
|
@@ -4430,12 +4425,12 @@ class Export {
|
|
|
4430
4425
|
let newWidth;
|
|
4431
4426
|
let newHeight;
|
|
4432
4427
|
if (degree % 90 === 0 && degree % 180 !== 0) {
|
|
4433
|
-
newWidth = this.parent.baseImg.height;
|
|
4434
|
-
newHeight = this.parent.baseImg.width;
|
|
4428
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
4429
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
4435
4430
|
}
|
|
4436
4431
|
else if (degree % 180 === 0 || degree === 0) {
|
|
4437
|
-
newWidth = this.parent.baseImg.width;
|
|
4438
|
-
newHeight = this.parent.baseImg.height;
|
|
4432
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
4433
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
4439
4434
|
}
|
|
4440
4435
|
tempCanvas.width = newWidth;
|
|
4441
4436
|
tempCanvas.height = newHeight;
|
|
@@ -5773,7 +5768,28 @@ class FreehandDrawing {
|
|
|
5773
5768
|
const obj = { bool: false };
|
|
5774
5769
|
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
5775
5770
|
if (obj['bool']) {
|
|
5776
|
-
|
|
5771
|
+
const shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
|
|
5772
|
+
startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
|
|
5773
|
+
strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
|
|
5774
|
+
points: parent.pointColl[this.fhdSelIdx].points };
|
|
5775
|
+
const shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
|
|
5776
|
+
currentShapeSettings: shapeSettings };
|
|
5777
|
+
if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
5778
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5779
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then((shapeChangingArgs) => {
|
|
5780
|
+
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5781
|
+
parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5782
|
+
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5783
|
+
this.freehandRedraw(this.upperContext);
|
|
5784
|
+
parent.updateToolbar(parent.element, 'colorToolbar');
|
|
5785
|
+
});
|
|
5786
|
+
}
|
|
5787
|
+
else {
|
|
5788
|
+
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
5789
|
+
parent.activeObj.strokeSettings.strokeColor = parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5790
|
+
parent.activeObj.strokeSettings.strokeWidth = parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5791
|
+
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5792
|
+
this.freehandRedraw(this.upperContext);
|
|
5777
5793
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
5778
5794
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
5779
5795
|
}
|
|
@@ -6396,6 +6412,9 @@ class Selection {
|
|
|
6396
6412
|
case 'unWireEvent':
|
|
6397
6413
|
this.unwireEvent();
|
|
6398
6414
|
break;
|
|
6415
|
+
case 'updPtCollForShpRot':
|
|
6416
|
+
this.updPtCollForShpRot(args.value['obj']);
|
|
6417
|
+
break;
|
|
6399
6418
|
}
|
|
6400
6419
|
}
|
|
6401
6420
|
getModuleName() {
|
|
@@ -9253,6 +9272,9 @@ class Selection {
|
|
|
9253
9272
|
if (!this.isFhdEditing) {
|
|
9254
9273
|
this.applyCurrActObj(x, y);
|
|
9255
9274
|
parent.currObjType.isResize = false;
|
|
9275
|
+
if (!isBlazor()) {
|
|
9276
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
9277
|
+
}
|
|
9256
9278
|
}
|
|
9257
9279
|
}
|
|
9258
9280
|
if (parent.activeObj) {
|
|
@@ -10574,8 +10596,10 @@ class Selection {
|
|
|
10574
10596
|
fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
|
|
10575
10597
|
radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
|
|
10576
10598
|
length: parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ? parent.activeObj.activePoint.width : null,
|
|
10577
|
-
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
10599
|
+
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
10600
|
+
(parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
|
|
10578
10601
|
fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
|
|
10602
|
+
fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
|
|
10579
10603
|
fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
|
|
10580
10604
|
color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
|
|
10581
10605
|
};
|
|
@@ -10619,12 +10643,14 @@ class Selection {
|
|
|
10619
10643
|
if (degree < 0) {
|
|
10620
10644
|
degree = 360 + degree;
|
|
10621
10645
|
}
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10646
|
+
if (obj.flipObjColl) {
|
|
10647
|
+
for (let i = 0; i < obj.flipObjColl.length; i++) {
|
|
10648
|
+
if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
10649
|
+
isHorizontalflip = true;
|
|
10650
|
+
}
|
|
10651
|
+
else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
10652
|
+
isVerticalflip = true;
|
|
10653
|
+
}
|
|
10628
10654
|
}
|
|
10629
10655
|
}
|
|
10630
10656
|
if (degree === 0 || degree === 360) {
|
|
@@ -10712,7 +10738,7 @@ class Shape {
|
|
|
10712
10738
|
this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
|
|
10713
10739
|
break;
|
|
10714
10740
|
case 'drawRectangle':
|
|
10715
|
-
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['
|
|
10741
|
+
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
|
|
10716
10742
|
break;
|
|
10717
10743
|
case 'drawText':
|
|
10718
10744
|
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']);
|
|
@@ -10903,10 +10929,10 @@ class Shape {
|
|
|
10903
10929
|
{ text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
10904
10930
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
10905
10931
|
}
|
|
10906
|
-
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
10932
|
+
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
|
|
10907
10933
|
this.initializeShape('ellipse');
|
|
10908
10934
|
const start = x && y ? { x: x, y: y } : null;
|
|
10909
|
-
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
10935
|
+
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
|
|
10910
10936
|
}
|
|
10911
10937
|
drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
10912
10938
|
this.initializeShape('line');
|
|
@@ -10937,10 +10963,10 @@ class Shape {
|
|
|
10937
10963
|
const height = endY - startY;
|
|
10938
10964
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
10939
10965
|
}
|
|
10940
|
-
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
10966
|
+
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
|
|
10941
10967
|
this.initializeShape('rectangle');
|
|
10942
10968
|
const start = x && y ? { x: x, y: y } : null;
|
|
10943
|
-
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
10969
|
+
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
|
|
10944
10970
|
}
|
|
10945
10971
|
drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
10946
10972
|
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
|
|
@@ -10979,7 +11005,7 @@ class Shape {
|
|
|
10979
11005
|
}
|
|
10980
11006
|
return arrowType;
|
|
10981
11007
|
}
|
|
10982
|
-
drawShape(type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
|
|
11008
|
+
drawShape(type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
|
|
10983
11009
|
const parent = this.parent;
|
|
10984
11010
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
10985
11011
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
@@ -11047,10 +11073,7 @@ class Shape {
|
|
|
11047
11073
|
parent.activeObj.triangleDirection = 'right';
|
|
11048
11074
|
}
|
|
11049
11075
|
parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
|
|
11050
|
-
|
|
11051
|
-
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
11052
|
-
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
11053
|
-
parent.activeObj.flipObjColl = [];
|
|
11076
|
+
this.initShapeProps();
|
|
11054
11077
|
const obj = { shapeSettingsObj: {} };
|
|
11055
11078
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
11056
11079
|
const shapeSettings = obj['shapeSettingsObj'];
|
|
@@ -11062,6 +11085,10 @@ class Shape {
|
|
|
11062
11085
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
11063
11086
|
this.setDimension(width, height);
|
|
11064
11087
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
11088
|
+
if (degree) {
|
|
11089
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
11090
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
11091
|
+
}
|
|
11065
11092
|
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
|
|
11066
11093
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
11067
11094
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
@@ -11076,6 +11103,10 @@ class Shape {
|
|
|
11076
11103
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
11077
11104
|
this.setDimension(width, height);
|
|
11078
11105
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
11106
|
+
if (degree) {
|
|
11107
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
11108
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
11109
|
+
}
|
|
11079
11110
|
if (!isBlazor()) {
|
|
11080
11111
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
11081
11112
|
}
|
|
@@ -11096,6 +11127,13 @@ class Shape {
|
|
|
11096
11127
|
}
|
|
11097
11128
|
}
|
|
11098
11129
|
}
|
|
11130
|
+
initShapeProps() {
|
|
11131
|
+
const parent = this.parent;
|
|
11132
|
+
parent.activeObj.shapeDegree = parent.transform.degree;
|
|
11133
|
+
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
11134
|
+
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
11135
|
+
parent.activeObj.flipObjColl = [];
|
|
11136
|
+
}
|
|
11099
11137
|
setPointCollForLineAndArrow() {
|
|
11100
11138
|
const parent = this.parent;
|
|
11101
11139
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
@@ -11110,6 +11148,19 @@ class Shape {
|
|
|
11110
11148
|
}
|
|
11111
11149
|
}
|
|
11112
11150
|
}
|
|
11151
|
+
prevObjColl() {
|
|
11152
|
+
const parent = this.parent;
|
|
11153
|
+
const object = { currObj: {} };
|
|
11154
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11155
|
+
this.prevObj = object['currObj'];
|
|
11156
|
+
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11157
|
+
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11158
|
+
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
11159
|
+
const selPointCollObj = { selPointColl: null };
|
|
11160
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11161
|
+
value: { obj: selPointCollObj } });
|
|
11162
|
+
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11163
|
+
}
|
|
11113
11164
|
drawShapeText(text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
|
|
11114
11165
|
const parent = this.parent;
|
|
11115
11166
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
@@ -11121,16 +11172,7 @@ class Shape {
|
|
|
11121
11172
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
11122
11173
|
parent.togglePen = false;
|
|
11123
11174
|
this.redrawActObj();
|
|
11124
|
-
|
|
11125
|
-
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11126
|
-
this.prevObj = object['currObj'];
|
|
11127
|
-
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11128
|
-
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11129
|
-
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
11130
|
-
const selPointCollObj = { selPointColl: null };
|
|
11131
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11132
|
-
value: { obj: selPointCollObj } });
|
|
11133
|
-
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11175
|
+
this.prevObjColl();
|
|
11134
11176
|
this.refreshActiveObj();
|
|
11135
11177
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
11136
11178
|
parent.currObjType.isCustomCrop = false;
|
|
@@ -11221,6 +11263,9 @@ class Shape {
|
|
|
11221
11263
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
11222
11264
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
11223
11265
|
}
|
|
11266
|
+
else {
|
|
11267
|
+
parent.updateToolbar(parent.element, 'text');
|
|
11268
|
+
}
|
|
11224
11269
|
}
|
|
11225
11270
|
initializeTextShape(text, fontFamily, fontSize, bold, italic, strokeColor) {
|
|
11226
11271
|
const parent = this.parent;
|
|
@@ -11369,9 +11414,12 @@ class Shape {
|
|
|
11369
11414
|
parent.activeObj.activePoint.width = shapeSettings.length;
|
|
11370
11415
|
break;
|
|
11371
11416
|
case 'text':
|
|
11372
|
-
parent.activeObj.keyHistory = shapeSettings.text;
|
|
11417
|
+
parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
|
|
11373
11418
|
parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
|
|
11374
11419
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
|
|
11420
|
+
parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
|
|
11421
|
+
break;
|
|
11422
|
+
case 'rectangle':
|
|
11375
11423
|
break;
|
|
11376
11424
|
}
|
|
11377
11425
|
if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
|
|
@@ -12237,6 +12285,7 @@ class Shape {
|
|
|
12237
12285
|
if (actObj.flipObjColl.length === 4) {
|
|
12238
12286
|
actObj.flipObjColl = [];
|
|
12239
12287
|
flip = '';
|
|
12288
|
+
actObj.shapeFlip = '';
|
|
12240
12289
|
}
|
|
12241
12290
|
if (flip === '' && actObj.flipObjColl.length > 1) {
|
|
12242
12291
|
flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
|
|
@@ -12886,6 +12935,10 @@ class Shape {
|
|
|
12886
12935
|
shapeDetails.fontStyle.push('italic');
|
|
12887
12936
|
}
|
|
12888
12937
|
break;
|
|
12938
|
+
case 'path':
|
|
12939
|
+
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
12940
|
+
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
12941
|
+
break;
|
|
12889
12942
|
}
|
|
12890
12943
|
return shapeDetails;
|
|
12891
12944
|
}
|
|
@@ -13156,7 +13209,12 @@ class Shape {
|
|
|
13156
13209
|
this.lowerContext.filter = object['canvasFilter'];
|
|
13157
13210
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
13158
13211
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
13159
|
-
|
|
13212
|
+
if (!isBlazor()) {
|
|
13213
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
13214
|
+
}
|
|
13215
|
+
else {
|
|
13216
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
13217
|
+
}
|
|
13160
13218
|
}
|
|
13161
13219
|
}
|
|
13162
13220
|
getMaxText(isTextBox, text, obj) {
|
|
@@ -13555,6 +13613,12 @@ class Transform {
|
|
|
13555
13613
|
this.cropDimension.width = args.value['width'];
|
|
13556
13614
|
this.cropDimension.height = args.value['height'];
|
|
13557
13615
|
break;
|
|
13616
|
+
case 'getPreventSelect':
|
|
13617
|
+
args.value['obj']['bool'] = this.isPreventSelect;
|
|
13618
|
+
break;
|
|
13619
|
+
case 'setPreventSelect':
|
|
13620
|
+
this.isPreventSelect = args.value['bool'];
|
|
13621
|
+
break;
|
|
13558
13622
|
case 'reset':
|
|
13559
13623
|
this.reset();
|
|
13560
13624
|
break;
|
|
@@ -14675,6 +14739,9 @@ class Transform {
|
|
|
14675
14739
|
parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
|
|
14676
14740
|
value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
|
|
14677
14741
|
parent.objColl[i].flipObjColl = flipObjColl['collection'];
|
|
14742
|
+
if (parent.objColl[i].flipObjColl.length === 0) {
|
|
14743
|
+
parent.objColl[i].shapeFlip = '';
|
|
14744
|
+
}
|
|
14678
14745
|
}
|
|
14679
14746
|
}
|
|
14680
14747
|
if (tempZoomFactor !== 0) {
|
|
@@ -15040,6 +15107,7 @@ class Transform {
|
|
|
15040
15107
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15041
15108
|
this.lowerContext.filter = tempFilter;
|
|
15042
15109
|
parent.initialAdjustmentValue = tempFilter;
|
|
15110
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
15043
15111
|
if (parent.isImageLoaded) {
|
|
15044
15112
|
showSpinner(parent.element);
|
|
15045
15113
|
parent.element.style.opacity = '0.5';
|
|
@@ -16464,7 +16532,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16464
16532
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
16465
16533
|
this.lowerContext.filter = this.getDefaultFilter();
|
|
16466
16534
|
this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
16467
|
-
this.
|
|
16535
|
+
this.canvasFilter = this.lowerContext.filter;
|
|
16468
16536
|
this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
|
|
16469
16537
|
if (this.cssClass) {
|
|
16470
16538
|
addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
|
|
@@ -17466,8 +17534,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17466
17534
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
17467
17535
|
const data = this.getImageData();
|
|
17468
17536
|
if (!isBlazor()) {
|
|
17469
|
-
|
|
17470
|
-
|
|
17537
|
+
if (!Browser.isDevice) {
|
|
17538
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
17539
|
+
isApplyBtn: true, isCropping: false } });
|
|
17540
|
+
}
|
|
17471
17541
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
17472
17542
|
}
|
|
17473
17543
|
this.objColl = objColl;
|
|
@@ -18081,8 +18151,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18081
18151
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18082
18152
|
this.element = element;
|
|
18083
18153
|
const canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
18084
|
-
if (this.element.querySelector('#' + this.element.id + '
|
|
18085
|
-
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '
|
|
18154
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
|
|
18155
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
18086
18156
|
}
|
|
18087
18157
|
else {
|
|
18088
18158
|
this.toolbarHeight = 0;
|
|
@@ -18680,9 +18750,6 @@ class ToolbarModule {
|
|
|
18680
18750
|
case 'getCanvasFilter':
|
|
18681
18751
|
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
18682
18752
|
break;
|
|
18683
|
-
case 'setCanvasFilter':
|
|
18684
|
-
parent.canvasFilter = args.value['filter'];
|
|
18685
|
-
break;
|
|
18686
18753
|
case 'getDefToolbarItems':
|
|
18687
18754
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
18688
18755
|
break;
|
|
@@ -20080,7 +20147,8 @@ class ToolbarModule {
|
|
|
20080
20147
|
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
20081
20148
|
return;
|
|
20082
20149
|
}
|
|
20083
|
-
const
|
|
20150
|
+
const item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
|
|
20151
|
+
const args = { toolbarType: item };
|
|
20084
20152
|
if (type !== 'filter' && type !== 'color') {
|
|
20085
20153
|
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
20086
20154
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
@@ -21291,7 +21359,8 @@ class ToolbarModule {
|
|
|
21291
21359
|
const parent = this.parent;
|
|
21292
21360
|
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
21293
21361
|
parent.currObjType.isFiltered) {
|
|
21294
|
-
parent.initialAdjustmentValue =
|
|
21362
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
21363
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
21295
21364
|
parent.currObjType.isFiltered = false;
|
|
21296
21365
|
}
|
|
21297
21366
|
}
|