@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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
192
192
|
Crop.prototype.rotateCrop = function () {
|
|
193
193
|
var parent = this.parent;
|
|
194
194
|
var shape = parent.activeObj.shape || '';
|
|
195
|
-
var 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
|
-
var 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
|
-
var 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 (var 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
|
var activeObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
parent.transform.degree = tempDegree;
|
|
232
|
-
var 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
|
+
var tempCurrSelObj = extend({}, parent.currSelectionPoint, {}, true);
|
|
201
|
+
var 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
|
+
var 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
|
+
Crop.prototype.revertTransform = function (type, coll) {
|
|
225
|
+
var parent = this.parent;
|
|
226
|
+
var obj = { isRotate: false };
|
|
227
|
+
if (type === 'initial') {
|
|
228
|
+
for (var 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 (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
273
244
|
parent.objColl[i].shapeFlip = '';
|
|
274
245
|
}
|
|
275
246
|
for (var i = 0; i < parent.freehandCounter; i++) {
|
|
276
247
|
parent.pointColl[i].shapeFlip = '';
|
|
277
248
|
}
|
|
278
|
-
var
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
249
|
+
for (var 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
|
Crop.prototype.flipCrop = function () {
|
|
303
265
|
var parent = this.parent;
|
|
@@ -498,6 +460,15 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
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
|
+
var cropObjColl = extend([], parent.objColl, null, true);
|
|
464
|
+
var 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
|
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
|
|
503
474
|
height: parent.img.destHeight };
|
|
@@ -514,8 +485,8 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
526
497
|
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
527
498
|
value: { obj: { selPointColl: [] } } });
|
|
528
499
|
parent.cropObj.filter = this.lowerContext.filter;
|
|
500
|
+
var 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
|
var 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 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
560
534
|
parent.currSelectionPoint = null;
|
|
561
535
|
}
|
|
562
536
|
};
|
|
537
|
+
Crop.prototype.panToSelRangle = function (isReverse) {
|
|
538
|
+
var parent = this.parent;
|
|
539
|
+
var 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
|
+
var 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
|
Crop.prototype.cropCircle = function (context, isSave, isFlip) {
|
|
564
557
|
var parent = this.parent;
|
|
565
558
|
if (isFlip && parent.transform.currFlipState !== '') {
|
|
@@ -568,9 +561,9 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
568
561
|
}
|
|
569
562
|
context.globalCompositeOperation = 'destination-in';
|
|
570
563
|
context.beginPath();
|
|
571
|
-
var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) :
|
|
572
|
-
var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) :
|
|
573
|
-
var radius = parent.img.destWidth / 2;
|
|
564
|
+
var centerX = isNullOrUndefined(isSave) ? parent.img.destLeft + (parent.img.destWidth / 2) : context.canvas.width / 2;
|
|
565
|
+
var centerY = isNullOrUndefined(isSave) ? parent.img.destTop + (parent.img.destHeight / 2) : context.canvas.height / 2;
|
|
566
|
+
var 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();
|
|
@@ -749,7 +742,6 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
749
742
|
}
|
|
750
743
|
this.cropImg();
|
|
751
744
|
parent.transform.zoomFactor = 0;
|
|
752
|
-
parent.zoomSettings.zoomFactor = 1;
|
|
753
745
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
754
746
|
parent.notify('transform', { prop: 'setPreviousZoomValue', onPropertyChange: false,
|
|
755
747
|
value: { previousZoomValue: parent.zoomSettings.zoomFactor } });
|
|
@@ -775,17 +767,17 @@ var Crop = /** @__PURE__ @class */ (function () {
|
|
|
775
767
|
}
|
|
776
768
|
}
|
|
777
769
|
};
|
|
778
|
-
Crop.prototype.calcRatio = function (obj) {
|
|
770
|
+
Crop.prototype.calcRatio = function (obj, dimension) {
|
|
779
771
|
var parent = this.parent;
|
|
780
772
|
var widthRatio;
|
|
781
773
|
var heightRatio;
|
|
782
774
|
if (parent.transform.degree === 0 || parent.transform.degree % 180 === 0) {
|
|
783
|
-
widthRatio = parent.baseImg.width / parent.img.destWidth;
|
|
784
|
-
heightRatio = parent.baseImg.height / parent.img.destHeight;
|
|
775
|
+
widthRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destWidth;
|
|
776
|
+
heightRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destHeight;
|
|
785
777
|
}
|
|
786
778
|
else {
|
|
787
|
-
widthRatio = parent.baseImg.height / parent.img.destWidth;
|
|
788
|
-
heightRatio = parent.baseImg.width / parent.img.destHeight;
|
|
779
|
+
widthRatio = (dimension ? dimension.height : parent.baseImg.height) / parent.img.destWidth;
|
|
780
|
+
heightRatio = (dimension ? dimension.width : parent.baseImg.width) / parent.img.destHeight;
|
|
789
781
|
}
|
|
790
782
|
if (obj) {
|
|
791
783
|
obj['width'] = widthRatio;
|
|
@@ -1118,6 +1110,10 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1118
1110
|
parent.activeObj = extend({}, obj, {}, true);
|
|
1119
1111
|
}
|
|
1120
1112
|
this.updateActiveObject();
|
|
1113
|
+
if (isNullOrUndefined(parent.activeObj.activePoint.startX) &&
|
|
1114
|
+
isNullOrUndefined(parent.activeObj.activePoint.startY)) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1121
1117
|
if (parent.currObjType.isText) {
|
|
1122
1118
|
var obj_2 = { keyHistory: '' };
|
|
1123
1119
|
parent.notify('shape', { prop: 'getKeyHistory', onPropertyChange: false, value: { obj: obj_2 } });
|
|
@@ -1788,12 +1784,14 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1788
1784
|
if (degree < 0) {
|
|
1789
1785
|
degree = 360 + degree;
|
|
1790
1786
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1787
|
+
if (parent.activeObj.flipObjColl) {
|
|
1788
|
+
for (var i = 0, len = parent.activeObj.flipObjColl.length; i < len; i++) {
|
|
1789
|
+
if (parent.activeObj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
1790
|
+
isHorizontalflip = true;
|
|
1791
|
+
}
|
|
1792
|
+
else if (parent.activeObj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
1793
|
+
isVerticalflip = true;
|
|
1794
|
+
}
|
|
1797
1795
|
}
|
|
1798
1796
|
}
|
|
1799
1797
|
switch (degree) {
|
|
@@ -2372,17 +2370,18 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2372
2370
|
parent.activeObj.textSettings.fontFamily;
|
|
2373
2371
|
if (parent.activeObj.flipObjColl.length === 4) {
|
|
2374
2372
|
parent.activeObj.flipObjColl = [];
|
|
2373
|
+
parent.activeObj.shapeFlip = '';
|
|
2375
2374
|
}
|
|
2376
2375
|
for (var j = 0, len = parent.activeObj.flipObjColl.length; j < len; j++) {
|
|
2377
2376
|
if (parent.activeObj.flipObjColl[j].toLowerCase() === 'horizontal') {
|
|
2378
2377
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
2379
2378
|
canvasDraw.scale(-1, 1);
|
|
2380
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
2379
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
2381
2380
|
}
|
|
2382
2381
|
else if (parent.activeObj.flipObjColl[j].toLowerCase() === 'vertical') {
|
|
2383
2382
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
2384
2383
|
canvasDraw.scale(1, -1);
|
|
2385
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
2384
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
2386
2385
|
}
|
|
2387
2386
|
}
|
|
2388
2387
|
if (parent.activeObj.shapeDegree !== parent.transform.degree) {
|
|
@@ -2395,12 +2394,12 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2395
2394
|
if (parent.activeObj.flipObjColl[k].toLowerCase() === 'horizontal') {
|
|
2396
2395
|
canvasDraw.translate(canvasDraw.canvas.width, 0);
|
|
2397
2396
|
canvasDraw.scale(-1, 1);
|
|
2398
|
-
this.updateActPoint('horizontal', canvasDraw);
|
|
2397
|
+
actPoint = this.updateActPoint('horizontal', canvasDraw);
|
|
2399
2398
|
}
|
|
2400
2399
|
else if (parent.activeObj.flipObjColl[k].toLowerCase() === 'vertical') {
|
|
2401
2400
|
canvasDraw.translate(0, canvasDraw.canvas.height);
|
|
2402
2401
|
canvasDraw.scale(1, -1);
|
|
2403
|
-
this.updateActPoint('vertical', canvasDraw);
|
|
2402
|
+
actPoint = this.updateActPoint('vertical', canvasDraw);
|
|
2404
2403
|
}
|
|
2405
2404
|
}
|
|
2406
2405
|
}
|
|
@@ -2436,6 +2435,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2436
2435
|
this.updateActiveObject(actPoint, parent.activeObj);
|
|
2437
2436
|
}
|
|
2438
2437
|
}
|
|
2438
|
+
return actPoint;
|
|
2439
2439
|
};
|
|
2440
2440
|
Draw.prototype.rotateText = function (canvasDraw) {
|
|
2441
2441
|
var parent = this.parent;
|
|
@@ -2449,6 +2449,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2449
2449
|
else {
|
|
2450
2450
|
degree = parent.transform.degree - parent.activeObj.shapeDegree;
|
|
2451
2451
|
}
|
|
2452
|
+
if (degree === -450) {
|
|
2453
|
+
degree = -90;
|
|
2454
|
+
}
|
|
2452
2455
|
if (degree < 0) {
|
|
2453
2456
|
degree = 360 + degree;
|
|
2454
2457
|
}
|
|
@@ -3774,11 +3777,8 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3774
3777
|
}
|
|
3775
3778
|
}
|
|
3776
3779
|
else {
|
|
3777
|
-
if (parent.element.querySelector('#' + parent.element.id + '
|
|
3778
|
-
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '
|
|
3779
|
-
}
|
|
3780
|
-
else {
|
|
3781
|
-
parent.toolbarHeight = 0;
|
|
3780
|
+
if (parent.element.querySelector('#' + parent.element.id + '_toolbarArea')) {
|
|
3781
|
+
parent.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
|
|
3782
3782
|
}
|
|
3783
3783
|
}
|
|
3784
3784
|
parent.reset();
|
|
@@ -3821,8 +3821,8 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3821
3821
|
parent.clearContext(this.lowerContext);
|
|
3822
3822
|
parent.clearContext(this.upperContext);
|
|
3823
3823
|
parent.clearContext(inMemoryContext);
|
|
3824
|
-
parent.inMemoryCanvas.width =
|
|
3825
|
-
parent.inMemoryCanvas.height =
|
|
3824
|
+
parent.inMemoryCanvas.width = this.openURL.width;
|
|
3825
|
+
parent.inMemoryCanvas.height = this.openURL.height;
|
|
3826
3826
|
inMemoryContext.putImageData(this.openURL, 0, 0);
|
|
3827
3827
|
parent.baseImg.src = parent.inMemoryCanvas.toDataURL();
|
|
3828
3828
|
}
|
|
@@ -3978,75 +3978,84 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
3978
3978
|
Draw.prototype.moveToSelectionRange = function (type, activeObj) {
|
|
3979
3979
|
var parent = this.parent;
|
|
3980
3980
|
if (parent.activeObj.shape) {
|
|
3981
|
-
|
|
3981
|
+
var isRotated = false;
|
|
3982
|
+
for (var i = 0; i < parent.rotateFlipColl.length; i++) {
|
|
3983
|
+
if (parent.rotateFlipColl[i] === 90 || parent.rotateFlipColl[i] === -90) {
|
|
3984
|
+
isRotated = true;
|
|
3985
|
+
break;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
if (isRotated) {
|
|
3982
3989
|
var zoomFactor = parent.transform.zoomFactor;
|
|
3983
3990
|
parent.objColl.push(parent.activeObj);
|
|
3984
3991
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
3985
|
-
if (
|
|
3986
|
-
if (parent.
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3992
|
+
if (type === 'rotateleft' || type === 'rotateright') {
|
|
3993
|
+
if (parent.transform.degree % 90 === 0 && parent.transform.degree % 180 !== 0) {
|
|
3994
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width < activeObj.activePoint.height) {
|
|
3995
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
3996
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
3997
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
3998
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
3999
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4000
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4001
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4002
|
+
}
|
|
4003
|
+
break;
|
|
3994
4004
|
}
|
|
3995
|
-
|
|
4005
|
+
zoomFactor += 0.1;
|
|
4006
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4007
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
3996
4008
|
}
|
|
3997
|
-
zoomFactor += 0.1;
|
|
3998
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
3999
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4000
4009
|
}
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
+
else {
|
|
4011
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4012
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.width >= activeObj.activePoint.height ||
|
|
4013
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4014
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4015
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4016
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4017
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4018
|
+
}
|
|
4019
|
+
break;
|
|
4010
4020
|
}
|
|
4011
|
-
|
|
4021
|
+
zoomFactor -= .1;
|
|
4022
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4023
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4012
4024
|
}
|
|
4013
|
-
zoomFactor -= .1;
|
|
4014
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4015
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4016
4025
|
}
|
|
4017
4026
|
}
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4027
|
+
else {
|
|
4028
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height < activeObj.activePoint.width) {
|
|
4029
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4030
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4031
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4032
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4033
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4034
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4035
|
+
value: { zoomFactor: -0.1, zoomPoint: null } });
|
|
4036
|
+
}
|
|
4037
|
+
break;
|
|
4028
4038
|
}
|
|
4029
|
-
|
|
4039
|
+
zoomFactor += 0.1;
|
|
4040
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4041
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4030
4042
|
}
|
|
4031
|
-
zoomFactor += 0.1;
|
|
4032
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4033
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4034
4043
|
}
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
+
else {
|
|
4045
|
+
for (var i = 2; i < parent.zoomSettings.maxZoomFactor; i++) {
|
|
4046
|
+
if (parent.objColl[parent.objColl.length - 1].activePoint.height >= activeObj.activePoint.width ||
|
|
4047
|
+
this.isSelectionBiggerThanCanvas(parent.objColl[parent.objColl.length - 1]) ||
|
|
4048
|
+
this.isSelectionOutsideCanvas(parent.objColl[parent.objColl.length - 1])) {
|
|
4049
|
+
if (!isNullOrUndefined(zoomFactor)) {
|
|
4050
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4051
|
+
value: { zoomFactor: 0.1, zoomPoint: null } });
|
|
4052
|
+
}
|
|
4053
|
+
break;
|
|
4044
4054
|
}
|
|
4045
|
-
|
|
4055
|
+
zoomFactor -= .1;
|
|
4056
|
+
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4057
|
+
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4046
4058
|
}
|
|
4047
|
-
zoomFactor -= .1;
|
|
4048
|
-
parent.notify('transform', { prop: 'zoomAction', onPropertyChange: false,
|
|
4049
|
-
value: { zoomFactor: zoomFactor, zoomPoint: null } });
|
|
4050
4059
|
}
|
|
4051
4060
|
}
|
|
4052
4061
|
}
|
|
@@ -4256,8 +4265,19 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4256
4265
|
};
|
|
4257
4266
|
Export.prototype.exportToCanvas = function (object) {
|
|
4258
4267
|
var parent = this.parent;
|
|
4268
|
+
var width;
|
|
4269
|
+
var height;
|
|
4270
|
+
if (parent.currSelectionPoint) {
|
|
4271
|
+
width = parent.img.srcWidth;
|
|
4272
|
+
height = parent.img.srcHeight;
|
|
4273
|
+
}
|
|
4274
|
+
else {
|
|
4275
|
+
width = parent.baseImg.width;
|
|
4276
|
+
height = parent.baseImg.height;
|
|
4277
|
+
}
|
|
4259
4278
|
var obj = { width: 0, height: 0 };
|
|
4260
|
-
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
4279
|
+
parent.notify('crop', { prop: 'calcRatio', onPropertyChange: false,
|
|
4280
|
+
value: { obj: obj, dimension: { width: width, height: height } } });
|
|
4261
4281
|
var ratio = obj;
|
|
4262
4282
|
var tempContextFilter = this.lowerContext.filter;
|
|
4263
4283
|
// Manipulating blur value
|
|
@@ -4268,42 +4288,30 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4268
4288
|
splitWords[5] = 'blur(' + value + 'px)';
|
|
4269
4289
|
this.lowerContext.filter = splitWords.join(' ');
|
|
4270
4290
|
}
|
|
4271
|
-
var maxDimension;
|
|
4272
4291
|
var tempCanvas = parent.createElement('canvas', {
|
|
4273
4292
|
id: parent.element.id + '_tempCanvas', attrs: { name: 'canvasImage' }
|
|
4274
4293
|
});
|
|
4275
4294
|
var tempContext = tempCanvas.getContext('2d');
|
|
4276
4295
|
tempContext.filter = this.lowerContext.filter;
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
4291
|
-
value: { width: parent.baseImg.width, height: parent.baseImg.height, obj: obj_2 } });
|
|
4292
|
-
maxDimension = obj_2;
|
|
4293
|
-
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
4294
|
-
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
4295
|
-
tempContext.filter = this.lowerContext.filter;
|
|
4296
|
-
var temp = this.lowerContext.filter;
|
|
4297
|
-
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
4298
|
-
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, parent.baseImg.width, parent.baseImg.height);
|
|
4299
|
-
this.lowerContext.filter = temp;
|
|
4300
|
-
}
|
|
4296
|
+
tempCanvas.width = width;
|
|
4297
|
+
tempCanvas.height = height;
|
|
4298
|
+
var dimObj = { width: 0, height: 0 };
|
|
4299
|
+
parent.notify('transform', { prop: 'calcMaxDimension', onPropertyChange: false,
|
|
4300
|
+
value: { width: width, height: height, obj: dimObj } });
|
|
4301
|
+
var maxDimension = dimObj;
|
|
4302
|
+
tempCanvas.style.maxWidth = maxDimension.width + 'px';
|
|
4303
|
+
tempCanvas.style.maxHeight = maxDimension.height + 'px';
|
|
4304
|
+
tempContext.filter = this.lowerContext.filter;
|
|
4305
|
+
var temp = this.lowerContext.filter;
|
|
4306
|
+
parent.notify('filter', { prop: 'updateBrightFilter', onPropertyChange: false });
|
|
4307
|
+
tempContext.drawImage(parent.baseImg, parent.img.srcLeft, parent.img.srcTop, parent.img.srcWidth, parent.img.srcHeight, 0, 0, width, height);
|
|
4308
|
+
this.lowerContext.filter = temp;
|
|
4301
4309
|
if (parent.transform.degree !== 0 || parent.transform.currFlipState !== '') {
|
|
4302
4310
|
this.updateSaveContext(tempContext);
|
|
4303
4311
|
this.exportTransformedImage(tempContext);
|
|
4304
4312
|
}
|
|
4305
4313
|
if (parent.objColl.length > 0) {
|
|
4306
|
-
var
|
|
4314
|
+
var temp_1 = tempContext.filter;
|
|
4307
4315
|
tempContext.filter = 'none';
|
|
4308
4316
|
var tempObjColl = extend([], parent.objColl, [], true);
|
|
4309
4317
|
for (var i = 0, len = parent.objColl.length; i < len; i++) {
|
|
@@ -4316,22 +4324,20 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4316
4324
|
activePoint.width = activePoint.endX - activePoint.startX;
|
|
4317
4325
|
activePoint.height = activePoint.endY - activePoint.startY;
|
|
4318
4326
|
// Manipulating points
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4329
|
-
}
|
|
4327
|
+
activePoint.startX *= ratio.width;
|
|
4328
|
+
activePoint.startY *= ratio.height;
|
|
4329
|
+
activePoint.endX *= ratio.width;
|
|
4330
|
+
activePoint.endY *= ratio.height;
|
|
4331
|
+
activePoint.width = activePoint.endX - activePoint.startX;
|
|
4332
|
+
activePoint.height = activePoint.endY - activePoint.startY;
|
|
4333
|
+
parent.objColl[i].strokeSettings.strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4334
|
+
if (parent.objColl[i].shape === 'text') {
|
|
4335
|
+
parent.objColl[i].textSettings.fontSize *= ((ratio.width + ratio.height) / 2);
|
|
4330
4336
|
}
|
|
4331
4337
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'saveContext', obj: parent.objColl[i], isCropRatio: null,
|
|
4332
4338
|
points: null, isPreventDrag: true, saveContext: tempContext, isPreventSelection: null } });
|
|
4333
4339
|
}
|
|
4334
|
-
tempContext.filter =
|
|
4340
|
+
tempContext.filter = temp_1;
|
|
4335
4341
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
4336
4342
|
parent.objColl = tempObjColl;
|
|
4337
4343
|
}
|
|
@@ -4342,18 +4348,10 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4342
4348
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
4343
4349
|
parent.notify('freehand-draw', { prop: 'setPointCounter', onPropertyChange: false, value: { value: 0 } });
|
|
4344
4350
|
var len = parent.points.length;
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
}
|
|
4350
|
-
}
|
|
4351
|
-
else {
|
|
4352
|
-
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4353
|
-
for (var l = 0; l < len; l++) {
|
|
4354
|
-
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
4355
|
-
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
4356
|
-
}
|
|
4351
|
+
parent.pointColl[n].strokeWidth *= ((ratio.width + ratio.height) / 2);
|
|
4352
|
+
for (var l = 0; l < len; l++) {
|
|
4353
|
+
parent.points[l].x = (parent.points[l].x - parent.img.destLeft) * ratio.width;
|
|
4354
|
+
parent.points[l].y = (parent.points[l].y - parent.img.destTop) * ratio.height;
|
|
4357
4355
|
}
|
|
4358
4356
|
}
|
|
4359
4357
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
@@ -4365,6 +4363,7 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4365
4363
|
value: { context: tempContext, isSave: true, isFlip: null } });
|
|
4366
4364
|
}
|
|
4367
4365
|
this.lowerContext.filter = tempContextFilter;
|
|
4366
|
+
parent.canvasFilter = tempContextFilter;
|
|
4368
4367
|
if (object) {
|
|
4369
4368
|
object['canvas'] = tempCanvas;
|
|
4370
4369
|
}
|
|
@@ -4399,17 +4398,10 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4399
4398
|
};
|
|
4400
4399
|
Export.prototype.exportRotate = function (tempContext, degree) {
|
|
4401
4400
|
var parent = this.parent;
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
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);
|
|
4407
|
-
}
|
|
4408
|
-
else {
|
|
4409
|
-
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
4410
|
-
tempContext.rotate(Math.PI / 180 * degree);
|
|
4411
|
-
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
4412
|
-
}
|
|
4401
|
+
this.setMaxDim(parent.transform.degree, tempContext.canvas);
|
|
4402
|
+
tempContext.translate(tempContext.canvas.width / 2, tempContext.canvas.height / 2);
|
|
4403
|
+
tempContext.rotate(Math.PI / 180 * degree);
|
|
4404
|
+
tempContext.drawImage(parent.inMemoryCanvas, -tempContext.canvas.height / 2, -tempContext.canvas.width / 2, tempContext.canvas.height, tempContext.canvas.width);
|
|
4413
4405
|
this.updateSaveContext(tempContext);
|
|
4414
4406
|
};
|
|
4415
4407
|
Export.prototype.exportFlip = function (tempContext, flipHorizontal, flipVertical) {
|
|
@@ -4436,12 +4428,12 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
4436
4428
|
var newWidth;
|
|
4437
4429
|
var newHeight;
|
|
4438
4430
|
if (degree % 90 === 0 && degree % 180 !== 0) {
|
|
4439
|
-
newWidth = this.parent.baseImg.height;
|
|
4440
|
-
newHeight = this.parent.baseImg.width;
|
|
4431
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
4432
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
4441
4433
|
}
|
|
4442
4434
|
else if (degree % 180 === 0 || degree === 0) {
|
|
4443
|
-
newWidth = this.parent.baseImg.width;
|
|
4444
|
-
newHeight = this.parent.baseImg.height;
|
|
4435
|
+
newWidth = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.width : this.parent.img.srcWidth;
|
|
4436
|
+
newHeight = isNullOrUndefined(this.parent.currSelectionPoint) ? this.parent.baseImg.height : this.parent.img.srcHeight;
|
|
4445
4437
|
}
|
|
4446
4438
|
tempCanvas.width = newWidth;
|
|
4447
4439
|
tempCanvas.height = newHeight;
|
|
@@ -5757,6 +5749,7 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5757
5749
|
}
|
|
5758
5750
|
};
|
|
5759
5751
|
FreehandDrawing.prototype.selectFhd = function (index) {
|
|
5752
|
+
var _this = this;
|
|
5760
5753
|
var parent = this.parent;
|
|
5761
5754
|
parent.notify('selection', { prop: 'setFreehandDrawEditing', onPropertyChange: false, value: { bool: true } });
|
|
5762
5755
|
if (index || index === 0) {
|
|
@@ -5781,7 +5774,29 @@ var FreehandDrawing = /** @__PURE__ @class */ (function () {
|
|
|
5781
5774
|
var obj = { bool: false };
|
|
5782
5775
|
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
5783
5776
|
if (obj['bool']) {
|
|
5784
|
-
|
|
5777
|
+
var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
|
|
5778
|
+
startX: parent.pointColl[this.fhdSelIdx].points[0].x, startY: parent.pointColl[this.fhdSelIdx].points[0].y,
|
|
5779
|
+
strokeColor: parent.pointColl[this.fhdSelIdx].strokeColor, strokeWidth: parent.pointColl[this.fhdSelIdx].strokeWidth,
|
|
5780
|
+
points: parent.pointColl[this.fhdSelIdx].points };
|
|
5781
|
+
var shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
|
|
5782
|
+
currentShapeSettings: shapeSettings };
|
|
5783
|
+
if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
5784
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5785
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
|
|
5786
|
+
parent.pointColl[_this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5787
|
+
parent.pointColl[_this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5788
|
+
parent.pointColl[_this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5789
|
+
_this.freehandRedraw(_this.upperContext);
|
|
5790
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
5791
|
+
parent.updateToolbar(parent.element, 'pen');
|
|
5792
|
+
});
|
|
5793
|
+
}
|
|
5794
|
+
else {
|
|
5795
|
+
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
5796
|
+
parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
5797
|
+
parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
5798
|
+
parent.pointColl[this.fhdSelIdx].points = shapeChangingArgs.currentShapeSettings.points;
|
|
5799
|
+
this.freehandRedraw(this.upperContext);
|
|
5785
5800
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
5786
5801
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
5787
5802
|
}
|
|
@@ -6406,6 +6421,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
6406
6421
|
case 'unWireEvent':
|
|
6407
6422
|
this.unwireEvent();
|
|
6408
6423
|
break;
|
|
6424
|
+
case 'updPtCollForShpRot':
|
|
6425
|
+
this.updPtCollForShpRot(args.value['obj']);
|
|
6426
|
+
break;
|
|
6409
6427
|
}
|
|
6410
6428
|
};
|
|
6411
6429
|
Selection.prototype.getModuleName = function () {
|
|
@@ -9267,6 +9285,9 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
9267
9285
|
if (!this.isFhdEditing) {
|
|
9268
9286
|
this.applyCurrActObj(x, y);
|
|
9269
9287
|
parent.currObjType.isResize = false;
|
|
9288
|
+
if (!isBlazor()) {
|
|
9289
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
9290
|
+
}
|
|
9270
9291
|
}
|
|
9271
9292
|
}
|
|
9272
9293
|
if (parent.activeObj) {
|
|
@@ -10590,8 +10611,10 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10590
10611
|
fillColor: parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.fillColor : null,
|
|
10591
10612
|
radius: parent.activeObj.shape === 'ellipse' ? parent.activeObj.activePoint.width / 2 : null,
|
|
10592
10613
|
length: parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' ? parent.activeObj.activePoint.width : null,
|
|
10593
|
-
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
10614
|
+
text: parent.activeObj.shape === 'text' ? (parent.activeObj.keyHistory ? parent.activeObj.keyHistory :
|
|
10615
|
+
(parent.activeObj.textSettings.text ? parent.activeObj.textSettings.text : null)) : null,
|
|
10594
10616
|
fontSize: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontSize : null) : null,
|
|
10617
|
+
fontFamily: parent.activeObj.shape === 'text' ? (parent.activeObj.textSettings ? parent.activeObj.textSettings.fontFamily : null) : null,
|
|
10595
10618
|
fontStyle: parent.activeObj.shape === 'text' ? fontStyle : null,
|
|
10596
10619
|
color: parent.activeObj.shape === 'text' ? (parent.activeObj.strokeSettings ? parent.activeObj.strokeSettings.strokeColor : null) : null
|
|
10597
10620
|
};
|
|
@@ -10635,12 +10658,14 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
10635
10658
|
if (degree < 0) {
|
|
10636
10659
|
degree = 360 + degree;
|
|
10637
10660
|
}
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10661
|
+
if (obj.flipObjColl) {
|
|
10662
|
+
for (var i = 0; i < obj.flipObjColl.length; i++) {
|
|
10663
|
+
if (obj.flipObjColl[i].toLowerCase() === 'horizontal') {
|
|
10664
|
+
isHorizontalflip = true;
|
|
10665
|
+
}
|
|
10666
|
+
else if (obj.flipObjColl[i].toLowerCase() === 'vertical') {
|
|
10667
|
+
isVerticalflip = true;
|
|
10668
|
+
}
|
|
10644
10669
|
}
|
|
10645
10670
|
}
|
|
10646
10671
|
if (degree === 0 || degree === 360) {
|
|
@@ -10729,7 +10754,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
10729
10754
|
this.drawPath(args.value['pointColl'], args.value['strokeWidth'], args.value['strokeColor']);
|
|
10730
10755
|
break;
|
|
10731
10756
|
case 'drawRectangle':
|
|
10732
|
-
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['
|
|
10757
|
+
this.drawRectangle(args.value['x'], args.value['y'], args.value['width'], args.value['height'], args.value['strokeWidth'], args.value['strokeColor'], args.value['fillColor']);
|
|
10733
10758
|
break;
|
|
10734
10759
|
case 'drawText':
|
|
10735
10760
|
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']);
|
|
@@ -10920,10 +10945,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
10920
10945
|
{ text: 'Enter Text', fontFamily: 'Arial', fontSize: null, fontRatio: null, bold: false, italic: false, underline: false };
|
|
10921
10946
|
this.strokeSettings = { strokeColor: '#fff', fillColor: '', strokeWidth: null };
|
|
10922
10947
|
};
|
|
10923
|
-
Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor) {
|
|
10948
|
+
Shape.prototype.drawEllipse = function (x, y, radiusX, radiusY, strokeWidth, strokeColor, fillColor, degree) {
|
|
10924
10949
|
this.initializeShape('ellipse');
|
|
10925
10950
|
var start = x && y ? { x: x, y: y } : null;
|
|
10926
|
-
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY);
|
|
10951
|
+
this.drawShape('ellipse', strokeWidth, strokeColor, fillColor, start, radiusX, radiusY, null, null, null, degree);
|
|
10927
10952
|
};
|
|
10928
10953
|
Shape.prototype.drawLine = function (startX, startY, endX, endY, strokeWidth, strokeColor) {
|
|
10929
10954
|
this.initializeShape('line');
|
|
@@ -10954,10 +10979,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
10954
10979
|
var height = endY - startY;
|
|
10955
10980
|
this.drawShape('arrow', strokeWidth, strokeColor, null, start, width, height, null, arrowStart, arrowEnd);
|
|
10956
10981
|
};
|
|
10957
|
-
Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor) {
|
|
10982
|
+
Shape.prototype.drawRectangle = function (x, y, width, height, strokeWidth, strokeColor, fillColor, degree) {
|
|
10958
10983
|
this.initializeShape('rectangle');
|
|
10959
10984
|
var start = x && y ? { x: x, y: y } : null;
|
|
10960
|
-
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height);
|
|
10985
|
+
this.drawShape('rectangle', strokeWidth, strokeColor, fillColor, start, width, height, null, null, null, degree);
|
|
10961
10986
|
};
|
|
10962
10987
|
Shape.prototype.drawText = function (x, y, text, fontFamily, fontSize, bold, italic, color) {
|
|
10963
10988
|
this.drawShapeText(text, fontFamily, fontSize, bold, italic, color, x, y);
|
|
@@ -10996,7 +11021,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
10996
11021
|
}
|
|
10997
11022
|
return arrowType;
|
|
10998
11023
|
};
|
|
10999
|
-
Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd) {
|
|
11024
|
+
Shape.prototype.drawShape = function (type, strokeWidth, strokeColor, fillColor, start, width, height, pointColl, arrowStart, arrowEnd, degree) {
|
|
11000
11025
|
var _this = this;
|
|
11001
11026
|
var parent = this.parent;
|
|
11002
11027
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
@@ -11065,10 +11090,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11065
11090
|
parent.activeObj.triangleDirection = 'right';
|
|
11066
11091
|
}
|
|
11067
11092
|
parent.currObjType.isDragging = parent.currObjType.isCustomCrop = false;
|
|
11068
|
-
|
|
11069
|
-
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
11070
|
-
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
11071
|
-
parent.activeObj.flipObjColl = [];
|
|
11093
|
+
this.initShapeProps();
|
|
11072
11094
|
var obj = { shapeSettingsObj: {} };
|
|
11073
11095
|
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
11074
11096
|
var shapeSettings = obj['shapeSettingsObj'];
|
|
@@ -11080,6 +11102,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11080
11102
|
_this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
11081
11103
|
_this.setDimension(width, height);
|
|
11082
11104
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
11105
|
+
if (degree) {
|
|
11106
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
11107
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
11108
|
+
}
|
|
11083
11109
|
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'shape');
|
|
11084
11110
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
11085
11111
|
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
|
|
@@ -11094,6 +11120,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11094
11120
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings);
|
|
11095
11121
|
this.setDimension(width, height);
|
|
11096
11122
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate' } });
|
|
11123
|
+
if (degree) {
|
|
11124
|
+
parent.activeObj.rotatedAngle = degree * (Math.PI / 180);
|
|
11125
|
+
parent.notify('selection', { prop: 'updPtCollForShpRot', onPropertyChange: false, value: { obj: parent.activeObj } });
|
|
11126
|
+
}
|
|
11097
11127
|
if (!isBlazor()) {
|
|
11098
11128
|
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
11099
11129
|
}
|
|
@@ -11114,6 +11144,13 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11114
11144
|
}
|
|
11115
11145
|
}
|
|
11116
11146
|
};
|
|
11147
|
+
Shape.prototype.initShapeProps = function () {
|
|
11148
|
+
var parent = this.parent;
|
|
11149
|
+
parent.activeObj.shapeDegree = parent.transform.degree;
|
|
11150
|
+
parent.activeObj.shapeFlip = parent.transform.currFlipState;
|
|
11151
|
+
parent.activeObj.textFlip = parent.transform.currFlipState;
|
|
11152
|
+
parent.activeObj.flipObjColl = [];
|
|
11153
|
+
};
|
|
11117
11154
|
Shape.prototype.setPointCollForLineAndArrow = function () {
|
|
11118
11155
|
var parent = this.parent;
|
|
11119
11156
|
if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow') {
|
|
@@ -11128,6 +11165,19 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11128
11165
|
}
|
|
11129
11166
|
}
|
|
11130
11167
|
};
|
|
11168
|
+
Shape.prototype.prevObjColl = function () {
|
|
11169
|
+
var parent = this.parent;
|
|
11170
|
+
var object = { currObj: {} };
|
|
11171
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11172
|
+
this.prevObj = object['currObj'];
|
|
11173
|
+
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11174
|
+
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11175
|
+
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
11176
|
+
var selPointCollObj = { selPointColl: null };
|
|
11177
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11178
|
+
value: { obj: selPointCollObj } });
|
|
11179
|
+
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11180
|
+
};
|
|
11131
11181
|
Shape.prototype.drawShapeText = function (text, fontFamily, fontSize, bold, italic, strokeColor, x, y) {
|
|
11132
11182
|
var _this = this;
|
|
11133
11183
|
var parent = this.parent;
|
|
@@ -11140,16 +11190,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11140
11190
|
parent.notify('draw', { prop: 'setImageEdited', onPropertyChange: false });
|
|
11141
11191
|
parent.togglePen = false;
|
|
11142
11192
|
this.redrawActObj();
|
|
11143
|
-
|
|
11144
|
-
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
11145
|
-
this.prevObj = object['currObj'];
|
|
11146
|
-
this.prevObj.objColl = extend([], parent.objColl, [], true);
|
|
11147
|
-
this.prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
11148
|
-
this.prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
11149
|
-
var selPointCollObj = { selPointColl: null };
|
|
11150
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
11151
|
-
value: { obj: selPointCollObj } });
|
|
11152
|
-
this.prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
11193
|
+
this.prevObjColl();
|
|
11153
11194
|
this.refreshActiveObj();
|
|
11154
11195
|
parent.activeObj.shape = parent.currObjType.shape = 'text';
|
|
11155
11196
|
parent.currObjType.isCustomCrop = false;
|
|
@@ -11388,9 +11429,12 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
11388
11429
|
parent.activeObj.activePoint.width = shapeSettings.length;
|
|
11389
11430
|
break;
|
|
11390
11431
|
case 'text':
|
|
11391
|
-
parent.activeObj.keyHistory = shapeSettings.text;
|
|
11432
|
+
parent.activeObj.keyHistory = parent.activeObj.textSettings.text = shapeSettings.text;
|
|
11392
11433
|
parent.activeObj.textSettings.fontSize = shapeSettings.fontSize;
|
|
11393
11434
|
parent.activeObj.strokeSettings.strokeColor = shapeSettings.color;
|
|
11435
|
+
parent.activeObj.textSettings.fontFamily = shapeSettings.fontFamily;
|
|
11436
|
+
break;
|
|
11437
|
+
case 'rectangle':
|
|
11394
11438
|
break;
|
|
11395
11439
|
}
|
|
11396
11440
|
if (parent.activeObj.shape === 'text' && parent.activeObj.textSettings) {
|
|
@@ -12256,6 +12300,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
12256
12300
|
if (actObj.flipObjColl.length === 4) {
|
|
12257
12301
|
actObj.flipObjColl = [];
|
|
12258
12302
|
flip = '';
|
|
12303
|
+
actObj.shapeFlip = '';
|
|
12259
12304
|
}
|
|
12260
12305
|
if (flip === '' && actObj.flipObjColl.length > 1) {
|
|
12261
12306
|
flip = actObj.flipObjColl[actObj.flipObjColl.length - 1];
|
|
@@ -12907,6 +12952,10 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
12907
12952
|
shapeDetails.fontStyle.push('italic');
|
|
12908
12953
|
}
|
|
12909
12954
|
break;
|
|
12955
|
+
case 'path':
|
|
12956
|
+
shapeDetails.strokeColor = obj.strokeSettings.strokeColor;
|
|
12957
|
+
shapeDetails.strokeWidth = obj.strokeSettings.strokeWidth;
|
|
12958
|
+
break;
|
|
12910
12959
|
}
|
|
12911
12960
|
return shapeDetails;
|
|
12912
12961
|
};
|
|
@@ -13177,7 +13226,12 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
13177
13226
|
this.lowerContext.filter = object['canvasFilter'];
|
|
13178
13227
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
13179
13228
|
parent.notify('draw', { prop: 'redrawImgWithObj', onPropertyChange: false });
|
|
13180
|
-
|
|
13229
|
+
if (!isBlazor()) {
|
|
13230
|
+
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
13231
|
+
}
|
|
13232
|
+
else {
|
|
13233
|
+
parent.updateToolbar(parent.element, 'imageLoaded');
|
|
13234
|
+
}
|
|
13181
13235
|
}
|
|
13182
13236
|
};
|
|
13183
13237
|
Shape.prototype.getMaxText = function (isTextBox, text, obj) {
|
|
@@ -13577,6 +13631,12 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
13577
13631
|
this.cropDimension.width = args.value['width'];
|
|
13578
13632
|
this.cropDimension.height = args.value['height'];
|
|
13579
13633
|
break;
|
|
13634
|
+
case 'getPreventSelect':
|
|
13635
|
+
args.value['obj']['bool'] = this.isPreventSelect;
|
|
13636
|
+
break;
|
|
13637
|
+
case 'setPreventSelect':
|
|
13638
|
+
this.isPreventSelect = args.value['bool'];
|
|
13639
|
+
break;
|
|
13580
13640
|
case 'reset':
|
|
13581
13641
|
this.reset();
|
|
13582
13642
|
break;
|
|
@@ -14701,6 +14761,9 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
14701
14761
|
parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
|
|
14702
14762
|
value: { collection: parent.objColl[i].flipObjColl, isRotateFlipCollection: null, obj: flipObjColl } });
|
|
14703
14763
|
parent.objColl[i].flipObjColl = flipObjColl['collection'];
|
|
14764
|
+
if (parent.objColl[i].flipObjColl.length === 0) {
|
|
14765
|
+
parent.objColl[i].shapeFlip = '';
|
|
14766
|
+
}
|
|
14704
14767
|
}
|
|
14705
14768
|
}
|
|
14706
14769
|
if (tempZoomFactor !== 0) {
|
|
@@ -15066,6 +15129,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
15066
15129
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
15067
15130
|
this.lowerContext.filter = tempFilter;
|
|
15068
15131
|
parent.initialAdjustmentValue = tempFilter;
|
|
15132
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
15069
15133
|
if (parent.isImageLoaded) {
|
|
15070
15134
|
showSpinner(parent.element);
|
|
15071
15135
|
parent.element.style.opacity = '0.5';
|
|
@@ -16523,7 +16587,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
16523
16587
|
this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
|
|
16524
16588
|
this.lowerContext.filter = this.getDefaultFilter();
|
|
16525
16589
|
this.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
16526
|
-
this.
|
|
16590
|
+
this.canvasFilter = this.lowerContext.filter;
|
|
16527
16591
|
this.notify('toolbar', { prop: 'setInitialAdjustmentValue', onPropertyChange: false, value: { value: this.lowerContext.filter } });
|
|
16528
16592
|
if (this.cssClass) {
|
|
16529
16593
|
addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
|
|
@@ -17525,8 +17589,10 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
17525
17589
|
this.notify('draw', { prop: 'render-image', value: { isMouseWheel: false } });
|
|
17526
17590
|
var data = this.getImageData();
|
|
17527
17591
|
if (!isBlazor()) {
|
|
17528
|
-
|
|
17529
|
-
|
|
17592
|
+
if (!Browser.isDevice) {
|
|
17593
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
17594
|
+
isApplyBtn: true, isCropping: false } });
|
|
17595
|
+
}
|
|
17530
17596
|
this.element.querySelector('#' + this.element.id + '_contextualToolbarArea').classList.remove('e-hide');
|
|
17531
17597
|
}
|
|
17532
17598
|
this.objColl = objColl;
|
|
@@ -18141,8 +18207,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
18141
18207
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18142
18208
|
this.element = element;
|
|
18143
18209
|
var canvasWrapper = this.element.querySelector('.e-canvas-wrapper');
|
|
18144
|
-
if (this.element.querySelector('#' + this.element.id + '
|
|
18145
|
-
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '
|
|
18210
|
+
if (this.element.querySelector('#' + this.element.id + '_toolbarArea')) {
|
|
18211
|
+
this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
|
|
18146
18212
|
}
|
|
18147
18213
|
else {
|
|
18148
18214
|
this.toolbarHeight = 0;
|
|
@@ -18742,9 +18808,6 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
18742
18808
|
case 'getCanvasFilter':
|
|
18743
18809
|
args.value['obj']['canvasFilter'] = parent.canvasFilter;
|
|
18744
18810
|
break;
|
|
18745
|
-
case 'setCanvasFilter':
|
|
18746
|
-
parent.canvasFilter = args.value['filter'];
|
|
18747
|
-
break;
|
|
18748
18811
|
case 'getDefToolbarItems':
|
|
18749
18812
|
args.value['obj']['defToolbarItems'] = this.defToolbarItems;
|
|
18750
18813
|
break;
|
|
@@ -20150,7 +20213,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
20150
20213
|
if (!parent.isImageLoaded || parent.isCropToolbar) {
|
|
20151
20214
|
return;
|
|
20152
20215
|
}
|
|
20153
|
-
var
|
|
20216
|
+
var item = type === 'shapes' && parent.activeObj.shape ? parent.activeObj.shape : type;
|
|
20217
|
+
var args = { toolbarType: item };
|
|
20154
20218
|
if (type !== 'filter' && type !== 'color') {
|
|
20155
20219
|
if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
|
|
20156
20220
|
getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
|
|
@@ -21366,7 +21430,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
21366
21430
|
var parent = this.parent;
|
|
21367
21431
|
if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
|
|
21368
21432
|
parent.currObjType.isFiltered) {
|
|
21369
|
-
parent.initialAdjustmentValue =
|
|
21433
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
21434
|
+
parent.canvasFilter = this.lowerContext.filter;
|
|
21370
21435
|
parent.currObjType.isFiltered = false;
|
|
21371
21436
|
}
|
|
21372
21437
|
};
|