@syncfusion/ej2-image-editor 22.1.37 → 22.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +337 -273
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +339 -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 +89 -97
- package/src/image-editor/action/draw.js +88 -71
- package/src/image-editor/action/export.js +49 -66
- package/src/image-editor/action/freehand-draw.js +25 -1
- package/src/image-editor/action/selection.js +17 -7
- package/src/image-editor/action/shape.d.ts +2 -0
- package/src/image-editor/action/shape.js +51 -22
- package/src/image-editor/action/transform.js +10 -0
- package/src/image-editor/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,25 @@ class Crop {
|
|
|
560
534
|
parent.currSelectionPoint = null;
|
|
561
535
|
}
|
|
562
536
|
}
|
|
537
|
+
panToSelRangle(isReverse) {
|
|
538
|
+
const parent = this.parent;
|
|
539
|
+
const panX = parent.transform.degree === 0 ?
|
|
540
|
+
isReverse ? -parent.cropObj.totalPannedPoint.x : parent.cropObj.totalPannedPoint.x :
|
|
541
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.x : parent.cropObj.totalPannedClientPoint.x;
|
|
542
|
+
const panY = parent.transform.degree === 0 ?
|
|
543
|
+
isReverse ? -parent.cropObj.totalPannedPoint.y : parent.cropObj.totalPannedPoint.y :
|
|
544
|
+
isReverse ? -parent.cropObj.totalPannedClientPoint.y : parent.cropObj.totalPannedClientPoint.y;
|
|
545
|
+
if (parent.transform.degree === 0) {
|
|
546
|
+
parent.img.destLeft += panX;
|
|
547
|
+
parent.img.destTop += panY;
|
|
548
|
+
parent.notify('transform', { prop: 'drawPannImage', value: { point: { x: panX, y: panY } } });
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
parent.panPoint.currentPannedPoint = { x: panX, y: panY };
|
|
552
|
+
parent.notify('transform', { prop: 'drawPannedImage', value: { xDiff: panX, yDiff: panY } });
|
|
553
|
+
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
554
|
+
}
|
|
555
|
+
}
|
|
563
556
|
cropCircle(context, isSave, isFlip) {
|
|
564
557
|
const parent = this.parent;
|
|
565
558
|
if (isFlip && parent.transform.currFlipState !== '') {
|
|
@@ -568,9 +561,9 @@ class Crop {
|
|
|
568
561
|
}
|
|
569
562
|
context.globalCompositeOperation = 'destination-in';
|
|
570
563
|
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;
|
|
564
|
+
const centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
|
|
565
|
+
const centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
|
|
566
|
+
const radius = isSave ? context.canvas.width / 2 : parent.img.destWidth / 2;
|
|
574
567
|
context.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
575
568
|
context.closePath();
|
|
576
569
|
context.fill();
|
|
@@ -748,7 +741,6 @@ class Crop {
|
|
|
748
741
|
}
|
|
749
742
|
this.cropImg();
|
|
750
743
|
parent.transform.zoomFactor = 0;
|
|
751
|
-
parent.zoomSettings.zoomFactor = 1;
|
|
752
744
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
753
745
|
parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
|
|
754
746
|
value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
|
|
@@ -774,17 +766,17 @@ class Crop {
|
|
|
774
766
|
}
|
|
775
767
|
}
|
|
776
768
|
}
|
|
777
|
-
calcRatio(obj) {
|
|
769
|
+
calcRatio(obj, dimension) {
|
|
778
770
|
const parent = this.parent;
|
|
779
771
|
let widthRatio;
|
|
780
772
|
let heightRatio;
|
|
781
773
|
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;
|
|
774
|
+
widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
|
|
775
|
+
heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
|
|
784
776
|
}
|
|
785
777
|
else {
|
|
786
|
-
widthRatio = parent.baseImg.height / parent.img.destWidth;
|
|
787
|
-
heightRatio = parent.baseImg.width / parent.img.destHeight;
|
|
778
|
+
widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
|
|
779
|
+
heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
|
|
788
780
|
}
|
|
789
781
|
if (obj) {
|
|
790
782
|
obj['width'] = widthRatio;
|
|
@@ -1116,6 +1108,10 @@ class Draw {
|
|
|
1116
1108
|
parent.activeObj = extend({}, obj, {}, true);
|
|
1117
1109
|
}
|
|
1118
1110
|
this.updateActiveObject();
|
|
1111
|
+
if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
|
|
1112
|
+
isNullOrUndefined(parent.activeObj.activePoint.startY)) {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1119
1115
|
if (parent.currObjType.isText) {
|
|
1120
1116
|
const obj = { keyHistory: '' };
|
|
1121
1117
|
parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj } });
|
|
@@ -1786,12 +1782,14 @@ class Draw {
|
|
|
1786
1782
|
if (degree < 0) {
|
|
1787
1783
|
degree = 360 + degree;
|
|
1788
1784
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1785
|
+
if (parent.activeObj.flipObjColl) {
|
|
1786
|
+
for (let i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
|
|
1787
|
+
if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
1788
|
+
isHorizontalflip = true;
|
|
1789
|
+
}
|
|
1790
|
+
else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
1791
|
+
isVerticalflip = true;
|
|
1792
|
+
}
|
|
1795
1793
|
}
|
|
1796
1794
|
}
|
|
1797
1795
|
switch (degree) {
|
|
@@ -2332,7 +2330,7 @@ class Draw {
|
|
|
2332
2330
|
}
|
|
2333
2331
|
shapeText(canvasDraw) {
|
|
2334
2332
|
const parent = this.parent;
|
|
2335
|
-
|
|
2333
|
+
let actPoint = parent.activeObj.activePoint;
|
|
2336
2334
|
const rows = parent.activeObj.keyHistory.split('\n');
|
|
2337
2335
|
const height = parent.activeObj.textSettings.fontSize + parent.activeObj.textSettings.fontSize * 0.25;
|
|
2338
2336
|
const lineHeight = ((height * rows.length) - (parent.activeObj.textSettings.fontSize * rows.length)) / rows.length;
|
|
@@ -2370,17 +2368,18 @@ class Draw {
|
|
|
2370
2368
|
parent.activeObj.textSettings.fontFamily;
|
|
2371
2369
|
if (parent.activeObj.flipObjColl.length === 4) {
|
|
2372
2370
|
parent.activeObj.flipObjColl = [];
|
|
2371
|
+
parent.activeObj.shapeFlip = '';
|
|
2373
2372
|
}
|
|
2374
2373
|
for (let j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
|
|
2375
2374
|
if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
|
|
2376
2375
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
2377
2376
|
canvasDraw.scale(-1, 1);
|
|
2378
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
2377
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
2379
2378
|
}
|
|
2380
2379
|
else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
|
|
2381
2380
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
2382
2381
|
canvasDraw.scale(1, -1);
|
|
2383
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
2382
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
2384
2383
|
}
|
|
2385
2384
|
}
|
|
2386
2385
|
if (parent.activeObj.shapeDegree !== parent.transform.degree) {
|
|
@@ -2393,12 +2392,12 @@ class Draw {
|
|
|
2393
2392
|
if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
|
|
2394
2393
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
2395
2394
|
canvasDraw.scale(-1, 1);
|
|
2396
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
2395
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
2397
2396
|
}
|
|
2398
2397
|
else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
|
|
2399
2398
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
2400
2399
|
canvasDraw.scale(1, -1);
|
|
2401
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
2400
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
2402
2401
|
}
|
|
2403
2402
|
}
|
|
2404
2403
|
}
|
|
@@ -2434,6 +2433,7 @@ class Draw {
|
|
|
2434
2433
|
this.updateActiveObject(actPoint, parent.activeObj);
|
|
2435
2434
|
}
|
|
2436
2435
|
}
|
|
2436
|
+
return actPoint;
|
|
2437
2437
|
}
|
|
2438
2438
|
rotateText(canvasDraw) {
|
|
2439
2439
|
const parent = this.parent;
|
|
@@ -2447,6 +2447,9 @@ class Draw {
|
|
|
2447
2447
|
else {
|
|
2448
2448
|
degree = parent.transform.degree - parent.activeObj.shapeDegree;
|
|
2449
2449
|
}
|
|
2450
|
+
if (degree === -450) {
|
|
2451
|
+
degree = -90;
|
|
2452
|
+
}
|
|
2450
2453
|
if (degree < 0) {
|
|
2451
2454
|
degree = 360 + degree;
|
|
2452
2455
|
}
|
|
@@ -3770,11 +3773,8 @@ class Draw {
|
|
|
3770
3773
|
}
|
|
3771
3774
|
}
|
|
3772
3775
|
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;
|
|
3776
|
+
if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
3777
|
+
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3778
3778
|
}
|
|
3779
3779
|
}
|
|
3780
3780
|
parent.reset();
|
|
@@ -3817,8 +3817,8 @@ class Draw {
|
|
|
3817
3817
|
parent.clearContext(this.lowerContext);
|
|
3818
3818
|
parent.clearContext(this.upperContext);
|
|
3819
3819
|
parent.clearContext(inMemoryContext);
|
|
3820
|
-
parent.inMemoryCanvas.width =
|
|
3821
|
-
parent.inMemoryCanvas.height =
|
|
3820
|
+
parent.inMemoryCanvas.width = this.openURL.width;
|
|
3821
|
+
parent.inMemoryCanvas.height = this.openURL.height;
|
|
3822
3822
|
inMemoryContext.putImageData(this.openURL, 0, 0);
|
|
3823
3823
|
parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
|
|
3824
3824
|
}
|
|
@@ -3974,75 +3974,84 @@ class Draw {
|
|
|
3974
3974
|
moveToSelectionRange(type, activeObj) {
|
|
3975
3975
|
const parent = this.parent;
|
|
3976
3976
|
if (parent.activeObj.shape) {
|
|
3977
|
-
|
|
3977
|
+
let isRotated = false;
|
|
3978
|
+
for (let i = 0; i < parent.rotateFlipColl.length; i++) {
|
|
3979
|
+
if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
|
|
3980
|
+
isRotated = true;
|
|
3981
|
+
break;
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
if (isRotated) {
|
|
3978
3985
|
let zoomFactor = parent.transform.zoomFactor;
|
|
3979
3986
|
parent.objColl.push(parent.activeObj);
|
|
3980
3987
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3981
|
-
if (
|
|
3982
|
-
if (parent.
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3988
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3989
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3990
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3991
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3992
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3993
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3994
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3995
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
3996
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3997
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
3998
|
+
}
|
|
3999
|
+
break;
|
|
3990
4000
|
}
|
|
3991
|
-
|
|
4001
|
+
zoomFactor += 0.1;
|
|
4002
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4003
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3992
4004
|
}
|
|
3993
|
-
zoomFactor += 0.1;
|
|
3994
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3995
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3996
4005
|
}
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
+
else {
|
|
4007
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4008
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
4009
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4010
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4011
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4012
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4013
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4014
|
+
}
|
|
4015
|
+
break;
|
|
4006
4016
|
}
|
|
4007
|
-
|
|
4017
|
+
zoomFactor -= .1;
|
|
4018
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4019
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4008
4020
|
}
|
|
4009
|
-
zoomFactor -= .1;
|
|
4010
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4011
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4012
4021
|
}
|
|
4013
4022
|
}
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4023
|
+
else {
|
|
4024
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
4025
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4026
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4027
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4028
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4029
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4030
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4031
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4032
|
+
}
|
|
4033
|
+
break;
|
|
4024
4034
|
}
|
|
4025
|
-
|
|
4035
|
+
zoomFactor += 0.1;
|
|
4036
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4037
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4026
4038
|
}
|
|
4027
|
-
zoomFactor += 0.1;
|
|
4028
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4029
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4030
4039
|
}
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
+
else {
|
|
4041
|
+
for (let i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4042
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4043
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4044
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4045
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4046
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4047
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4048
|
+
}
|
|
4049
|
+
break;
|
|
4040
4050
|
}
|
|
4041
|
-
|
|
4051
|
+
zoomFactor -= .1;
|
|
4052
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4053
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4042
4054
|
}
|
|
4043
|
-
zoomFactor -= .1;
|
|
4044
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4045
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4046
4055
|
}
|
|
4047
4056
|
}
|
|
4048
4057
|
}
|
|
@@ -4250,8 +4259,19 @@ class Export {
|
|
|
4250
4259
|
}
|
|
4251
4260
|
exportToCanvas(object) {
|
|
4252
4261
|
const parent = this.parent;
|
|
4262
|
+
let width;
|
|
4263
|
+
let height;
|
|
4264
|
+
if (parent.currSelectionPoint) {
|
|
4265
|
+
width = parent.img.srcWidth;
|
|
4266
|
+
height = parent.img.srcHeight;
|
|
4267
|
+
}
|
|
4268
|
+
else {
|
|
4269
|
+
width = parent.baseImg.width;
|
|
4270
|
+
height = parent.baseImg.height;
|
|
4271
|
+
}
|
|
4253
4272
|
const obj = { width: 0, height: 0 };
|
|
4254
|
-
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
4273
|
+
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
4274
|
+
value: { obj: obj, dimension: { width: width, height: height } } });
|
|
4255
4275
|
const ratio = obj;
|
|
4256
4276
|
const tempContextFilter = this.lowerContext.filter;
|
|
4257
4277
|
// Manipulating blur value
|
|
@@ -4262,36 +4282,24 @@ class Export {
|
|
|
4262
4282
|
splitWords[5] = 'blur(' + value + 'px)';
|
|
4263
4283
|
this.lowerContext.filter = splitWords.join(' ');
|
|
4264
4284
|
}
|
|
4265
|
-
let maxDimension;
|
|
4266
4285
|
const tempCanvas = parent.createElement('canvas', {
|
|
4267
4286
|
id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
|
|
4268
4287
|
});
|
|
4269
4288
|
const tempContext = tempCanvas.getContext('2d');
|
|
4270
4289
|
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
|
-
}
|
|
4290
|
+
tempCanvas.width = width;
|
|
4291
|
+
tempCanvas.height = height;
|
|
4292
|
+
const dimObj = { width: 0, height: 0 };
|
|
4293
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
4294
|
+
value: { width: width, height: height, obj: dimObj } });
|
|
4295
|
+
const maxDimension = dimObj;
|
|
4296
|
+
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
4297
|
+
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
4298
|
+
tempContext.filter = this.lowerContext.filter;
|
|
4299
|
+
const temp = this.lowerContext.filter;
|
|
4300
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
4301
|
+
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
|
|
4302
|
+
this.lowerContext.filter = temp;
|
|
4295
4303
|
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
4296
4304
|
this.updateSaveContext(tempContext);
|
|
4297
4305
|
this.exportTransformedImage(tempContext);
|
|
@@ -4310,17 +4318,15 @@ class Export {
|
|
|
4310
4318
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
4311
4319
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
4312
4320
|
// Manipulating points
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4323
|
-
}
|
|
4321
|
+
activePoint.startX *= ratio.width;
|
|
4322
|
+
activePoint.startY *= ratio.height;
|
|
4323
|
+
activePoint.endX *= ratio.width;
|
|
4324
|
+
activePoint.endY *= ratio.height;
|
|
4325
|
+
activePoint.width = activePoint.endX - activePoint.startX;
|
|
4326
|
+
activePoint.height = activePoint.endY - activePoint.startY;
|
|
4327
|
+
parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4328
|
+
if (parent.objColl[i].shape === 'text') {
|
|
4329
|
+
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4324
4330
|
}
|
|
4325
4331
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
|
|
4326
4332
|
points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
|
|
@@ -4336,18 +4342,10 @@ class Export {
|
|
|
4336
4342
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
4337
4343
|
parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
|
|
4338
4344
|
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
|
-
}
|
|
4345
|
+
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4346
|
+
for (let l = 0; l < len; l++) {
|
|
4347
|
+
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
4348
|
+
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
4351
4349
|
}
|
|
4352
4350
|
}
|
|
4353
4351
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
@@ -4359,6 +4357,7 @@ class Export {
|
|
|
4359
4357
|
value: { context: tempContext, isSave: true, isFlip: null } });
|
|
4360
4358
|
}
|
|
4361
4359
|
this.lowerContext.filter = tempContextFilter;
|
|
4360
|
+
parent.canvasFilter = tempContextFilter;
|
|
4362
4361
|
if (object) {
|
|
4363
4362
|
object['canvas'] = tempCanvas;
|
|
4364
4363
|
}
|
|
@@ -4393,17 +4392,10 @@ class Export {
|
|
|
4393
4392
|
}
|
|
4394
4393
|
exportRotate(tempContext, degree) {
|
|
4395
4394
|
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
|
-
}
|
|
4395
|
+
this.setMaxDim(parent.transform.degree, tempContext.canvas);
|
|
4396
|
+
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
4397
|
+
tempContext.rotate(Math.PI / 180 * degree);
|
|
4398
|
+
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
4407
4399
|
this.updateSaveContext(tempContext);
|
|
4408
4400
|
}
|
|
4409
4401
|
exportFlip(tempContext, flipHorizontal, flipVertical) {
|
|
@@ -4430,12 +4422,12 @@ class Export {
|
|
|
4430
4422
|
let newWidth;
|
|
4431
4423
|
let newHeight;
|
|
4432
4424
|
if (degree % 90 === 0 && degree % 180 !== 0) {
|
|
4433
|
-
newWidth = this.parent.baseImg.height;
|
|
4434
|
-
newHeight = this.parent.baseImg.width;
|
|
4425
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
4426
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
4435
4427
|
}
|
|
4436
4428
|
else if (degree % 180 === 0 || degree === 0) {
|
|
4437
|
-
newWidth = this.parent.baseImg.width;
|
|
4438
|
-
newHeight = this.parent.baseImg.height;
|
|
4429
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
4430
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
4439
4431
|
}
|
|
4440
4432
|
tempCanvas.width = newWidth;
|
|
4441
4433
|
tempCanvas.height = newHeight;
|
|
@@ -5773,7 +5765,29 @@ class FreehandDrawing {
|
|
|
5773
5765
|
const obj = { bool: false };
|
|
5774
5766
|
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
5775
5767
|
if (obj['bool']) {
|
|
5776
|
-
|
|
5768
|
+
const shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
|
|
5769
|
+
startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
|
|
5770
|
+
strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
|
|
5771
|
+
points: parent.pointColl[this.fhdSelIdx].points };
|
|
5772
|
+
const shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
|
|
5773
|
+
currentShapeSettings: shapeSettings };
|
|
5774
|
+
if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
5775
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5776
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then((shapeChangingArgs) => {
|
|
5777
|
+
parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5778
|
+
parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5779
|
+
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5780
|
+
this.freehandRedraw(this.upperContext);
|
|
5781
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
5782
|
+
parent.updateToolbar(parent.element, 'pen');
|
|
5783
|
+
});
|
|
5784
|
+
}
|
|
5785
|
+
else {
|
|
5786
|
+
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
5787
|
+
parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5788
|
+
parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5789
|
+
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5790
|
+
this.freehandRedraw(this.upperContext);
|
|
5777
5791
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
5778
5792
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
5779
5793
|
}
|
|
@@ -6396,6 +6410,9 @@ class Selection {
|
|
|
6396
6410
|
case 'unWireEvent':
|
|
6397
6411
|
this.unwireEvent();
|
|
6398
6412
|
break;
|
|
6413
|
+
case 'updPtCollForShpRot':
|
|
6414
|
+
this.updPtCollForShpRot(args.value['obj']);
|
|
6415
|
+
break;
|
|
6399
6416
|
}
|
|
6400
6417
|
}
|
|
6401
6418
|
getModuleName() {
|
|
@@ -9253,6 +9270,9 @@ class Selection {
|
|
|
9253
9270
|
if (!this.isFhdEditing) {
|
|
9254
9271
|
this.applyCurrActObj(x, y);
|
|
9255
9272
|
parent.currObjType.isResize = false;
|
|
9273
|
+
if (!isBlazor()) {
|
|
9274
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
9275
|
+
}
|
|
9256
9276
|
}
|
|
9257
9277
|
}
|
|
9258
9278
|
if (parent.activeObj) {
|
|
@@ -10574,8 +10594,10 @@ class Selection {
|
|
|
10574
10594
|
fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
|
|
10575
10595
|
radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
|
|
10576
10596
|
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 :
|
|
10597
|
+
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
10598
|
+
(parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
|
|
10578
10599
|
fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
|
|
10600
|
+
fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
|
|
10579
10601
|
fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
|
|
10580
10602
|
color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
|
|
10581
10603
|
};
|
|
@@ -10619,12 +10641,14 @@ class Selection {
|
|
|
10619
10641
|
if (degree < 0) {
|
|
10620
10642
|
degree = 360 + degree;
|
|
10621
10643
|
}
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10644
|
+
if (obj.flipObjColl) {
|
|
10645
|
+
for (let i = 0; i < obj.flipObjColl.length; i++) {
|
|
10646
|
+
if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
10647
|
+
isHorizontalflip = true;
|
|
10648
|
+
}
|
|
10649
|
+
else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
10650
|
+
isVerticalflip = true;
|
|
10651
|
+
}
|
|
10628
10652
|
}
|
|
10629
10653
|
}
|
|
10630
10654
|
if (degree === 0 || degree === 360) {
|
|
@@ -10712,7 +10736,7 @@ class Shape {
|
|
|
10712
10736
|
this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
|
|
10713
10737
|
break;
|
|
10714
10738
|
case 'drawRectangle':
|
|
10715
|
-
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['
|
|
10739
|
+
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
|
|
10716
10740
|
break;
|
|
10717
10741
|
case 'drawText':
|
|
10718
10742
|
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 +10927,10 @@ class Shape {
|
|
|
10903
10927
|
{ text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
10904
10928
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
10905
10929
|
}
|
|
10906
|
-
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
10930
|
+
drawEllipse(x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
|
|
10907
10931
|
this.initializeShape('ellipse');
|
|
10908
10932
|
const start = x && y ? { x: x, y: y } : null;
|
|
10909
|
-
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
10933
|
+
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
|
|
10910
10934
|
}
|
|
10911
10935
|
drawLine(startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
10912
10936
|
this.initializeShape('line');
|
|
@@ -10937,10 +10961,10 @@ class Shape {
|
|
|
10937
10961
|
const height = endY - startY;
|
|
10938
10962
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
10939
10963
|
}
|
|
10940
|
-
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
10964
|
+
drawRectangle(x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
|
|
10941
10965
|
this.initializeShape('rectangle');
|
|
10942
10966
|
const start = x && y ? { x: x, y: y } : null;
|
|
10943
|
-
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
10967
|
+
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
|
|
10944
10968
|
}
|
|
10945
10969
|
drawText(x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
10946
10970
|
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
|
|
@@ -10979,7 +11003,7 @@ class Shape {
|
|
|
10979
11003
|
}
|
|
10980
11004
|
return arrowType;
|
|
10981
11005
|
}
|
|
10982
|
-
drawShape(type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
|
|
11006
|
+
drawShape(type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
|
|
10983
11007
|
const parent = this.parent;
|
|
10984
11008
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
10985
11009
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
@@ -11047,10 +11071,7 @@ class Shape {
|
|
|
11047
11071
|
parent.activeObj.triangleDirection = 'right';
|
|
11048
11072
|
}
|
|
11049
11073
|
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 = [];
|
|
11074
|
+
this.initShapeProps();
|
|
11054
11075
|
const obj = { shapeSettingsObj: {} };
|
|
11055
11076
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
11056
11077
|
const shapeSettings = obj['shapeSettingsObj'];
|
|
@@ -11062,6 +11083,10 @@ class Shape {
|
|
|
11062
11083
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
11063
11084
|
this.setDimension(width, height);
|
|
11064
11085
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
11086
|
+
if (degree) {
|
|
11087
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
11088
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
11089
|
+
}
|
|
11065
11090
|
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
|
|
11066
11091
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
11067
11092
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
|
|
@@ -11076,6 +11101,10 @@ class Shape {
|
|
|
11076
11101
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
11077
11102
|
this.setDimension(width, height);
|
|
11078
11103
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
11104
|
+
if (degree) {
|
|
11105
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
11106
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
11107
|
+
}
|
|
11079
11108
|
if (!isBlazor()) {
|
|
11080
11109
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
11081
11110
|
}
|
|
@@ -11096,6 +11125,13 @@ class Shape {
|
|
|
11096
11125
|
}
|
|
11097
11126
|
}
|
|
11098
11127
|
}
|
|
11128
|
+
initShapeProps() {
|
|
11129
|
+
const parent = this.parent;
|
|
11130
|
+
parent.activeObj.shapeDegree = parent.transform.degree;
|
|
11131
|
+
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
11132
|
+
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
11133
|
+
parent.activeObj.flipObjColl = [];
|
|
11134
|
+
}
|
|
11099
11135
|
setPointCollForLineAndArrow() {
|
|
11100
11136
|
const parent = this.parent;
|
|
11101
11137
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
@@ -11110,6 +11146,19 @@ class Shape {
|
|
|
11110
11146
|
}
|
|
11111
11147
|
}
|
|
11112
11148
|
}
|
|
11149
|
+
prevObjColl() {
|
|
11150
|
+
const parent = this.parent;
|
|
11151
|
+
const object = { currObj: {} };
|
|
11152
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11153
|
+
this.prevObj = object['currObj'];
|
|
11154
|
+
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11155
|
+
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11156
|
+
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
11157
|
+
const selPointCollObj = { selPointColl: null };
|
|
11158
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11159
|
+
value: { obj: selPointCollObj } });
|
|
11160
|
+
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11161
|
+
}
|
|
11113
11162
|
drawShapeText(text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
|
|
11114
11163
|
const parent = this.parent;
|
|
11115
11164
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
@@ -11121,16 +11170,7 @@ class Shape {
|
|
|
11121
11170
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
11122
11171
|
parent.togglePen = false;
|
|
11123
11172
|
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);
|
|
11173
|
+
this.prevObjColl();
|
|
11134
11174
|
this.refreshActiveObj();
|
|
11135
11175
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
11136
11176
|
parent.currObjType.isCustomCrop = false;
|
|
@@ -11369,9 +11409,12 @@ class Shape {
|
|
|
11369
11409
|
parent.activeObj.activePoint.width = shapeSettings.length;
|
|
11370
11410
|
break;
|
|
11371
11411
|
case 'text':
|
|
11372
|
-
parent.activeObj.keyHistory = shapeSettings.text;
|
|
11412
|
+
parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
|
|
11373
11413
|
parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
|
|
11374
11414
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
|
|
11415
|
+
parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
|
|
11416
|
+
break;
|
|
11417
|
+
case 'rectangle':
|
|
11375
11418
|
break;
|
|
11376
11419
|
}
|
|
11377
11420
|
if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
|
|
@@ -12237,6 +12280,7 @@ class Shape {
|
|
|
12237
12280
|
if (actObj.flipObjColl.length === 4) {
|
|
12238
12281
|
actObj.flipObjColl = [];
|
|
12239
12282
|
flip = '';
|
|
12283
|
+
actObj.shapeFlip = '';
|
|
12240
12284
|
}
|
|
12241
12285
|
if (flip === '' && actObj.flipObjColl.length > 1) {
|
|
12242
12286
|
flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
|
|
@@ -12886,6 +12930,10 @@ class Shape {
|
|
|
12886
12930
|
shapeDetails.fontStyle.push('italic');
|
|
12887
12931
|
}
|
|
12888
12932
|
break;
|
|
12933
|
+
case 'path':
|
|
12934
|
+
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
12935
|
+
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
12936
|
+
break;
|
|
12889
12937
|
}
|
|
12890
12938
|
return shapeDetails;
|
|
12891
12939
|
}
|
|
@@ -13156,7 +13204,12 @@ class Shape {
|
|
|
13156
13204
|
this.lowerContext.filter = object['canvasFilter'];
|
|
13157
13205
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
13158
13206
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
13159
|
-
|
|
13207
|
+
if (!isBlazor()) {
|
|
13208
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
13209
|
+
}
|
|
13210
|
+
else {
|
|
13211
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
13212
|
+
}
|
|
13160
13213
|
}
|
|
13161
13214
|
}
|
|
13162
13215
|
getMaxText(isTextBox, text, obj) {
|
|
@@ -13555,6 +13608,12 @@ class Transform {
|
|
|
13555
13608
|
this.cropDimension.width = args.value['width'];
|
|
13556
13609
|
this.cropDimension.height = args.value['height'];
|
|
13557
13610
|
break;
|
|
13611
|
+
case 'getPreventSelect':
|
|
13612
|
+
args.value['obj']['bool'] = this.isPreventSelect;
|
|
13613
|
+
break;
|
|
13614
|
+
case 'setPreventSelect':
|
|
13615
|
+
this.isPreventSelect = args.value['bool'];
|
|
13616
|
+
break;
|
|
13558
13617
|
case 'reset':
|
|
13559
13618
|
this.reset();
|
|
13560
13619
|
break;
|
|
@@ -14675,6 +14734,9 @@ class Transform {
|
|
|
14675
14734
|
parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
|
|
14676
14735
|
value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
|
|
14677
14736
|
parent.objColl[i].flipObjColl = flipObjColl['collection'];
|
|
14737
|
+
if (parent.objColl[i].flipObjColl.length === 0) {
|
|
14738
|
+
parent.objColl[i].shapeFlip = '';
|
|
14739
|
+
}
|
|
14678
14740
|
}
|
|
14679
14741
|
}
|
|
14680
14742
|
if (tempZoomFactor !== 0) {
|
|
@@ -15040,6 +15102,7 @@ class Transform {
|
|
|
15040
15102
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15041
15103
|
this.lowerContext.filter = tempFilter;
|
|
15042
15104
|
parent.initialAdjustmentValue = tempFilter;
|
|
15105
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
15043
15106
|
if (parent.isImageLoaded) {
|
|
15044
15107
|
showSpinner(parent.element);
|
|
15045
15108
|
parent.element.style.opacity = '0.5';
|
|
@@ -16464,7 +16527,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
16464
16527
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
16465
16528
|
this.lowerContext.filter = this.getDefaultFilter();
|
|
16466
16529
|
this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
16467
|
-
this.
|
|
16530
|
+
this.canvasFilter = this.lowerContext.filter;
|
|
16468
16531
|
this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
|
|
16469
16532
|
if (this.cssClass) {
|
|
16470
16533
|
addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
|
|
@@ -17466,8 +17529,10 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
17466
17529
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
17467
17530
|
const data = this.getImageData();
|
|
17468
17531
|
if (!isBlazor()) {
|
|
17469
|
-
|
|
17470
|
-
|
|
17532
|
+
if (!Browser.isDevice) {
|
|
17533
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
17534
|
+
isApplyBtn: true, isCropping: false } });
|
|
17535
|
+
}
|
|
17471
17536
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
17472
17537
|
}
|
|
17473
17538
|
this.objColl = objColl;
|
|
@@ -18081,8 +18146,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18081
18146
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18082
18147
|
this.element = element;
|
|
18083
18148
|
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 + '
|
|
18149
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
|
|
18150
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
18086
18151
|
}
|
|
18087
18152
|
else {
|
|
18088
18153
|
this.toolbarHeight = 0;
|
|
@@ -18680,9 +18745,6 @@ class ToolbarModule {
|
|
|
18680
18745
|
case 'getCanvasFilter':
|
|
18681
18746
|
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
18682
18747
|
break;
|
|
18683
|
-
case 'setCanvasFilter':
|
|
18684
|
-
parent.canvasFilter = args.value['filter'];
|
|
18685
|
-
break;
|
|
18686
18748
|
case 'getDefToolbarItems':
|
|
18687
18749
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
18688
18750
|
break;
|
|
@@ -20080,7 +20142,8 @@ class ToolbarModule {
|
|
|
20080
20142
|
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
20081
20143
|
return;
|
|
20082
20144
|
}
|
|
20083
|
-
const
|
|
20145
|
+
const item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
|
|
20146
|
+
const args = { toolbarType: item };
|
|
20084
20147
|
if (type !== 'filter' && type !== 'color') {
|
|
20085
20148
|
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
20086
20149
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
@@ -21291,7 +21354,8 @@ class ToolbarModule {
|
|
|
21291
21354
|
const parent = this.parent;
|
|
21292
21355
|
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
21293
21356
|
parent.currObjType.isFiltered) {
|
|
21294
|
-
parent.initialAdjustmentValue =
|
|
21357
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
21358
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
21295
21359
|
parent.currObjType.isFiltered = false;
|
|
21296
21360
|
}
|
|
21297
21361
|
}
|