@syncfusion/ej2-image-editor 23.2.7 → 24.1.43
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 +6 -54
- 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 +7227 -4367
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +7295 -4422
- 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 +12 -12
- package/src/image-editor/action/crop.d.ts +6 -0
- package/src/image-editor/action/crop.js +347 -188
- package/src/image-editor/action/draw.d.ts +35 -2
- package/src/image-editor/action/draw.js +1691 -890
- package/src/image-editor/action/export.js +90 -29
- package/src/image-editor/action/filter.d.ts +3 -1
- package/src/image-editor/action/filter.js +74 -94
- package/src/image-editor/action/freehand-draw.d.ts +4 -0
- package/src/image-editor/action/freehand-draw.js +248 -147
- package/src/image-editor/action/selection.d.ts +6 -1
- package/src/image-editor/action/selection.js +1133 -1091
- package/src/image-editor/action/shape.d.ts +7 -0
- package/src/image-editor/action/shape.js +923 -550
- package/src/image-editor/action/transform.d.ts +2 -0
- package/src/image-editor/action/transform.js +518 -346
- package/src/image-editor/action/undo-redo.d.ts +2 -0
- package/src/image-editor/action/undo-redo.js +137 -36
- package/src/image-editor/base/enum.d.ts +2 -1
- package/src/image-editor/base/enum.js +1 -0
- package/src/image-editor/base/image-editor-model.d.ts +37 -2
- package/src/image-editor/base/image-editor.d.ts +124 -3
- package/src/image-editor/base/image-editor.js +675 -172
- package/src/image-editor/base/interface.d.ts +69 -15
- package/src/image-editor/renderer/toolbar.d.ts +10 -0
- package/src/image-editor/renderer/toolbar.js +1415 -835
- package/styles/bootstrap-dark.css +113 -8
- package/styles/bootstrap.css +112 -7
- package/styles/bootstrap4.css +113 -8
- package/styles/bootstrap5-dark.css +113 -8
- package/styles/bootstrap5.css +113 -8
- package/styles/fabric-dark.css +114 -9
- package/styles/fabric.css +113 -8
- package/styles/fluent-dark.css +118 -9
- package/styles/fluent.css +118 -9
- package/styles/highcontrast-light.css +112 -7
- package/styles/highcontrast.css +116 -7
- package/styles/image-editor/_bootstrap-dark-definition.scss +3 -0
- package/styles/image-editor/_bootstrap-definition.scss +3 -0
- package/styles/image-editor/_bootstrap4-definition.scss +3 -0
- package/styles/image-editor/_bootstrap5-definition.scss +3 -0
- package/styles/image-editor/_fabric-dark-definition.scss +3 -0
- package/styles/image-editor/_fabric-definition.scss +3 -0
- package/styles/image-editor/_fluent-definition.scss +3 -0
- package/styles/image-editor/_fusionnew-definition.scss +3 -0
- package/styles/image-editor/_highcontrast-definition.scss +3 -0
- package/styles/image-editor/_highcontrast-light-definition.scss +3 -0
- package/styles/image-editor/_layout.scss +138 -4
- package/styles/image-editor/_material-dark-definition.scss +3 -0
- package/styles/image-editor/_material-definition.scss +3 -0
- package/styles/image-editor/_material3-definition.scss +3 -0
- package/styles/image-editor/_tailwind-definition.scss +3 -0
- package/styles/image-editor/_theme.scss +2 -4
- package/styles/image-editor/bootstrap-dark.css +113 -8
- package/styles/image-editor/bootstrap.css +112 -7
- package/styles/image-editor/bootstrap4.css +113 -8
- package/styles/image-editor/bootstrap5-dark.css +113 -8
- package/styles/image-editor/bootstrap5.css +113 -8
- package/styles/image-editor/fabric-dark.css +114 -9
- package/styles/image-editor/fabric.css +113 -8
- package/styles/image-editor/fluent-dark.css +118 -9
- package/styles/image-editor/fluent.css +118 -9
- package/styles/image-editor/highcontrast-light.css +112 -7
- package/styles/image-editor/highcontrast.css +116 -7
- package/styles/image-editor/icons/_bootstrap-dark.scss +60 -0
- package/styles/image-editor/icons/_bootstrap.scss +60 -0
- package/styles/image-editor/icons/_bootstrap4.scss +60 -0
- package/styles/image-editor/icons/_bootstrap5.scss +60 -0
- package/styles/image-editor/icons/_fabric-dark.scss +60 -0
- package/styles/image-editor/icons/_fabric.scss +60 -0
- package/styles/image-editor/icons/_fluent.scss +66 -0
- package/styles/image-editor/icons/_highcontrast-light.scss +60 -0
- package/styles/image-editor/icons/_highcontrast.scss +60 -0
- package/styles/image-editor/icons/_material-dark.scss +60 -0
- package/styles/image-editor/icons/_material.scss +60 -0
- package/styles/image-editor/icons/_material3.scss +60 -0
- package/styles/image-editor/icons/_tailwind.scss +60 -0
- package/styles/image-editor/material-dark.css +113 -8
- package/styles/image-editor/material.css +113 -8
- package/styles/image-editor/material3-dark.css +126 -9
- package/styles/image-editor/material3.css +126 -9
- package/styles/image-editor/tailwind-dark.css +114 -9
- package/styles/image-editor/tailwind.css +114 -9
- package/styles/material-dark.css +113 -8
- package/styles/material.css +113 -8
- package/styles/material3-dark.css +126 -9
- package/styles/material3.css +126 -9
- package/styles/tailwind-dark.css +114 -9
- package/styles/tailwind.css +114 -9
|
@@ -98,9 +98,6 @@ var Transform = /** @class */ (function () {
|
|
|
98
98
|
case 'calcMaxDimension':
|
|
99
99
|
this.calcMaxDimension(args.value['width'], args.value['height'], args.value['obj'], args.value['isImgShape']);
|
|
100
100
|
break;
|
|
101
|
-
case 'updatePanPoints':
|
|
102
|
-
this.updatePanPoints(args.value['panRegion'], args.value['obj']);
|
|
103
|
-
break;
|
|
104
101
|
case 'getPanMove':
|
|
105
102
|
args.value['obj']['panMove'] = this.panMove;
|
|
106
103
|
break;
|
|
@@ -167,12 +164,18 @@ var Transform = /** @class */ (function () {
|
|
|
167
164
|
case 'resize':
|
|
168
165
|
this.resize(args.value['width'], args.value['height'], args.value['isAspectRatio']);
|
|
169
166
|
break;
|
|
170
|
-
case '
|
|
171
|
-
this.
|
|
167
|
+
case 'straightenImage':
|
|
168
|
+
this.straightenImage(args.value['degree']);
|
|
172
169
|
break;
|
|
173
170
|
case 'reset':
|
|
174
171
|
this.reset();
|
|
175
172
|
break;
|
|
173
|
+
case 'cropZoom':
|
|
174
|
+
args.value['obj']['maxDimension'] = this.cropZoom(args.value['value'], args.value['selectionObj']);
|
|
175
|
+
break;
|
|
176
|
+
case 'setResizedImgAngle':
|
|
177
|
+
this.resizedImgAngle = args.value['angle'];
|
|
178
|
+
break;
|
|
176
179
|
}
|
|
177
180
|
};
|
|
178
181
|
Transform.prototype.getModuleName = function () {
|
|
@@ -206,7 +209,7 @@ var Transform = /** @class */ (function () {
|
|
|
206
209
|
currentDegree: Math.abs(parent.transform.degree + degree) === 360 ? 0 : parent.transform.degree + degree };
|
|
207
210
|
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
|
|
208
211
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
209
|
-
parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'OnRotate', transitionArgs).then(function (args) {
|
|
212
|
+
parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'OnRotate', transitionArgs, null).then(function (args) {
|
|
210
213
|
_this.rotateEvent(args, degree);
|
|
211
214
|
});
|
|
212
215
|
}
|
|
@@ -229,8 +232,7 @@ var Transform = /** @class */ (function () {
|
|
|
229
232
|
prevObj.pointColl = extend({}, parent.pointColl, null, true);
|
|
230
233
|
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
231
234
|
var selPointCollObj = { selPointColl: null };
|
|
232
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
233
|
-
value: { obj: selPointCollObj } });
|
|
235
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
|
|
234
236
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
235
237
|
}
|
|
236
238
|
parent.afterCropActions.push(degree === 90 ? 'rotateRight' : 'rotateLeft');
|
|
@@ -270,6 +272,7 @@ var Transform = /** @class */ (function () {
|
|
|
270
272
|
value: { collection: parent.rotateFlipColl, isRotateFlipCollection: true, obj: obj } });
|
|
271
273
|
parent.rotateFlipColl = obj['collection'];
|
|
272
274
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
275
|
+
parent.notify('draw', { prop: 'setIsCropSelect', value: { bool: true } });
|
|
273
276
|
this.isPreventSelect = true;
|
|
274
277
|
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
275
278
|
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
@@ -277,6 +280,21 @@ var Transform = /** @class */ (function () {
|
|
|
277
280
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
278
281
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
279
282
|
}
|
|
283
|
+
transitionArgs = { previousDegree: transitionArgs.previousDegree, currentDegree: transitionArgs.currentDegree };
|
|
284
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.rotated.hasDelegate === true) {
|
|
285
|
+
var rotatedArgs = { degree: transitionArgs.currentDegree };
|
|
286
|
+
parent.dotNetRef.invokeMethodAsync('RotateEventAsync', 'Rotated', null, rotatedArgs);
|
|
287
|
+
}
|
|
288
|
+
else if (!this.isPreventSelect) { }
|
|
289
|
+
if (isBlazor() && parent.events && parent.events.rotating.hasDelegate === true) {
|
|
290
|
+
parent.notify('draw', { prop: 'resetStraightenDestPoints' });
|
|
291
|
+
parent.notify('draw', { prop: 'setDestForStraighten' });
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: parent.prevEventObjPoint } });
|
|
296
|
+
parent.activeObj = parent.prevEventSelectionPoint;
|
|
297
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
280
298
|
}
|
|
281
299
|
};
|
|
282
300
|
Transform.prototype.drawRotatedImage = function (degree) {
|
|
@@ -356,14 +374,9 @@ var Transform = /** @class */ (function () {
|
|
|
356
374
|
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
357
375
|
parent.objColl[0] = parent.activeObj;
|
|
358
376
|
}
|
|
359
|
-
parent.img
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
parent.img.srcHeight = parent.baseImgCanvas.height;
|
|
363
|
-
parent.img.destLeft = this.currDestPoint.startX;
|
|
364
|
-
parent.img.destTop = this.currDestPoint.startY;
|
|
365
|
-
parent.img.destWidth = this.currDestPoint.width;
|
|
366
|
-
parent.img.destHeight = this.currDestPoint.height;
|
|
377
|
+
parent.img = { srcLeft: 0, srcTop: 0, srcWidth: parent.baseImgCanvas.width, srcHeight: parent.baseImgCanvas.height,
|
|
378
|
+
destLeft: this.currDestPoint.startX, destTop: this.currDestPoint.startY, destWidth: this.currDestPoint.width,
|
|
379
|
+
destHeight: this.currDestPoint.height };
|
|
367
380
|
if (typeof (degree) === 'number') {
|
|
368
381
|
parent.notify('draw', { prop: 'setDestPoints', onPropertyChange: false });
|
|
369
382
|
parent.notify('draw', { prop: 'setClientTransDim', onPropertyChange: false,
|
|
@@ -375,14 +388,8 @@ var Transform = /** @class */ (function () {
|
|
|
375
388
|
height: parent.img.destHeight };
|
|
376
389
|
parent.objColl = objColl;
|
|
377
390
|
parent.activeObj = activeObj;
|
|
378
|
-
parent.img
|
|
379
|
-
|
|
380
|
-
parent.img.srcWidth = srcPoints.width;
|
|
381
|
-
parent.img.srcHeight = srcPoints.height;
|
|
382
|
-
parent.img.destLeft = destPoints.startX;
|
|
383
|
-
parent.img.destTop = destPoints.startY;
|
|
384
|
-
parent.img.destWidth = destPoints.width;
|
|
385
|
-
parent.img.destHeight = destPoints.height;
|
|
391
|
+
parent.img = { srcLeft: srcPoints.startX, srcTop: srcPoints.startY, srcWidth: srcPoints.width, srcHeight: srcPoints.height,
|
|
392
|
+
destLeft: destPoints.startX, destTop: destPoints.startY, destWidth: destPoints.width, destHeight: destPoints.height };
|
|
386
393
|
}
|
|
387
394
|
};
|
|
388
395
|
Transform.prototype.flipImage = function (direction) {
|
|
@@ -392,7 +399,7 @@ var Transform = /** @class */ (function () {
|
|
|
392
399
|
previousDirection: parent.toPascalCase(parent.transform.currFlipState || direction) };
|
|
393
400
|
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipping.hasDelegate === true) {
|
|
394
401
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
395
|
-
parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'OnFlip', transitionArgs).then(function (args) {
|
|
402
|
+
parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'OnFlip', transitionArgs, null).then(function (args) {
|
|
396
403
|
_this.flipEvent(args, direction);
|
|
397
404
|
});
|
|
398
405
|
}
|
|
@@ -406,6 +413,9 @@ var Transform = /** @class */ (function () {
|
|
|
406
413
|
Transform.prototype.flipEvent = function (transitionArgs, direction) {
|
|
407
414
|
var parent = this.parent;
|
|
408
415
|
if (transitionArgs.cancel) {
|
|
416
|
+
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: parent.prevEventObjPoint } });
|
|
417
|
+
parent.activeObj = parent.prevEventSelectionPoint;
|
|
418
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
409
419
|
return;
|
|
410
420
|
}
|
|
411
421
|
var prevObj;
|
|
@@ -449,12 +459,9 @@ var Transform = /** @class */ (function () {
|
|
|
449
459
|
}
|
|
450
460
|
var lowercaseDirection = direction.toLowerCase();
|
|
451
461
|
this.updateFlipState(lowercaseDirection);
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
else {
|
|
456
|
-
parent.transform.currFlipState = (parent.transform.currFlipState.toLowerCase() === 'vertical') ? '' : 'vertical';
|
|
457
|
-
}
|
|
462
|
+
var flipState = parent.transform.currFlipState.toLowerCase();
|
|
463
|
+
parent.transform.currFlipState = (lowercaseDirection === 'horizontal' && flipState === 'horizontal') ||
|
|
464
|
+
(lowercaseDirection === 'vertical' && flipState === 'vertical') ? '' : lowercaseDirection;
|
|
458
465
|
var selObj = { isSelected: null };
|
|
459
466
|
parent.notify('draw', { prop: 'getRotatedFlipCropSelection', onPropertyChange: false, value: { bool: selObj } });
|
|
460
467
|
if (selObj['isSelected']) {
|
|
@@ -507,9 +514,10 @@ var Transform = /** @class */ (function () {
|
|
|
507
514
|
this.lowerContext.filter = 'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
508
515
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
509
516
|
parent.notify('shape', { prop: 'iterateObjColl', onPropertyChange: false });
|
|
510
|
-
|
|
517
|
+
var dir = direction.toLowerCase();
|
|
518
|
+
if (dir === 'horizontal' || dir === 'vertical') {
|
|
511
519
|
parent.notify('freehand-draw', { prop: 'flipFHDColl', onPropertyChange: false,
|
|
512
|
-
value: { value:
|
|
520
|
+
value: { value: dir } });
|
|
513
521
|
parent.notify('freehand-draw', { prop: 'freehandRedraw', onPropertyChange: false,
|
|
514
522
|
value: { context: this.lowerContext, points: null } });
|
|
515
523
|
}
|
|
@@ -519,7 +527,7 @@ var Transform = /** @class */ (function () {
|
|
|
519
527
|
}
|
|
520
528
|
this.lowerContext.filter = tempFilter;
|
|
521
529
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
522
|
-
this.updateCurrSelectionPoint(
|
|
530
|
+
this.updateCurrSelectionPoint(dir);
|
|
523
531
|
parent.isUndoRedo = false;
|
|
524
532
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
525
533
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
@@ -538,6 +546,7 @@ var Transform = /** @class */ (function () {
|
|
|
538
546
|
value: { collection: parent.rotateFlipColl, isRotateFlipCollection: true, obj: obj } });
|
|
539
547
|
parent.rotateFlipColl = obj['collection'];
|
|
540
548
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
549
|
+
parent.notify('draw', { prop: 'setIsCropSelect', value: { bool: true } });
|
|
541
550
|
this.isPreventSelect = true;
|
|
542
551
|
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
543
552
|
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
@@ -545,6 +554,12 @@ var Transform = /** @class */ (function () {
|
|
|
545
554
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
546
555
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
547
556
|
}
|
|
557
|
+
transitionArgs = { previousDirection: transitionArgs.previousDirection, direction: transitionArgs.direction };
|
|
558
|
+
if (!this.isPreventSelect && isBlazor() && parent.events && parent.events.flipped.hasDelegate === true) {
|
|
559
|
+
var flipped = { direction: transitionArgs.direction };
|
|
560
|
+
parent.dotNetRef.invokeMethodAsync('FlipEventAsync', 'Flipped', null, flipped);
|
|
561
|
+
}
|
|
562
|
+
else { }
|
|
548
563
|
};
|
|
549
564
|
Transform.prototype.updateFlipState = function (direction) {
|
|
550
565
|
var degree = this.parent.transform.degree;
|
|
@@ -600,22 +615,24 @@ var Transform = /** @class */ (function () {
|
|
|
600
615
|
Transform.prototype.setDestPointsForFlipState = function () {
|
|
601
616
|
var parent = this.parent;
|
|
602
617
|
var panObj = { panRegion: '' };
|
|
618
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
619
|
+
var _b = parent.lowerCanvas, clientWidth = _b.clientWidth, clientHeight = _b.clientHeight;
|
|
603
620
|
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false,
|
|
604
621
|
value: { panObj: panObj } });
|
|
605
622
|
if (panObj['panRegion'] !== '') {
|
|
606
623
|
if (panObj['panRegion'] === 'horizontal') {
|
|
607
|
-
parent.img.destLeft =
|
|
624
|
+
parent.img.destLeft = clientWidth - (destWidth + destLeft);
|
|
608
625
|
}
|
|
609
626
|
else if (panObj['panRegion'] === 'vertical') {
|
|
610
|
-
parent.img.destTop =
|
|
627
|
+
parent.img.destTop = clientHeight - (destHeight + destTop);
|
|
611
628
|
}
|
|
612
629
|
else {
|
|
613
|
-
parent.img.destLeft =
|
|
614
|
-
parent.img.destTop =
|
|
630
|
+
parent.img.destLeft = clientWidth - (destWidth + destLeft);
|
|
631
|
+
parent.img.destTop = clientHeight - (destHeight + destTop);
|
|
615
632
|
}
|
|
616
633
|
}
|
|
617
634
|
};
|
|
618
|
-
Transform.prototype.zoomAction = function (zoomFactor, zoomPoint, isResize) {
|
|
635
|
+
Transform.prototype.zoomAction = function (zoomFactor, zoomPoint, isResize, isPreventApply) {
|
|
619
636
|
var _this = this;
|
|
620
637
|
var parent = this.parent;
|
|
621
638
|
if (!parent.disabled && parent.isImageLoaded) {
|
|
@@ -680,19 +697,18 @@ var Transform = /** @class */ (function () {
|
|
|
680
697
|
var previousZoomFactor = parent.zoomSettings.zoomFactor - (zoomFactor * 10);
|
|
681
698
|
var zoomEventArgs = { zoomPoint: zoomPoint, cancel: false, previousZoomFactor: previousZoomFactor,
|
|
682
699
|
currentZoomFactor: parent.zoomSettings.zoomFactor, zoomTrigger: obj['zoomType'] };
|
|
683
|
-
if (isBlazor() &&
|
|
684
|
-
&& parent.events && parent.events.zooming.hasDelegate === true) {
|
|
700
|
+
if (!parent.isCropToolbar && isBlazor() && parent.isZoomBtnClick && parent.events && parent.events.zooming.hasDelegate === true) {
|
|
685
701
|
zoomEventArgs.zoomTrigger = parseInt(this.getZoomTriggerType(zoomEventArgs.zoomTrigger));
|
|
686
702
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
687
|
-
parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs).then(function (args) {
|
|
688
|
-
_this.zoomEvent(args, zoomFactor);
|
|
703
|
+
parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'OnZoom', zoomEventArgs, null).then(function (args) {
|
|
704
|
+
_this.zoomEvent(args, zoomFactor, isPreventApply);
|
|
689
705
|
});
|
|
690
706
|
}
|
|
691
707
|
else {
|
|
692
|
-
if (!parent.isCropToolbar) {
|
|
708
|
+
if (!parent.isCropToolbar && parent.isZoomBtnClick) {
|
|
693
709
|
parent.trigger('zooming', zoomEventArgs);
|
|
694
710
|
}
|
|
695
|
-
this.zoomEvent(zoomEventArgs, zoomFactor);
|
|
711
|
+
this.zoomEvent(zoomEventArgs, zoomFactor, isPreventApply);
|
|
696
712
|
}
|
|
697
713
|
}
|
|
698
714
|
};
|
|
@@ -708,29 +724,31 @@ var Transform = /** @class */ (function () {
|
|
|
708
724
|
return '8';
|
|
709
725
|
}
|
|
710
726
|
};
|
|
711
|
-
Transform.prototype.zoomEvent = function (zoomEventArgs,
|
|
727
|
+
Transform.prototype.zoomEvent = function (zoomEventArgs, zoomFact, isPreventApply) {
|
|
712
728
|
var parent = this.parent;
|
|
729
|
+
var _a = parent.zoomSettings, zoomFactor = _a.zoomFactor, minZoomFactor = _a.minZoomFactor;
|
|
713
730
|
if (zoomEventArgs.cancel) {
|
|
731
|
+
parent.isZoomBtnClick = false;
|
|
714
732
|
return;
|
|
715
733
|
}
|
|
716
734
|
if (!isBlazor()) {
|
|
717
735
|
parent.notify('toolbar', { prop: 'close-contextual-toolbar', onPropertyChange: false });
|
|
736
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
718
737
|
}
|
|
719
|
-
else if (parent.currentToolbar !== 'resize-toolbar' && parent.element.querySelector('.e-contextual-toolbar-wrapper') && !parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hidden')) {
|
|
738
|
+
else if ((parent.currentToolbar !== 'resize-toolbar' && parent.currentToolbar !== 'crop-toolbar') && parent.element.querySelector('.e-contextual-toolbar-wrapper') && !parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.contains('e-hidden')) {
|
|
720
739
|
parent.updateToolbar(parent.element, 'closeContextualToolbar');
|
|
721
740
|
}
|
|
722
741
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
723
742
|
value: { x: null, y: null, isMouseDown: true } });
|
|
724
743
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
725
744
|
this.upperContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
726
|
-
var object = { canvasFilter:
|
|
745
|
+
var object = { canvasFilter: parent.canvasFilter };
|
|
727
746
|
this.lowerContext.filter = object['canvasFilter'];
|
|
728
747
|
parent.upperCanvas.style.cursor = parent.cursor = 'default';
|
|
729
748
|
var objColl = extend([], parent.objColl, [], true);
|
|
730
749
|
if (!parent.isCropTab) {
|
|
731
750
|
if (parent.transform.degree !== 0) {
|
|
732
|
-
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
733
|
-
value: { x: null, y: null, isMouseDown: null } });
|
|
751
|
+
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false, value: { x: null, y: null, isMouseDown: null } });
|
|
734
752
|
parent.panPoint.currentPannedPoint = { x: 0, y: 0 };
|
|
735
753
|
var temp = parent.allowDownScale;
|
|
736
754
|
parent.allowDownScale = false;
|
|
@@ -740,13 +758,14 @@ var Transform = /** @class */ (function () {
|
|
|
740
758
|
else if (parent.transform.currFlipState !== '') {
|
|
741
759
|
parent.panPoint.totalPannedPoint = { x: 0, y: 0 };
|
|
742
760
|
}
|
|
743
|
-
parent.
|
|
761
|
+
if (parent.transform.straighten === 0 && !this.isPreventSelect) {
|
|
762
|
+
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
763
|
+
}
|
|
744
764
|
}
|
|
745
765
|
if (parent.transform.degree === 0) {
|
|
746
|
-
this.drawZoomImgToCanvas(
|
|
766
|
+
this.drawZoomImgToCanvas(zoomFact, this.tempActiveObj);
|
|
747
767
|
var panObj_1 = { panRegion: '' };
|
|
748
|
-
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false,
|
|
749
|
-
value: { panObj: panObj_1 } });
|
|
768
|
+
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false, value: { panObj: panObj_1 } });
|
|
750
769
|
if (panObj_1['panRegion'] !== '') {
|
|
751
770
|
parent.notify('crop', { prop: 'setTempFlipPanPoint', onPropertyChange: false, value: { point: parent.panPoint.totalPannedPoint, isAdd: true } });
|
|
752
771
|
objColl = extend([], parent.objColl, [], true);
|
|
@@ -758,44 +777,46 @@ var Transform = /** @class */ (function () {
|
|
|
758
777
|
parent.img.destLeft = destLeft;
|
|
759
778
|
parent.img.destTop = destTop;
|
|
760
779
|
parent.objColl = objColl;
|
|
761
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply:
|
|
762
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply:
|
|
763
|
-
parent.
|
|
780
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
781
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
782
|
+
if (parent.transform.straighten === 0 && !this.isPreventSelect) {
|
|
783
|
+
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
784
|
+
}
|
|
764
785
|
}
|
|
765
|
-
if (
|
|
786
|
+
if (zoomFactor <= minZoomFactor && !parent.isCropTab) {
|
|
766
787
|
parent.panPoint.totalPannedPoint = { x: 0, y: 0 };
|
|
767
788
|
}
|
|
768
789
|
}
|
|
769
790
|
else {
|
|
770
|
-
parent.
|
|
791
|
+
if (parent.transform.straighten === 0 && !this.isPreventSelect) {
|
|
792
|
+
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
793
|
+
}
|
|
771
794
|
parent.panPoint.totalPannedClientPoint = { x: 0, y: 0 };
|
|
772
795
|
parent.panPoint.totalPannedInternalPoint = { x: 0, y: 0 };
|
|
773
|
-
this.rotateZoom(
|
|
796
|
+
this.rotateZoom(zoomFact);
|
|
774
797
|
var panObj_2 = { panRegion: '' };
|
|
775
|
-
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false,
|
|
776
|
-
value: { panObj: panObj_2 } });
|
|
798
|
+
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false, value: { panObj: panObj_2 } });
|
|
777
799
|
if (panObj_2['panRegion'] !== '') {
|
|
778
800
|
var temp = this.lowerContext.filter;
|
|
779
801
|
this.lowerContext.filter = 'none';
|
|
780
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply:
|
|
781
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply:
|
|
802
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
803
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
782
804
|
this.lowerContext.filter = temp;
|
|
783
805
|
}
|
|
784
806
|
}
|
|
785
807
|
var powerOften = Math.pow(10, 1);
|
|
786
|
-
if (
|
|
808
|
+
if (zoomFactor <= minZoomFactor ||
|
|
787
809
|
(Math.round(parent.transform.zoomFactor * powerOften) / powerOften) === 2) {
|
|
788
810
|
clearInterval(this.zoomBtnHold);
|
|
789
811
|
this.zoomBtnHold = 0;
|
|
790
812
|
}
|
|
791
813
|
var panObj = { panRegion: '' };
|
|
792
|
-
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false,
|
|
793
|
-
value: { panObj: panObj } });
|
|
814
|
+
parent.notify('crop', { prop: 'getCurrFlipState', onPropertyChange: false, value: { panObj: panObj } });
|
|
794
815
|
if (panObj['panRegion'] === '') {
|
|
795
816
|
var temp = this.lowerContext.filter;
|
|
796
817
|
this.lowerContext.filter = 'none';
|
|
797
|
-
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply:
|
|
798
|
-
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply:
|
|
818
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
819
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
799
820
|
this.lowerContext.filter = temp;
|
|
800
821
|
}
|
|
801
822
|
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
@@ -807,7 +828,7 @@ var Transform = /** @class */ (function () {
|
|
|
807
828
|
if (this.tempActiveObj) {
|
|
808
829
|
parent.activeObj = extend({}, this.tempActiveObj, {}, true);
|
|
809
830
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
|
|
810
|
-
if (
|
|
831
|
+
if (zoomFactor <= minZoomFactor) {
|
|
811
832
|
parent.currSelectionPoint = null;
|
|
812
833
|
}
|
|
813
834
|
}
|
|
@@ -815,7 +836,7 @@ var Transform = /** @class */ (function () {
|
|
|
815
836
|
var zoomOut;
|
|
816
837
|
if (!isBlazor()) {
|
|
817
838
|
zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
|
|
818
|
-
if (zoomOut &&
|
|
839
|
+
if (zoomOut && zoomFactor <= minZoomFactor) {
|
|
819
840
|
zoomOut.classList.add('e-disabled');
|
|
820
841
|
zoomOut.parentElement.classList.add('e-overlay');
|
|
821
842
|
}
|
|
@@ -826,7 +847,7 @@ var Transform = /** @class */ (function () {
|
|
|
826
847
|
}
|
|
827
848
|
else {
|
|
828
849
|
zoomOut = parent.element.querySelector('#zoomout');
|
|
829
|
-
if (zoomOut &&
|
|
850
|
+
if (zoomOut && zoomFactor <= minZoomFactor) {
|
|
830
851
|
zoomOut.classList.add('e-overlay');
|
|
831
852
|
}
|
|
832
853
|
else if (zoomOut) {
|
|
@@ -864,49 +885,89 @@ var Transform = /** @class */ (function () {
|
|
|
864
885
|
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
865
886
|
}
|
|
866
887
|
parent.notify('selection', { prop: 'setZoomType', onPropertyChange: false, value: { zoomType: 'Toolbar' } });
|
|
888
|
+
zoomEventArgs = { zoomPoint: zoomEventArgs.zoomPoint, previousZoomFactor: zoomEventArgs.previousZoomFactor, currentZoomFactor: zoomEventArgs.currentZoomFactor, zoomTrigger: zoomEventArgs.zoomTrigger };
|
|
889
|
+
if (isBlazor() && !parent.isCropToolbar && parent.isZoomBtnClick && parent.events && parent.events.zoomed.hasDelegate === true) {
|
|
890
|
+
zoomEventArgs.zoomTrigger = typeof zoomEventArgs.zoomTrigger !== 'number' ? parseInt(this.getZoomTriggerType(zoomEventArgs.zoomTrigger)) : zoomEventArgs.zoomTrigger;
|
|
891
|
+
var zoomedArgs = { zoomPoint: zoomEventArgs.zoomPoint, zoomFactor: zoomEventArgs.currentZoomFactor, zoomTrigger: zoomEventArgs.zoomTrigger };
|
|
892
|
+
parent.dotNetRef.invokeMethodAsync('ZoomEventAsync', 'Zoomed', null, zoomedArgs);
|
|
893
|
+
parent.isZoomBtnClick = false;
|
|
894
|
+
}
|
|
895
|
+
else if (!parent.isCropToolbar && parent.isZoomBtnClick) {
|
|
896
|
+
parent.isZoomBtnClick = false;
|
|
897
|
+
}
|
|
867
898
|
};
|
|
868
899
|
Transform.prototype.disableZoomOutBtn = function (isZoomOut) {
|
|
869
900
|
var parent = this.parent;
|
|
901
|
+
var _a = parent.zoomSettings, zoomFactor = _a.zoomFactor, minZoomFactor = _a.minZoomFactor;
|
|
870
902
|
var isDisabled = false;
|
|
871
903
|
var zoomOut;
|
|
872
904
|
if (!isNullOrUndefined(isZoomOut)) {
|
|
873
905
|
parent.transform.zoomFactor -= 0.1;
|
|
874
906
|
}
|
|
875
|
-
if (
|
|
876
|
-
zoomOut =
|
|
907
|
+
if (isBlazor()) {
|
|
908
|
+
zoomOut = parent.element.querySelector('#zoomout');
|
|
877
909
|
}
|
|
878
910
|
else {
|
|
879
|
-
zoomOut =
|
|
911
|
+
zoomOut = parent.element.querySelector('#' + parent.element.id + '_zoomOut');
|
|
880
912
|
}
|
|
881
|
-
var
|
|
882
|
-
|
|
883
|
-
var destWidth = parent.img.destWidth;
|
|
884
|
-
var destHeight = parent.img.destHeight;
|
|
913
|
+
var destPoints = { destLeft: parent.img.destLeft, destTop: parent.img.destTop,
|
|
914
|
+
destWidth: parent.img.destWidth, destHeight: parent.img.destHeight };
|
|
885
915
|
if (parent.activeObj.shape) {
|
|
886
|
-
this.setZoomDimension(-0.1, parent.activeObj);
|
|
916
|
+
var maxDimension = this.setZoomDimension(-0.1, parent.activeObj);
|
|
887
917
|
if (!isNullOrUndefined(zoomOut)) {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
parent.img.
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
918
|
+
var actPoint = parent.activeObj.activePoint;
|
|
919
|
+
if (parent.transform.straighten === 0) {
|
|
920
|
+
if (parent.img.destLeft > actPoint.startX || parent.img.destTop >
|
|
921
|
+
actPoint.startY || parent.img.destLeft + parent.img.destWidth <
|
|
922
|
+
actPoint.endX || parent.img.destTop + parent.img.destHeight < actPoint.endY
|
|
923
|
+
|| zoomFactor === minZoomFactor) {
|
|
924
|
+
if (!isBlazor()) {
|
|
925
|
+
zoomOut.classList.add('e-disabled');
|
|
926
|
+
zoomOut.parentElement.classList.add('e-overlay');
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
zoomOut.classList.add('e-overlay');
|
|
930
|
+
}
|
|
931
|
+
isDisabled = true;
|
|
895
932
|
}
|
|
896
933
|
else {
|
|
897
|
-
|
|
934
|
+
if (!isBlazor()) {
|
|
935
|
+
zoomOut.classList.remove('e-disabled');
|
|
936
|
+
zoomOut.parentElement.classList.remove('e-overlay');
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
zoomOut.classList.remove('e-overlay');
|
|
940
|
+
}
|
|
941
|
+
isDisabled = false;
|
|
898
942
|
}
|
|
899
|
-
isDisabled = true;
|
|
900
943
|
}
|
|
901
944
|
else {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
945
|
+
parent.img.destWidth = maxDimension.width;
|
|
946
|
+
parent.img.destHeight = maxDimension.height;
|
|
947
|
+
var obj = { isIntersect: null };
|
|
948
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
949
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
|
|
950
|
+
if (obj['isIntersect'] ||
|
|
951
|
+
zoomFactor === minZoomFactor) {
|
|
952
|
+
if (!isBlazor()) {
|
|
953
|
+
zoomOut.classList.add('e-disabled');
|
|
954
|
+
zoomOut.parentElement.classList.add('e-overlay');
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
zoomOut.classList.add('e-overlay');
|
|
958
|
+
}
|
|
959
|
+
isDisabled = true;
|
|
905
960
|
}
|
|
906
961
|
else {
|
|
907
|
-
|
|
962
|
+
if (!isBlazor()) {
|
|
963
|
+
zoomOut.classList.remove('e-disabled');
|
|
964
|
+
zoomOut.parentElement.classList.remove('e-overlay');
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
zoomOut.classList.remove('e-overlay');
|
|
968
|
+
}
|
|
969
|
+
isDisabled = false;
|
|
908
970
|
}
|
|
909
|
-
isDisabled = false;
|
|
910
971
|
}
|
|
911
972
|
}
|
|
912
973
|
}
|
|
@@ -916,16 +977,17 @@ var Transform = /** @class */ (function () {
|
|
|
916
977
|
if (!isNullOrUndefined(isZoomOut)) {
|
|
917
978
|
parent.transform.zoomFactor += 0.1;
|
|
918
979
|
}
|
|
919
|
-
parent.img.destLeft = destLeft;
|
|
920
|
-
parent.img.destTop = destTop;
|
|
921
|
-
parent.img.destWidth = destWidth;
|
|
922
|
-
parent.img.destHeight = destHeight;
|
|
980
|
+
parent.img.destLeft = destPoints['destLeft'];
|
|
981
|
+
parent.img.destTop = destPoints['destTop'];
|
|
982
|
+
parent.img.destWidth = destPoints['destWidth'];
|
|
983
|
+
parent.img.destHeight = destPoints['destHeight'];
|
|
923
984
|
return isDisabled;
|
|
924
985
|
};
|
|
925
986
|
Transform.prototype.drawZoomImgToCanvas = function (value, selectionObj) {
|
|
926
987
|
var parent = this.parent;
|
|
927
988
|
var powerOften = Math.pow(10, 1);
|
|
928
|
-
|
|
989
|
+
var zmFactor = Math.round(parent.transform.zoomFactor * powerOften) / powerOften;
|
|
990
|
+
if ((zmFactor === 0.1 && value === -0.1) || zmFactor === 0 && value === -0.025) {
|
|
929
991
|
parent.transform.zoomFactor = 0;
|
|
930
992
|
}
|
|
931
993
|
else {
|
|
@@ -941,7 +1003,7 @@ var Transform = /** @class */ (function () {
|
|
|
941
1003
|
maxDimension.width += (maxDimension.width * parent.transform.zoomFactor);
|
|
942
1004
|
maxDimension.height += (maxDimension.height * parent.transform.zoomFactor);
|
|
943
1005
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
944
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
1006
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
|
|
945
1007
|
}
|
|
946
1008
|
parent.notify('draw', { prop: 'draw-image-to-canvas', value: { dimension: maxDimension } });
|
|
947
1009
|
maxDimension.width = this.cropDimension.width;
|
|
@@ -984,7 +1046,8 @@ var Transform = /** @class */ (function () {
|
|
|
984
1046
|
Transform.prototype.rotateZoom = function (value) {
|
|
985
1047
|
var parent = this.parent;
|
|
986
1048
|
var powerOften = Math.pow(10, 1);
|
|
987
|
-
|
|
1049
|
+
var zmFactor = Math.round(parent.transform.zoomFactor * powerOften) / powerOften;
|
|
1050
|
+
if ((zmFactor === 0.1 && value === -0.1) || zmFactor === 0 && value === -0.025) {
|
|
988
1051
|
parent.transform.zoomFactor = 0;
|
|
989
1052
|
}
|
|
990
1053
|
else {
|
|
@@ -1018,14 +1081,15 @@ var Transform = /** @class */ (function () {
|
|
|
1018
1081
|
parent.notify('draw', { prop: 'setZoomCropWidth', value: { width: maxDimension.width, height: maxDimension.height } });
|
|
1019
1082
|
};
|
|
1020
1083
|
Transform.prototype.autoEnablePan = function () {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1084
|
+
var parent = this.parent;
|
|
1085
|
+
if (parent.transform.zoomFactor <= 0) {
|
|
1086
|
+
parent.togglePan = false;
|
|
1087
|
+
parent.notify('selection', { prop: 'setDragCanvas', value: { bool: false } });
|
|
1088
|
+
parent.pan(false);
|
|
1025
1089
|
this.disablePan = false;
|
|
1026
1090
|
}
|
|
1027
1091
|
else {
|
|
1028
|
-
|
|
1092
|
+
parent.pan(!this.disablePan);
|
|
1029
1093
|
}
|
|
1030
1094
|
};
|
|
1031
1095
|
Transform.prototype.cropZoom = function (value, selectionObj) {
|
|
@@ -1055,7 +1119,7 @@ var Transform = /** @class */ (function () {
|
|
|
1055
1119
|
parent.img.destTop = destTop - ((maxDimension.height - parent.img.destHeight) / 2);
|
|
1056
1120
|
destLeft = parent.img.destLeft;
|
|
1057
1121
|
destTop = parent.img.destTop;
|
|
1058
|
-
if (selectionObj) {
|
|
1122
|
+
if (selectionObj && parent.transform.straighten === 0) {
|
|
1059
1123
|
if (parent.img.destLeft > selectionObj.activePoint.startX) {
|
|
1060
1124
|
parent.img.destLeft = selectionObj.activePoint.startX;
|
|
1061
1125
|
if (parent.transform.degree === 0) {
|
|
@@ -1085,8 +1149,9 @@ var Transform = /** @class */ (function () {
|
|
|
1085
1149
|
};
|
|
1086
1150
|
Transform.prototype.setZoomDimension = function (value, selectionObj) {
|
|
1087
1151
|
var parent = this.parent;
|
|
1152
|
+
var degree = parent.transform.degree;
|
|
1088
1153
|
var maxDimension = { width: 0, height: 0 };
|
|
1089
|
-
if (
|
|
1154
|
+
if (degree % 90 === 0 && degree % 180 !== 0) {
|
|
1090
1155
|
maxDimension = this.calcMaxDimension(parent.img.srcHeight, parent.img.srcWidth);
|
|
1091
1156
|
}
|
|
1092
1157
|
else {
|
|
@@ -1139,9 +1204,9 @@ var Transform = /** @class */ (function () {
|
|
|
1139
1204
|
var obj = { panDown: null };
|
|
1140
1205
|
parent.notify('selection', { prop: 'getPanDown', onPropertyChange: false, value: { obj: obj } });
|
|
1141
1206
|
var panEventArgs = { startPoint: obj['panDown'], endPoint: this.panMove, cancel: false };
|
|
1142
|
-
if (isBlazor() && isNullOrUndefined(
|
|
1143
|
-
|
|
1144
|
-
|
|
1207
|
+
if (isBlazor() && isNullOrUndefined(parent.eventType) && parent.events && parent.events.onPanStart.hasDelegate === true) {
|
|
1208
|
+
parent.eventType = 'pan';
|
|
1209
|
+
parent.panEventArgs = panEventArgs;
|
|
1145
1210
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1146
1211
|
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanStart', panEventArgs).then(function (args) {
|
|
1147
1212
|
_this.panEvent(args, xDiff, yDiff);
|
|
@@ -1163,41 +1228,38 @@ var Transform = /** @class */ (function () {
|
|
|
1163
1228
|
}
|
|
1164
1229
|
if (isNullOrUndefined(parent.activeObj.shape)) {
|
|
1165
1230
|
isObjCreated = true;
|
|
1166
|
-
parent.activeObj.activePoint = { startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
1231
|
+
var actPoint = parent.activeObj.activePoint = { startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
1167
1232
|
endX: parent.img.destLeft + parent.img.destWidth, endY: parent.img.destTop + parent.img.destHeight };
|
|
1168
|
-
var startX =
|
|
1169
|
-
var startY =
|
|
1170
|
-
var endX =
|
|
1171
|
-
var endY =
|
|
1233
|
+
var startX = actPoint.startX;
|
|
1234
|
+
var startY = actPoint.startY;
|
|
1235
|
+
var endX = actPoint.endX;
|
|
1236
|
+
var endY = actPoint.endY;
|
|
1172
1237
|
if (startX < 0) {
|
|
1173
|
-
|
|
1238
|
+
actPoint.startX = 0;
|
|
1174
1239
|
}
|
|
1175
1240
|
if (startY < 0) {
|
|
1176
|
-
|
|
1241
|
+
actPoint.startY = 0;
|
|
1177
1242
|
}
|
|
1178
1243
|
if (endX > parent.lowerCanvas.width) {
|
|
1179
|
-
|
|
1180
|
-
parent.lowerCanvas.width;
|
|
1244
|
+
actPoint.endX = parent.lowerCanvas.width;
|
|
1181
1245
|
}
|
|
1182
1246
|
if (endY > parent.lowerCanvas.height) {
|
|
1183
|
-
|
|
1184
|
-
parent.lowerCanvas.height;
|
|
1247
|
+
actPoint.endY = parent.lowerCanvas.height;
|
|
1185
1248
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1249
|
+
actPoint.width = actPoint.endX - actPoint.startX;
|
|
1250
|
+
actPoint.height = actPoint.endY - actPoint.startY;
|
|
1188
1251
|
parent.activeObj.shape = 'crop-custom';
|
|
1189
1252
|
var obj = { strokeSettings: {} };
|
|
1190
|
-
parent.notify('shape', { prop: 'getStrokeSettings', onPropertyChange: false,
|
|
1191
|
-
value: { obj: obj } });
|
|
1253
|
+
parent.notify('shape', { prop: 'getStrokeSettings', onPropertyChange: false, value: { obj: obj } });
|
|
1192
1254
|
parent.activeObj.strokeSettings = obj['strokeSettings'];
|
|
1193
|
-
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint:
|
|
1255
|
+
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: actPoint, obj: parent.activeObj,
|
|
1194
1256
|
isMouseMove: null, x: null, y: null } });
|
|
1195
1257
|
parent.isCropTab = true;
|
|
1196
1258
|
}
|
|
1197
1259
|
if (parent.transform.degree === 0) {
|
|
1198
1260
|
var point = void 0;
|
|
1199
1261
|
if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
|
|
1200
|
-
point = this.updatePanPoints(
|
|
1262
|
+
point = this.updatePanPoints();
|
|
1201
1263
|
}
|
|
1202
1264
|
else {
|
|
1203
1265
|
point = { x: xDiff, y: yDiff };
|
|
@@ -1206,7 +1268,7 @@ var Transform = /** @class */ (function () {
|
|
|
1206
1268
|
parent.panPoint.totalPannedPoint.y += point.y;
|
|
1207
1269
|
var tempSelectionObj = extend({}, parent.activeObj, {}, true);
|
|
1208
1270
|
var temp = this.lowerContext.filter;
|
|
1209
|
-
this.drawPannImage(point);
|
|
1271
|
+
this.drawPannImage(point, isObjCreated);
|
|
1210
1272
|
this.lowerContext.filter = temp;
|
|
1211
1273
|
this.tempPanMove = extend({}, this.panMove, {}, true);
|
|
1212
1274
|
parent.activeObj = extend({}, tempSelectionObj, {}, true);
|
|
@@ -1219,13 +1281,13 @@ var Transform = /** @class */ (function () {
|
|
|
1219
1281
|
var tempFlipState = parent.transform.currFlipState;
|
|
1220
1282
|
parent.isCropTab = true;
|
|
1221
1283
|
if (isNullOrUndefined(xDiff) && isNullOrUndefined(yDiff)) {
|
|
1222
|
-
parent.panPoint.currentPannedPoint = this.updatePanPoints(
|
|
1284
|
+
parent.panPoint.currentPannedPoint = this.updatePanPoints();
|
|
1223
1285
|
}
|
|
1224
1286
|
else {
|
|
1225
1287
|
parent.panPoint.currentPannedPoint = { x: xDiff, y: yDiff };
|
|
1226
1288
|
}
|
|
1227
1289
|
parent.transform.currFlipState = tempFlipState;
|
|
1228
|
-
this.rotatePan();
|
|
1290
|
+
this.rotatePan(null, null, isObjCreated);
|
|
1229
1291
|
parent.isCropTab = false;
|
|
1230
1292
|
this.tempPanMove = extend({}, this.panMove, {}, true);
|
|
1231
1293
|
}
|
|
@@ -1235,7 +1297,7 @@ var Transform = /** @class */ (function () {
|
|
|
1235
1297
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
1236
1298
|
}
|
|
1237
1299
|
};
|
|
1238
|
-
Transform.prototype.drawPannImage = function (point) {
|
|
1300
|
+
Transform.prototype.drawPannImage = function (point, isObjCreated) {
|
|
1239
1301
|
var parent = this.parent;
|
|
1240
1302
|
var filter = this.lowerContext.filter;
|
|
1241
1303
|
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop, width: parent.img.destWidth,
|
|
@@ -1248,7 +1310,13 @@ var Transform = /** @class */ (function () {
|
|
|
1248
1310
|
parent.img.destWidth = destPoints.width;
|
|
1249
1311
|
parent.img.destHeight = destPoints.height;
|
|
1250
1312
|
this.setDestPointsForFlipState();
|
|
1313
|
+
if (isObjCreated) {
|
|
1314
|
+
parent.isCropTab = false;
|
|
1315
|
+
}
|
|
1251
1316
|
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
1317
|
+
if (isObjCreated) {
|
|
1318
|
+
parent.isCropTab = true;
|
|
1319
|
+
}
|
|
1252
1320
|
if ((parent.currSelectionPoint && parent.currSelectionPoint.shape === 'crop-circle') || parent.isCircleCrop) {
|
|
1253
1321
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
1254
1322
|
value: { context: this.lowerContext, isSave: null, isFlip: true } });
|
|
@@ -1262,10 +1330,16 @@ var Transform = /** @class */ (function () {
|
|
|
1262
1330
|
parent.img.destHeight = destPoints.height;
|
|
1263
1331
|
var temp = this.lowerContext.filter;
|
|
1264
1332
|
this.lowerContext.filter = 'none';
|
|
1333
|
+
if (isObjCreated) {
|
|
1334
|
+
parent.isCropTab = false;
|
|
1335
|
+
}
|
|
1265
1336
|
parent.notify('shape', { prop: 'panObjColl', onPropertyChange: false,
|
|
1266
1337
|
value: { xDiff: point.x, yDiff: point.y, panRegion: '' } });
|
|
1267
1338
|
parent.notify('freehand-draw', { prop: 'panFHDColl', onPropertyChange: false,
|
|
1268
1339
|
value: { xDiff: point.x, yDiff: point.y, panRegion: '' } });
|
|
1340
|
+
if (isObjCreated) {
|
|
1341
|
+
parent.isCropTab = true;
|
|
1342
|
+
}
|
|
1269
1343
|
this.lowerContext.filter = temp;
|
|
1270
1344
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
1271
1345
|
if (parent.isCircleCrop) {
|
|
@@ -1288,11 +1362,12 @@ var Transform = /** @class */ (function () {
|
|
|
1288
1362
|
value: { obj: selPointCollObj } });
|
|
1289
1363
|
this.transCurrObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
1290
1364
|
parent.isUndoRedo = parent.isCropToolbar = true;
|
|
1291
|
-
|
|
1292
|
-
|
|
1365
|
+
var zmFactor = parent.transform.defaultZoomFactor;
|
|
1366
|
+
if (zmFactor > 0) {
|
|
1367
|
+
this.zoomAction(-zmFactor);
|
|
1293
1368
|
}
|
|
1294
1369
|
else {
|
|
1295
|
-
this.zoomAction(Math.abs(
|
|
1370
|
+
this.zoomAction(Math.abs(zmFactor));
|
|
1296
1371
|
}
|
|
1297
1372
|
parent.isCropToolbar = false;
|
|
1298
1373
|
parent.isUndoRedo = isUndoRedo;
|
|
@@ -1309,7 +1384,7 @@ var Transform = /** @class */ (function () {
|
|
|
1309
1384
|
if (parent.objColl[i].flipObjColl.length > 0) {
|
|
1310
1385
|
var flipObjColl = { collection: parent.objColl[i].flipObjColl };
|
|
1311
1386
|
parent.notify('shape', { prop: 'alignRotateFlipColl', onPropertyChange: false,
|
|
1312
|
-
value: { collection:
|
|
1387
|
+
value: { collection: flipObjColl['collection'], isRotateFlipCollection: null, obj: flipObjColl } });
|
|
1313
1388
|
parent.objColl[i].flipObjColl = flipObjColl['collection'];
|
|
1314
1389
|
if (parent.objColl[i].flipObjColl.length === 0) {
|
|
1315
1390
|
parent.objColl[i].shapeFlip = '';
|
|
@@ -1351,7 +1426,7 @@ var Transform = /** @class */ (function () {
|
|
|
1351
1426
|
break;
|
|
1352
1427
|
}
|
|
1353
1428
|
};
|
|
1354
|
-
Transform.prototype.rotatePan = function (isCropSelection, isDefaultZoom) {
|
|
1429
|
+
Transform.prototype.rotatePan = function (isCropSelection, isDefaultZoom, isObjCreated) {
|
|
1355
1430
|
var parent = this.parent;
|
|
1356
1431
|
this.isReverseRotate = true;
|
|
1357
1432
|
var tempDegree = parent.transform.degree;
|
|
@@ -1365,20 +1440,19 @@ var Transform = /** @class */ (function () {
|
|
|
1365
1440
|
parent.objColl = [];
|
|
1366
1441
|
parent.pointColl = [];
|
|
1367
1442
|
parent.freehandCounter = 0;
|
|
1368
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
1369
|
-
value: { obj: object } });
|
|
1443
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: object } });
|
|
1370
1444
|
var cropSelPointColl = object['selPointColl'];
|
|
1371
|
-
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false,
|
|
1372
|
-
value: { obj: { selPointColl: [] } } });
|
|
1445
|
+
parent.notify('freehand-draw', { prop: 'setSelPointColl', onPropertyChange: false, value: { obj: { selPointColl: [] } } });
|
|
1373
1446
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
1374
1447
|
parent.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: true } });
|
|
1375
1448
|
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
1376
1449
|
value: { type: 'initial', isPreventDestination: null, isRotatePan: null } });
|
|
1377
1450
|
var initialDestLeft = parent.img.destLeft;
|
|
1378
1451
|
var initialDestTop = parent.img.destTop;
|
|
1452
|
+
var intPan = parent.panPoint.totalPannedInternalPoint;
|
|
1379
1453
|
if (parent.isCropTab) {
|
|
1380
|
-
parent.img.destLeft +=
|
|
1381
|
-
parent.img.destTop +=
|
|
1454
|
+
parent.img.destLeft += intPan.x;
|
|
1455
|
+
parent.img.destTop += intPan.y;
|
|
1382
1456
|
}
|
|
1383
1457
|
parent.notify('crop', { prop: 'updateRotatePan', onPropertyChange: false });
|
|
1384
1458
|
if (parent.isCropTab) {
|
|
@@ -1386,7 +1460,13 @@ var Transform = /** @class */ (function () {
|
|
|
1386
1460
|
parent.panPoint.totalPannedInternalPoint.y = parent.img.destTop - initialDestTop;
|
|
1387
1461
|
}
|
|
1388
1462
|
var temp = this.lowerContext.filter;
|
|
1463
|
+
if (isObjCreated) {
|
|
1464
|
+
parent.isCropTab = false;
|
|
1465
|
+
}
|
|
1389
1466
|
parent.notify('draw', { prop: 'drawImage', onPropertyChange: false });
|
|
1467
|
+
if (isObjCreated) {
|
|
1468
|
+
parent.isCropTab = true;
|
|
1469
|
+
}
|
|
1390
1470
|
parent.notify('draw', { prop: 'setRotateZoom', onPropertyChange: false, value: { isRotateZoom: false } });
|
|
1391
1471
|
parent.notify('draw', { prop: 'updateCurrTransState', onPropertyChange: false,
|
|
1392
1472
|
value: { type: 'reverse', isPreventDestination: true, isRotatePan: true } });
|
|
@@ -1397,8 +1477,7 @@ var Transform = /** @class */ (function () {
|
|
|
1397
1477
|
parent.img.destLeft += parent.panPoint.currentPannedPoint.x;
|
|
1398
1478
|
parent.img.destTop += parent.panPoint.currentPannedPoint.y;
|
|
1399
1479
|
parent.panPoint.totalPannedClientPoint.x = parent.img.destLeft - destLeft;
|
|
1400
|
-
parent.panPoint.totalPannedClientPoint.y =
|
|
1401
|
-
parent.img.destTop - destTop;
|
|
1480
|
+
parent.panPoint.totalPannedClientPoint.y = parent.img.destTop - destTop;
|
|
1402
1481
|
parent.objColl = tempObjColl;
|
|
1403
1482
|
parent.pointColl = tempPointColl;
|
|
1404
1483
|
parent.freehandCounter = parent.pointColl.length;
|
|
@@ -1419,10 +1498,16 @@ var Transform = /** @class */ (function () {
|
|
|
1419
1498
|
parent.panPoint.currentPannedPoint = extend({}, parent.panPoint.totalPannedClientPoint, {}, true);
|
|
1420
1499
|
}
|
|
1421
1500
|
}
|
|
1501
|
+
if (isObjCreated) {
|
|
1502
|
+
parent.isCropTab = false;
|
|
1503
|
+
}
|
|
1422
1504
|
parent.notify('shape', { prop: 'panObjColl', onPropertyChange: false,
|
|
1423
1505
|
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
1424
1506
|
parent.notify('freehand-draw', { prop: 'panFHDColl', onPropertyChange: false,
|
|
1425
1507
|
value: { xDiff: parent.panPoint.currentPannedPoint.x, yDiff: parent.panPoint.currentPannedPoint.y, panRegion: '' } });
|
|
1508
|
+
if (isObjCreated) {
|
|
1509
|
+
parent.isCropTab = true;
|
|
1510
|
+
}
|
|
1426
1511
|
this.lowerContext.filter = temp;
|
|
1427
1512
|
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
1428
1513
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
@@ -1435,63 +1520,53 @@ var Transform = /** @class */ (function () {
|
|
|
1435
1520
|
};
|
|
1436
1521
|
Transform.prototype.limitPan = function () {
|
|
1437
1522
|
var parent = this.parent;
|
|
1523
|
+
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY;
|
|
1524
|
+
var img = parent.img;
|
|
1438
1525
|
if (parent.activeObj.activePoint) {
|
|
1439
|
-
if (
|
|
1440
|
-
parent.img.destLeft =
|
|
1526
|
+
if (img.destLeft > startX) {
|
|
1527
|
+
parent.img.destLeft = startX;
|
|
1441
1528
|
}
|
|
1442
|
-
if (
|
|
1443
|
-
parent.img.destTop =
|
|
1529
|
+
if (img.destTop > startY) {
|
|
1530
|
+
parent.img.destTop = startY;
|
|
1444
1531
|
}
|
|
1445
|
-
if (
|
|
1446
|
-
parent.img.destLeft =
|
|
1532
|
+
if (img.destLeft + img.destWidth < endX) {
|
|
1533
|
+
parent.img.destLeft = endX - img.destWidth;
|
|
1447
1534
|
}
|
|
1448
|
-
if (
|
|
1449
|
-
parent.img.destTop =
|
|
1535
|
+
if (img.destTop + img.destHeight < endY) {
|
|
1536
|
+
parent.img.destTop = endY - img.destHeight;
|
|
1450
1537
|
}
|
|
1451
1538
|
}
|
|
1452
1539
|
};
|
|
1453
1540
|
Transform.prototype.updateFlipActiveObj = function (panRegion) {
|
|
1454
1541
|
var parent = this.parent;
|
|
1542
|
+
var actPoint = parent.activeObj.activePoint;
|
|
1543
|
+
var _a = parent.lowerCanvas, width = _a.width, height = _a.height;
|
|
1544
|
+
var endX;
|
|
1545
|
+
var endY;
|
|
1455
1546
|
if (panRegion === 'horizontal') {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
else {
|
|
1461
|
-
parent.activeObj.activePoint.endX = (parent.lowerCanvas.width / 2) + ((parent.lowerCanvas.width / 2) -
|
|
1462
|
-
parent.activeObj.activePoint.startX);
|
|
1463
|
-
}
|
|
1464
|
-
parent.activeObj.activePoint.startX = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.width;
|
|
1547
|
+
endX = actPoint.startX > width / 2 ? (width / 2) - (actPoint.startX - (width / 2)) :
|
|
1548
|
+
(width / 2) + ((width / 2) - actPoint.startX);
|
|
1549
|
+
actPoint.startX = endX - actPoint.width;
|
|
1550
|
+
actPoint.endX = endX;
|
|
1465
1551
|
}
|
|
1466
1552
|
else if (panRegion === 'vertical') {
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
else {
|
|
1472
|
-
parent.activeObj.activePoint.endY = (parent.lowerCanvas.height / 2) +
|
|
1473
|
-
((parent.lowerCanvas.height / 2) - parent.activeObj.activePoint.startY);
|
|
1474
|
-
}
|
|
1475
|
-
parent.activeObj.activePoint.startY = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.height;
|
|
1553
|
+
endY = actPoint.startX > width / 2 ? (height / 2) - (actPoint.startY - (height / 2)) :
|
|
1554
|
+
(height / 2) + ((height / 2) - actPoint.startY);
|
|
1555
|
+
actPoint.startY = endY - actPoint.height;
|
|
1556
|
+
actPoint.endY = endY;
|
|
1476
1557
|
}
|
|
1477
1558
|
else if (panRegion === 'verticalHorizontal' || panRegion === 'horizontalVertical') {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
parent.activeObj.activePoint.startX = parent.activeObj.activePoint.endX - parent.activeObj.activePoint.width;
|
|
1491
|
-
parent.activeObj.activePoint.startY = parent.activeObj.activePoint.endY - parent.activeObj.activePoint.height;
|
|
1492
|
-
}
|
|
1493
|
-
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: parent.activeObj.activePoint, obj: parent.activeObj,
|
|
1494
|
-
isMouseMove: null, x: null, y: null } });
|
|
1559
|
+
endX = actPoint.startX > width / 2 ? (width / 2) - (actPoint.startX - (width / 2)) :
|
|
1560
|
+
(width / 2) + ((width / 2) - actPoint.startX);
|
|
1561
|
+
endY = actPoint.startX > width / 2 ? (height / 2) - (actPoint.startY - (height / 2)) :
|
|
1562
|
+
(height / 2) + ((height / 2) - actPoint.startY);
|
|
1563
|
+
actPoint.startX = endX - actPoint.width;
|
|
1564
|
+
actPoint.startY = endY - actPoint.height;
|
|
1565
|
+
actPoint.endX = endX;
|
|
1566
|
+
actPoint.endY = endY;
|
|
1567
|
+
}
|
|
1568
|
+
parent.notify('draw', { prop: 'updateActiveObject', onPropertyChange: false, value: { actPoint: actPoint,
|
|
1569
|
+
obj: parent.activeObj, isMouseMove: null, x: null, y: null } });
|
|
1495
1570
|
};
|
|
1496
1571
|
Transform.prototype.pan = function (value) {
|
|
1497
1572
|
var parent = this.parent;
|
|
@@ -1520,9 +1595,10 @@ var Transform = /** @class */ (function () {
|
|
|
1520
1595
|
}
|
|
1521
1596
|
else {
|
|
1522
1597
|
var type = value > 0 ? 'zoomIn' : 'zoomOut';
|
|
1523
|
-
|
|
1598
|
+
var absValue = Math.abs(value) * 10;
|
|
1599
|
+
for (var i = 0; i < absValue; i++) {
|
|
1524
1600
|
parent.notify('draw', { prop: 'performPointZoom', onPropertyChange: false,
|
|
1525
|
-
value: { x: zoomPoint.x, y: zoomPoint.y, type: type } });
|
|
1601
|
+
value: { x: zoomPoint.x, y: zoomPoint.y, type: type, isResize: null } });
|
|
1526
1602
|
}
|
|
1527
1603
|
}
|
|
1528
1604
|
}
|
|
@@ -1534,48 +1610,18 @@ var Transform = /** @class */ (function () {
|
|
|
1534
1610
|
Transform.prototype.setCurrPanRegion = function (region, type, obj) {
|
|
1535
1611
|
var panRegion = region;
|
|
1536
1612
|
if (region === '') {
|
|
1537
|
-
|
|
1538
|
-
panRegion = 'horizontal';
|
|
1539
|
-
}
|
|
1540
|
-
else if (type === 'vertical') {
|
|
1541
|
-
panRegion = 'vertical';
|
|
1542
|
-
}
|
|
1613
|
+
panRegion = type === 'horizontal' ? 'horizontal' : type === 'vertical' ? 'vertical' : region;
|
|
1543
1614
|
}
|
|
1544
1615
|
else if (region === 'horizontal') {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
}
|
|
1548
|
-
else if (type === 'vertical') {
|
|
1549
|
-
panRegion = 'verticalHorizontal';
|
|
1550
|
-
}
|
|
1551
|
-
else if (type === 90) {
|
|
1552
|
-
panRegion = 'vertical';
|
|
1553
|
-
}
|
|
1554
|
-
else if (type === -90) {
|
|
1555
|
-
panRegion = 'horizontal';
|
|
1556
|
-
}
|
|
1616
|
+
panRegion = type === 'horizontal' ? 'horizontalVertical' : type === 'vertical' ? 'verticalHorizontal' : type === 90 ?
|
|
1617
|
+
'vertical' : type === -90 ? 'horizontal' : region;
|
|
1557
1618
|
}
|
|
1558
1619
|
else if (region === 'vertical') {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
}
|
|
1562
|
-
else if (type === 'vertical') {
|
|
1563
|
-
panRegion = 'verticalHorizontal';
|
|
1564
|
-
}
|
|
1565
|
-
else if (type === 90) {
|
|
1566
|
-
panRegion = 'horizontal';
|
|
1567
|
-
}
|
|
1568
|
-
else if (type === -90) {
|
|
1569
|
-
panRegion = 'vertical';
|
|
1570
|
-
}
|
|
1620
|
+
panRegion = type === 'horizontal' ? 'horizontalVertical' : type === 'vertical' ? 'verticalHorizontal' : type === 90 ?
|
|
1621
|
+
'horizontal' : type === -90 ? 'vertical' : region;
|
|
1571
1622
|
}
|
|
1572
1623
|
else {
|
|
1573
|
-
|
|
1574
|
-
panRegion = 'vertical';
|
|
1575
|
-
}
|
|
1576
|
-
else if (type === 'vertical') {
|
|
1577
|
-
panRegion = 'horizontal';
|
|
1578
|
-
}
|
|
1624
|
+
panRegion = type === 'horizontal' ? 'vertical' : type === 'vertical' ? 'horizontal' : region;
|
|
1579
1625
|
}
|
|
1580
1626
|
obj['panRegion'] = panRegion;
|
|
1581
1627
|
};
|
|
@@ -1599,18 +1645,37 @@ var Transform = /** @class */ (function () {
|
|
|
1599
1645
|
var isFrameToolbar = false;
|
|
1600
1646
|
var isActiveObj = false;
|
|
1601
1647
|
var freehandObj = { bool: false };
|
|
1648
|
+
var straightenObj = { bool: parent.isStraightening };
|
|
1649
|
+
var cxtTbarHeight = 0;
|
|
1650
|
+
var ctToolbar = parent.element.querySelector('#' + parent.element.id + '_contextualToolbar');
|
|
1651
|
+
var ctWrapper = parent.element.querySelector('.e-contextual-toolbar-wrapper');
|
|
1652
|
+
var hdWrapper = parent.element.querySelector('#' + parent.element.id + '_headWrapper');
|
|
1602
1653
|
if (parent.isImageLoaded) {
|
|
1654
|
+
var isCropSelection = false;
|
|
1655
|
+
var splitWords = void 0;
|
|
1656
|
+
if (Browser.isDevice) {
|
|
1657
|
+
if (parent.activeObj.shape) {
|
|
1658
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
1659
|
+
}
|
|
1660
|
+
if (parent.currObjType.isCustomCrop) {
|
|
1661
|
+
isCropSelection = true;
|
|
1662
|
+
}
|
|
1663
|
+
else if (splitWords && splitWords[0] === 'crop') {
|
|
1664
|
+
isCropSelection = true;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1603
1667
|
var frameObj = { bool: null };
|
|
1604
1668
|
parent.notify('toolbar', { prop: 'getFrameToolbar', onPropertyChange: false, value: { obj: frameObj } });
|
|
1605
|
-
|
|
1669
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1670
|
+
if (frameObj['bool'] || (isBlazor() && parent.currentToolbar === 'frame-toolbar')) {
|
|
1606
1671
|
isFrameToolbar = true;
|
|
1607
1672
|
}
|
|
1608
|
-
if (
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1673
|
+
if (!straightenObj['bool'] && ((ctToolbar && !ctToolbar.parentElement.classList.contains('e-hide')) ||
|
|
1674
|
+
(hdWrapper && !hdWrapper.parentElement.classList.contains('e-hide')))) {
|
|
1675
|
+
ctWrapper.classList.add('e-hide');
|
|
1676
|
+
if (!isCropSelection) {
|
|
1677
|
+
parent.okBtn();
|
|
1678
|
+
}
|
|
1614
1679
|
if (!isBlazor()) {
|
|
1615
1680
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
1616
1681
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
@@ -1630,14 +1695,14 @@ var Transform = /** @class */ (function () {
|
|
|
1630
1695
|
}
|
|
1631
1696
|
if (parent.activeObj.shape !== undefined) {
|
|
1632
1697
|
isActiveObj = true;
|
|
1633
|
-
if (parent.textArea.style.display === 'block') {
|
|
1698
|
+
if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
|
|
1634
1699
|
parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
|
|
1635
1700
|
value: { x: null, y: null, isMouseDown: null } });
|
|
1636
|
-
if (
|
|
1637
|
-
parent.
|
|
1701
|
+
if (isBlazor()) {
|
|
1702
|
+
parent.updateToolbar(parent.element, 'destroyQuickAccessToolbar');
|
|
1638
1703
|
}
|
|
1639
1704
|
else {
|
|
1640
|
-
parent.
|
|
1705
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
1641
1706
|
}
|
|
1642
1707
|
}
|
|
1643
1708
|
else {
|
|
@@ -1648,7 +1713,7 @@ var Transform = /** @class */ (function () {
|
|
|
1648
1713
|
}
|
|
1649
1714
|
}
|
|
1650
1715
|
var tempFilter = this.lowerContext.filter;
|
|
1651
|
-
var canvasWrapper =
|
|
1716
|
+
var canvasWrapper = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
1652
1717
|
if (canvasWrapper) {
|
|
1653
1718
|
canvasWrapper.style.width = parent.element.offsetWidth - 2 + 'px';
|
|
1654
1719
|
}
|
|
@@ -1659,27 +1724,29 @@ var Transform = /** @class */ (function () {
|
|
|
1659
1724
|
else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
|
|
1660
1725
|
toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
|
|
1661
1726
|
}
|
|
1727
|
+
if (Browser.isDevice && straightenObj['bool']) {
|
|
1728
|
+
cxtTbarHeight = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea').clientHeight;
|
|
1729
|
+
}
|
|
1662
1730
|
parent.notify('toolbar', { prop: 'setToolbarHeight', value: { height: toolbarHeight } });
|
|
1663
1731
|
if (Browser.isDevice) {
|
|
1664
1732
|
if (canvasWrapper) {
|
|
1665
|
-
canvasWrapper.style.height = parent.element.offsetHeight - (2 * toolbarHeight) -
|
|
1733
|
+
canvasWrapper.style.height = parent.element.offsetHeight - ((2 * toolbarHeight) + cxtTbarHeight) - 4 + 'px';
|
|
1666
1734
|
}
|
|
1667
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - (2 * toolbarHeight) - 5;
|
|
1668
1735
|
}
|
|
1669
1736
|
else {
|
|
1670
1737
|
if (canvasWrapper) {
|
|
1671
|
-
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight -
|
|
1738
|
+
canvasWrapper.style.height = parent.element.offsetHeight - toolbarHeight - 2 + 'px';
|
|
1672
1739
|
}
|
|
1673
|
-
parent.lowerCanvas.height = parent.upperCanvas.height = parent.element.offsetHeight - toolbarHeight - 3;
|
|
1674
1740
|
}
|
|
1741
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parseFloat(canvasWrapper.style.height);
|
|
1675
1742
|
this.lowerContext.filter =
|
|
1676
1743
|
'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
|
|
1677
1744
|
'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
|
|
1678
1745
|
parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
|
|
1679
1746
|
parent.canvasFilter = this.lowerContext.filter;
|
|
1680
|
-
|
|
1747
|
+
parent.initialAdjustmentValue = this.lowerContext.filter;
|
|
1681
1748
|
parent.clearContext(this.lowerContext);
|
|
1682
|
-
|
|
1749
|
+
parent.clearContext(this.upperContext);
|
|
1683
1750
|
if (parent.isImageLoaded) {
|
|
1684
1751
|
parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
|
|
1685
1752
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
@@ -1700,21 +1767,28 @@ var Transform = /** @class */ (function () {
|
|
|
1700
1767
|
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: obj_1 } });
|
|
1701
1768
|
}
|
|
1702
1769
|
if (Browser.isDevice) {
|
|
1703
|
-
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj_1['toolbarHeight'])) -
|
|
1770
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - (2 * obj_1['toolbarHeight']) - cxtTbarHeight) - 4 + 'px';
|
|
1704
1771
|
}
|
|
1705
1772
|
else {
|
|
1706
|
-
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj_1['toolbarHeight']) -
|
|
1773
|
+
canvasWrapper.style.height = (parseFloat(canvasWrapper.style.height) - obj_1['toolbarHeight']) - 2 + 'px';
|
|
1707
1774
|
}
|
|
1708
1775
|
}
|
|
1776
|
+
parent.lowerCanvas.width = parent.upperCanvas.width = parseFloat(canvasWrapper.style.width);
|
|
1777
|
+
parent.lowerCanvas.height = parent.upperCanvas.height = parseFloat(canvasWrapper.style.height);
|
|
1778
|
+
this.lowerContext.filter = tempFilter;
|
|
1709
1779
|
var obj = { width: 0, height: 0 };
|
|
1710
1780
|
this.calcMaxDimension(parent.img.srcWidth, parent.img.srcHeight, obj);
|
|
1711
1781
|
var maxDimension = obj;
|
|
1712
|
-
if (parent.transform.
|
|
1782
|
+
if (straightenObj['bool'] && parent.transform.cropZoomFactor !== 0) {
|
|
1783
|
+
maxDimension.width += (maxDimension.width * parent.transform.cropZoomFactor);
|
|
1784
|
+
maxDimension.height += (maxDimension.height * parent.transform.cropZoomFactor);
|
|
1785
|
+
}
|
|
1786
|
+
else if (parent.transform.defaultZoomFactor > 0) {
|
|
1713
1787
|
maxDimension.width += (maxDimension.width * parent.transform.defaultZoomFactor);
|
|
1714
1788
|
maxDimension.height += (maxDimension.height * parent.transform.defaultZoomFactor);
|
|
1715
1789
|
}
|
|
1716
1790
|
parent.img.destLeft = (parent.lowerCanvas.clientWidth - maxDimension.width) / 2;
|
|
1717
|
-
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height) / 2;
|
|
1791
|
+
parent.img.destTop = (parent.lowerCanvas.clientHeight - maxDimension.height + 1) / 2;
|
|
1718
1792
|
if (parent.transform.degree === 0 && parent.transform.currFlipState === '') {
|
|
1719
1793
|
if (parent.transform.defaultZoomFactor > 0) {
|
|
1720
1794
|
parent.img.destLeft += parent.panPoint.totalPannedPoint.x;
|
|
@@ -1734,6 +1808,8 @@ var Transform = /** @class */ (function () {
|
|
|
1734
1808
|
}
|
|
1735
1809
|
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
1736
1810
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
1811
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.lowerContext } });
|
|
1812
|
+
parent.notify('draw', { prop: 'clearOuterCanvas', onPropertyChange: false, value: { context: this.upperContext } });
|
|
1737
1813
|
if (parent.isCircleCrop) {
|
|
1738
1814
|
parent.notify('crop', { prop: 'cropCircle', onPropertyChange: false,
|
|
1739
1815
|
value: { context: this.lowerContext, isSave: null, isFlip: null } });
|
|
@@ -1747,8 +1823,8 @@ var Transform = /** @class */ (function () {
|
|
|
1747
1823
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1748
1824
|
var toolbar_1 = getComponent(parent.element.id + '_toolbar', 'toolbar');
|
|
1749
1825
|
toolbar_1.refreshOverflow();
|
|
1750
|
-
if (
|
|
1751
|
-
|
|
1826
|
+
if (ctWrapper && !straightenObj['bool']) {
|
|
1827
|
+
ctWrapper.classList.add('e-hide');
|
|
1752
1828
|
}
|
|
1753
1829
|
}
|
|
1754
1830
|
}
|
|
@@ -1759,8 +1835,18 @@ var Transform = /** @class */ (function () {
|
|
|
1759
1835
|
parent.objColl.pop();
|
|
1760
1836
|
if (activeObj.activePoint.width !== 0 && activeObj.activePoint.height !== 0) {
|
|
1761
1837
|
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
1762
|
-
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel:
|
|
1838
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
1839
|
+
parent.objColl.push(activeObj);
|
|
1840
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: true } });
|
|
1841
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
1842
|
+
activeObj = extend({}, parent.objColl[parent.objColl.length - 1], null, true);
|
|
1843
|
+
parent.objColl.pop();
|
|
1844
|
+
this.lowerContext.clearRect(0, 0, parent.lowerCanvas.width, parent.lowerCanvas.height);
|
|
1845
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
1763
1846
|
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: activeObj } });
|
|
1847
|
+
if (straightenObj['bool']) {
|
|
1848
|
+
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: activeObj } });
|
|
1849
|
+
}
|
|
1764
1850
|
if (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse' || parent.activeObj.shape === 'text' ||
|
|
1765
1851
|
parent.activeObj.shape === 'line' || parent.activeObj.shape === 'arrow' || parent.activeObj.shape === 'path' ||
|
|
1766
1852
|
parent.activeObj.shape === 'image') {
|
|
@@ -1774,11 +1860,11 @@ var Transform = /** @class */ (function () {
|
|
|
1774
1860
|
}
|
|
1775
1861
|
}
|
|
1776
1862
|
if (freehandObj['bool']) {
|
|
1777
|
-
if (
|
|
1778
|
-
parent.
|
|
1863
|
+
if (isBlazor()) {
|
|
1864
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', 'pen');
|
|
1779
1865
|
}
|
|
1780
1866
|
else {
|
|
1781
|
-
parent.
|
|
1867
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
1782
1868
|
}
|
|
1783
1869
|
}
|
|
1784
1870
|
if (isFrameToolbar) {
|
|
@@ -1826,28 +1912,33 @@ var Transform = /** @class */ (function () {
|
|
|
1826
1912
|
else if (parent.transform.degree !== 0 && parent.transform.cropZoomFactor > 0) {
|
|
1827
1913
|
parent.transform.zoomFactor = 0;
|
|
1828
1914
|
parent.transform.cropZoomFactor = null;
|
|
1829
|
-
if (
|
|
1830
|
-
parent.
|
|
1915
|
+
if (isBlazor()) {
|
|
1916
|
+
parent.updateToolbar(parent.element, 'enableDisableToolbarBtn');
|
|
1831
1917
|
}
|
|
1832
1918
|
else {
|
|
1833
|
-
parent.
|
|
1919
|
+
parent.notify('toolbar', { prop: 'enable-disable-btns', onPropertyChange: false });
|
|
1834
1920
|
}
|
|
1835
1921
|
}
|
|
1836
1922
|
}
|
|
1837
1923
|
};
|
|
1838
1924
|
Transform.prototype.calcMaxDimension = function (width, height, obj, isImgShape) {
|
|
1839
1925
|
var object = { toolbarHeight: 0 };
|
|
1926
|
+
var parent = this.parent;
|
|
1840
1927
|
if (!isBlazor()) {
|
|
1841
|
-
|
|
1928
|
+
parent.notify('toolbar', { prop: 'getToolbarHeight', value: { obj: object } });
|
|
1842
1929
|
}
|
|
1843
1930
|
else {
|
|
1844
|
-
object['toolbarHeight'] =
|
|
1931
|
+
object['toolbarHeight'] = parent.toolbarHeight;
|
|
1932
|
+
}
|
|
1933
|
+
var canvasMaxWidth = isImgShape ? parent.element.clientWidth / 3 :
|
|
1934
|
+
parent.element.clientWidth;
|
|
1935
|
+
var canvasMaxHeight = isImgShape ? (parent.element.clientHeight - object['toolbarHeight']) / 3 :
|
|
1936
|
+
parent.element.clientHeight - (object['toolbarHeight']); // 1px border
|
|
1937
|
+
canvasMaxHeight = Browser.isDevice ? canvasMaxHeight - (object['toolbarHeight']) : canvasMaxHeight; // 1px border
|
|
1938
|
+
if (Browser.isDevice && parent.isStraightening) {
|
|
1939
|
+
var cxtTbar = parent.element.querySelector('#' + parent.element.id + '_contextualToolbarArea');
|
|
1940
|
+
canvasMaxHeight -= cxtTbar ? cxtTbar.clientHeight : 0;
|
|
1845
1941
|
}
|
|
1846
|
-
var canvasMaxWidth = isImgShape ? this.parent.element.clientWidth / 3 :
|
|
1847
|
-
this.parent.element.clientWidth;
|
|
1848
|
-
var canvasMaxHeight = isImgShape ? (this.parent.element.clientHeight - object['toolbarHeight']) / 3 :
|
|
1849
|
-
this.parent.element.clientHeight - object['toolbarHeight'];
|
|
1850
|
-
canvasMaxHeight = Browser.isDevice ? canvasMaxHeight - object['toolbarHeight'] : canvasMaxHeight;
|
|
1851
1942
|
if (isNullOrUndefined(isImgShape)) {
|
|
1852
1943
|
if (canvasMaxWidth > 30) {
|
|
1853
1944
|
canvasMaxWidth -= 30;
|
|
@@ -1870,12 +1961,12 @@ var Transform = /** @class */ (function () {
|
|
|
1870
1961
|
}
|
|
1871
1962
|
if (isNullOrUndefined(isImgShape)) {
|
|
1872
1963
|
var cropObj = { bool: null };
|
|
1873
|
-
|
|
1964
|
+
parent.notify('crop', { prop: 'getPreventScaling', onPropertyChange: false,
|
|
1874
1965
|
value: { obj: cropObj } });
|
|
1875
|
-
if (cropObj['bool'] &&
|
|
1876
|
-
|
|
1877
|
-
cssMaxWidth =
|
|
1878
|
-
cssMaxHeight =
|
|
1966
|
+
if (cropObj['bool'] && parent.cropObj.activeObj.activePoint &&
|
|
1967
|
+
parent.cropObj.activeObj.activePoint.width !== 0 && parent.cropObj.activeObj.activePoint.height !== 0) {
|
|
1968
|
+
cssMaxWidth = parent.cropObj.activeObj.activePoint.width;
|
|
1969
|
+
cssMaxHeight = parent.cropObj.activeObj.activePoint.height;
|
|
1879
1970
|
}
|
|
1880
1971
|
}
|
|
1881
1972
|
if (obj) {
|
|
@@ -1884,7 +1975,7 @@ var Transform = /** @class */ (function () {
|
|
|
1884
1975
|
}
|
|
1885
1976
|
return { width: cssMaxWidth, height: cssMaxHeight };
|
|
1886
1977
|
};
|
|
1887
|
-
Transform.prototype.updatePanPoints = function (
|
|
1978
|
+
Transform.prototype.updatePanPoints = function () {
|
|
1888
1979
|
var parent = this.parent;
|
|
1889
1980
|
var tempActObj = extend({}, parent.activeObj, {}, true);
|
|
1890
1981
|
var tempDestLeft = parent.img.destLeft;
|
|
@@ -1894,42 +1985,42 @@ var Transform = /** @class */ (function () {
|
|
|
1894
1985
|
}
|
|
1895
1986
|
var xDiff = this.panMove.x - this.tempPanMove.x;
|
|
1896
1987
|
var yDiff = this.panMove.y - this.tempPanMove.y;
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
parent.img.destLeft -= xDiff;
|
|
1924
|
-
parent.img.destTop += yDiff;
|
|
1988
|
+
parent.img.destLeft += xDiff;
|
|
1989
|
+
parent.img.destTop += yDiff;
|
|
1990
|
+
this.limitPan();
|
|
1991
|
+
var obj = { bool: null };
|
|
1992
|
+
var object = { isIntersect: null };
|
|
1993
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
1994
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: object } });
|
|
1995
|
+
parent.notify('draw', { prop: 'isSelOutsideImg', onPropertyChange: false, value: { obj: obj } });
|
|
1996
|
+
var count = 0;
|
|
1997
|
+
while (parent.transform.straighten !== 0 && (object['isIntersect'] || obj['bool'])) {
|
|
1998
|
+
count++;
|
|
1999
|
+
parent.img.destLeft = tempDestLeft;
|
|
2000
|
+
parent.img.destTop = tempDestTop;
|
|
2001
|
+
if (xDiff !== 0 && xDiff > 0) {
|
|
2002
|
+
xDiff -= 1;
|
|
2003
|
+
}
|
|
2004
|
+
else if (xDiff !== 0 && xDiff < 0) {
|
|
2005
|
+
xDiff += 1;
|
|
2006
|
+
}
|
|
2007
|
+
if (yDiff !== 0 && yDiff > 0) {
|
|
2008
|
+
yDiff -= 1;
|
|
2009
|
+
}
|
|
2010
|
+
else if (yDiff !== 0 && yDiff < 0) {
|
|
2011
|
+
yDiff += 1;
|
|
2012
|
+
}
|
|
2013
|
+
if ((xDiff === 0 && yDiff === 0) || count === 200) {
|
|
1925
2014
|
break;
|
|
2015
|
+
}
|
|
2016
|
+
parent.img.destLeft += xDiff;
|
|
2017
|
+
parent.img.destTop += yDiff;
|
|
2018
|
+
this.limitPan();
|
|
2019
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
2020
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: object } });
|
|
2021
|
+
parent.notify('draw', { prop: 'isSelOutsideImg', onPropertyChange: false, value: { obj: obj } });
|
|
1926
2022
|
}
|
|
1927
|
-
this.limitPan();
|
|
1928
2023
|
parent.activeObj = tempActObj;
|
|
1929
|
-
if (obj) {
|
|
1930
|
-
obj['x'] = parent.img.destLeft - tempDestLeft;
|
|
1931
|
-
obj['y'] = parent.img.destTop - tempDestTop;
|
|
1932
|
-
}
|
|
1933
2024
|
return { x: parent.img.destLeft - tempDestLeft, y: parent.img.destTop - tempDestTop };
|
|
1934
2025
|
};
|
|
1935
2026
|
Transform.prototype.resizeImage = function (width, height) {
|
|
@@ -1941,29 +2032,29 @@ var Transform = /** @class */ (function () {
|
|
|
1941
2032
|
parent.img.srcTop = 0;
|
|
1942
2033
|
parent.isAspectRatio = true;
|
|
1943
2034
|
var minimum = [];
|
|
1944
|
-
parent.img.srcWidth = parent.
|
|
1945
|
-
parent.img.srcHeight = parent.
|
|
1946
|
-
if (parent.resizeSrc && parent.resizeSrc.width
|
|
2035
|
+
parent.img.srcWidth = parent.baseImgCanvas.width;
|
|
2036
|
+
parent.img.srcHeight = parent.baseImgCanvas.height;
|
|
2037
|
+
if (parent.resizeSrc && parent.resizeSrc.width !== 0 && parent.resizeSrc.height !== 0) {
|
|
1947
2038
|
parent.img.srcLeft = parent.resizeSrc.startX;
|
|
1948
2039
|
parent.img.srcTop = parent.resizeSrc.startY;
|
|
1949
2040
|
parent.img.srcWidth = parent.resizeSrc.width;
|
|
1950
2041
|
parent.img.srcHeight = parent.resizeSrc.height;
|
|
1951
2042
|
}
|
|
1952
2043
|
while ((width < parent.img.destWidth || height < parent.img.destHeight) && temp1) {
|
|
1953
|
-
this.zoomAction(-.1, null, true);
|
|
2044
|
+
this.zoomAction(-.1, null, true, true);
|
|
1954
2045
|
if (width > parent.img.destWidth || height > parent.img.destHeight) {
|
|
1955
2046
|
while (width > parent.img.destWidth || height > parent.img.destHeight) {
|
|
1956
|
-
this.zoomAction(0.0125, null, true);
|
|
2047
|
+
this.zoomAction(0.0125, null, true, true);
|
|
1957
2048
|
temp1 = false;
|
|
1958
2049
|
minimum.push(parent.img.destWidth);
|
|
1959
2050
|
}
|
|
1960
2051
|
}
|
|
1961
2052
|
}
|
|
1962
2053
|
while ((width > parent.img.destWidth || height > parent.img.destHeight) && temp1 && temp) {
|
|
1963
|
-
this.zoomAction(.1, null, true);
|
|
2054
|
+
this.zoomAction(.1, null, true, true);
|
|
1964
2055
|
if (width < parent.img.destWidth || height < parent.img.destHeight) {
|
|
1965
2056
|
while (width < parent.img.destWidth) {
|
|
1966
|
-
this.zoomAction(-.0125, null, true);
|
|
2057
|
+
this.zoomAction(-.0125, null, true, true);
|
|
1967
2058
|
temp = false;
|
|
1968
2059
|
minimum.push(parent.img.destWidth);
|
|
1969
2060
|
}
|
|
@@ -1980,11 +2071,11 @@ var Transform = /** @class */ (function () {
|
|
|
1980
2071
|
}
|
|
1981
2072
|
}
|
|
1982
2073
|
if (nearestNumber < width && temp) {
|
|
1983
|
-
this.zoomAction(-.0125, null, true);
|
|
2074
|
+
this.zoomAction(-.0125, null, true, true);
|
|
1984
2075
|
temp = false;
|
|
1985
2076
|
}
|
|
1986
2077
|
if (nearestNumber > width && !temp) {
|
|
1987
|
-
this.zoomAction(.0125, null, true);
|
|
2078
|
+
this.zoomAction(.0125, null, true, true);
|
|
1988
2079
|
temp = false;
|
|
1989
2080
|
}
|
|
1990
2081
|
this.zoomAction(.0125, null, true);
|
|
@@ -2010,18 +2101,21 @@ var Transform = /** @class */ (function () {
|
|
|
2010
2101
|
parent.notify('draw', { prop: 'setCurrentObj', onPropertyChange: false, value: { obj: obj1['prevObj'] } });
|
|
2011
2102
|
parent.objColl = extend([], obj1['prevObj']['objColl'], [], true);
|
|
2012
2103
|
parent.pointColl = extend([], obj1['prevObj']['pointColl'], [], true);
|
|
2104
|
+
parent.transform.straighten = 0;
|
|
2013
2105
|
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
2014
2106
|
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: null } });
|
|
2015
|
-
parent.
|
|
2107
|
+
if (parent.transform.straighten === 0 && !this.isPreventSelect) {
|
|
2108
|
+
parent.notify('freehand-draw', { prop: 'updateFHDColl', onPropertyChange: false });
|
|
2109
|
+
}
|
|
2016
2110
|
var tempwidth = width;
|
|
2017
2111
|
var tempheight = height;
|
|
2018
2112
|
var tempZoom = false;
|
|
2019
2113
|
if (height >= width && height <= Math.ceil(parent.img.destHeight)) {
|
|
2020
2114
|
while ((height <= Math.ceil(parent.img.destHeight)) && temp) {
|
|
2021
|
-
this.zoomAction(-.1, null, true);
|
|
2115
|
+
this.zoomAction(-.1, null, true, true);
|
|
2022
2116
|
if (width > parent.img.destWidth || height > parent.img.destHeight) {
|
|
2023
2117
|
while (width > parent.img.destWidth || height > parent.img.destHeight) {
|
|
2024
|
-
this.zoomAction(.0125, null, true);
|
|
2118
|
+
this.zoomAction(.0125, null, true, true);
|
|
2025
2119
|
temp = false;
|
|
2026
2120
|
}
|
|
2027
2121
|
}
|
|
@@ -2029,10 +2123,10 @@ var Transform = /** @class */ (function () {
|
|
|
2029
2123
|
}
|
|
2030
2124
|
else if (height <= width && width < parent.img.destWidth) {
|
|
2031
2125
|
while ((width < parent.img.destWidth) && temp) {
|
|
2032
|
-
this.zoomAction(-.1, null, true);
|
|
2126
|
+
this.zoomAction(-.1, null, true, true);
|
|
2033
2127
|
if (width > parent.img.destWidth || height > parent.img.destHeight) {
|
|
2034
2128
|
while (width > parent.img.destWidth || height > parent.img.destHeight) {
|
|
2035
|
-
this.zoomAction(.0125, null, true);
|
|
2129
|
+
this.zoomAction(.0125, null, true, true);
|
|
2036
2130
|
temp = false;
|
|
2037
2131
|
}
|
|
2038
2132
|
}
|
|
@@ -2040,31 +2134,31 @@ var Transform = /** @class */ (function () {
|
|
|
2040
2134
|
}
|
|
2041
2135
|
else if (height >= width && height >= parent.img.destHeight) {
|
|
2042
2136
|
while ((height >= parent.img.destHeight) && temp) {
|
|
2043
|
-
this.zoomAction(.1, null, true);
|
|
2137
|
+
this.zoomAction(.1, null, true, true);
|
|
2044
2138
|
}
|
|
2045
2139
|
}
|
|
2046
2140
|
else if (width >= height && width >= parent.img.destWidth) {
|
|
2047
2141
|
while ((width >= parent.img.destWidth) && temp) {
|
|
2048
|
-
this.zoomAction(.1, null, true);
|
|
2142
|
+
this.zoomAction(.1, null, true, true);
|
|
2049
2143
|
}
|
|
2050
2144
|
if (width < parent.img.destWidth && height < parent.img.destHeight) {
|
|
2051
2145
|
while (width < parent.img.destWidth && height < parent.img.destHeight) {
|
|
2052
|
-
this.zoomAction(-.0125, null, true);
|
|
2146
|
+
this.zoomAction(-.0125, null, true, true);
|
|
2053
2147
|
temp = false;
|
|
2054
2148
|
}
|
|
2055
|
-
this.zoomAction(.0125, null, true);
|
|
2149
|
+
this.zoomAction(.0125, null, true, true);
|
|
2056
2150
|
}
|
|
2057
2151
|
}
|
|
2058
2152
|
else if (height > parent.img.destHeight && width > parent.img.destWidth) {
|
|
2059
2153
|
while ((height > parent.img.destHeight) && (width > parent.img.destWidth) && temp) {
|
|
2060
|
-
this.zoomAction(.1, null, true);
|
|
2154
|
+
this.zoomAction(.1, null, true, true);
|
|
2061
2155
|
}
|
|
2062
2156
|
if (width < parent.img.destWidth && height < parent.img.destHeight) {
|
|
2063
2157
|
while (width < parent.img.destWidth && height < parent.img.destHeight) {
|
|
2064
|
-
this.zoomAction(-.0125, null, true);
|
|
2158
|
+
this.zoomAction(-.0125, null, true, true);
|
|
2065
2159
|
temp = false;
|
|
2066
2160
|
}
|
|
2067
|
-
this.zoomAction(.0125, null, true);
|
|
2161
|
+
this.zoomAction(.0125, null, true, true);
|
|
2068
2162
|
}
|
|
2069
2163
|
}
|
|
2070
2164
|
this.resizeImg(activeObj, width, height);
|
|
@@ -2072,21 +2166,21 @@ var Transform = /** @class */ (function () {
|
|
|
2072
2166
|
height = tempheight;
|
|
2073
2167
|
if ((height !== parent.img.destHeight || width !== parent.img.destWidth)) {
|
|
2074
2168
|
while ((height > parent.img.destHeight || width > parent.img.destWidth)) {
|
|
2075
|
-
this.zoomAction(.0125, null, true);
|
|
2169
|
+
this.zoomAction(.0125, null, true, true);
|
|
2076
2170
|
tempZoom = true;
|
|
2077
2171
|
}
|
|
2078
2172
|
if (tempZoom) {
|
|
2079
|
-
this.zoomAction(-.0125, null, true);
|
|
2173
|
+
this.zoomAction(-.0125, null, true, true);
|
|
2080
2174
|
tempZoom = false;
|
|
2081
2175
|
}
|
|
2082
2176
|
}
|
|
2083
2177
|
if ((height !== parent.img.destHeight || width !== parent.img.destWidth)) {
|
|
2084
2178
|
while ((height < parent.img.destHeight || width < parent.img.destWidth)) {
|
|
2085
|
-
this.zoomAction(-.0125, null, true);
|
|
2179
|
+
this.zoomAction(-.0125, null, true, true);
|
|
2086
2180
|
tempZoom = true;
|
|
2087
2181
|
}
|
|
2088
2182
|
if (tempZoom) {
|
|
2089
|
-
this.zoomAction(-.0125, null, true);
|
|
2183
|
+
this.zoomAction(-.0125, null, true, true);
|
|
2090
2184
|
tempZoom = false;
|
|
2091
2185
|
}
|
|
2092
2186
|
}
|
|
@@ -2104,6 +2198,7 @@ var Transform = /** @class */ (function () {
|
|
|
2104
2198
|
var heightRatio = height / parent.img.destHeight;
|
|
2105
2199
|
if (activeObj.shape) {
|
|
2106
2200
|
parent.currSelectionPoint = activeObj;
|
|
2201
|
+
parent.notify('crop', { prop: 'setInitCrop', onPropertyChange: false, value: { bool: true } });
|
|
2107
2202
|
}
|
|
2108
2203
|
else if (parent.img.srcWidth === parent.baseImgCanvas.width && parent.img.srcHeight === parent.baseImgCanvas.height) {
|
|
2109
2204
|
parent.currSelectionPoint = null;
|
|
@@ -2123,11 +2218,31 @@ var Transform = /** @class */ (function () {
|
|
|
2123
2218
|
height = parent.activeObj.activePoint.height * heightRatio;
|
|
2124
2219
|
var sx = (parent.activeObj.activePoint.startX + (parent.activeObj.activePoint.width / 2)) - (width / 2);
|
|
2125
2220
|
var sy = (parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2)) - (height / 2);
|
|
2221
|
+
var count = 0;
|
|
2222
|
+
while (Browser.isDevice && count < 500 && (sx < 0 || sy < 0 || (sx + width) > parent.img.destWidth
|
|
2223
|
+
|| (sy + height) > parent.img.destHeight)) {
|
|
2224
|
+
count++;
|
|
2225
|
+
width -= 1;
|
|
2226
|
+
height -= 1;
|
|
2227
|
+
sx = (parent.activeObj.activePoint.startX + (parent.activeObj.activePoint.width / 2)) - (width / 2);
|
|
2228
|
+
sy = (parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2)) - (height / 2);
|
|
2229
|
+
}
|
|
2126
2230
|
parent.transform.defaultZoomFactor = 0;
|
|
2127
2231
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: true } });
|
|
2232
|
+
parent.notify('draw', { prop: 'setIsCropSelect', value: { bool: true } });
|
|
2128
2233
|
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
2129
2234
|
value: { type: 'custom', startX: sx, startY: sy, width: width, height: height } });
|
|
2130
2235
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: false } });
|
|
2236
|
+
if (parent.transform.straighten !== 0) {
|
|
2237
|
+
var obj = { isIntersect: null, arr: null };
|
|
2238
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
2239
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
|
|
2240
|
+
while (obj['arr'][0] || obj['arr'][1] || obj['arr'][2] || obj['arr'][3]) {
|
|
2241
|
+
this.zoomAction(.0125, null, true);
|
|
2242
|
+
parent.notify('draw', { prop: 'updateImgCanvasPoints', onPropertyChange: false });
|
|
2243
|
+
parent.notify('draw', { prop: 'isLinesIntersect', onPropertyChange: false, value: { obj: obj } });
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2131
2246
|
parent.isCropToolbar = true;
|
|
2132
2247
|
parent.crop();
|
|
2133
2248
|
parent.isCropToolbar = false;
|
|
@@ -2160,30 +2275,40 @@ var Transform = /** @class */ (function () {
|
|
|
2160
2275
|
}
|
|
2161
2276
|
var aspectIcon = parent.element.querySelector('#' + parent.element.id + '_aspectratio');
|
|
2162
2277
|
var nonAspectIcon = parent.element.querySelector('#' + parent.element.id + '_nonaspectratio');
|
|
2163
|
-
if (
|
|
2278
|
+
if (aspectIcon && nonAspectIcon) {
|
|
2164
2279
|
parent.notify('toolbar', { prop: 'initResizeToolbar' });
|
|
2165
2280
|
if (Browser.isDevice) {
|
|
2166
2281
|
parent.notify('toolbar', { prop: 'init-main-toolbar', value: { isApplyBtn: false, isDevice: true, isOkBtn: true, isResize: true } });
|
|
2167
2282
|
}
|
|
2168
2283
|
}
|
|
2169
|
-
var resizeEventArgs = { cancel: false, previousWidth: Math.ceil(parent.img.destWidth),
|
|
2170
|
-
width: Math.ceil(width), height: height && height !== 0 ? Math.ceil(height) :
|
|
2284
|
+
var resizeEventArgs = { cancel: false, previousWidth: Math.ceil(parent.img.destWidth),
|
|
2285
|
+
previousHeight: Math.ceil(parent.img.destHeight), width: Math.ceil(width), height: height && height !== 0 ? Math.ceil(height) :
|
|
2286
|
+
(parent.aspectHeight ? parent.aspectHeight : Math.ceil(parent.img.destHeight)),
|
|
2171
2287
|
isAspectRatio: isAspectRatio ? isAspectRatio : false };
|
|
2172
2288
|
if (!isBlazor()) {
|
|
2173
2289
|
parent.trigger('resizing', resizeEventArgs);
|
|
2174
2290
|
if (!resizeEventArgs.cancel) {
|
|
2175
2291
|
this.resizeEventHandler(resizeEventArgs);
|
|
2176
2292
|
}
|
|
2293
|
+
else if (parent.aspectHeight && parent.aspectWidth) {
|
|
2294
|
+
parent.aspectHeight = resizeEventArgs.previousHeight;
|
|
2295
|
+
parent.aspectWidth = resizeEventArgs.previousWidth;
|
|
2296
|
+
}
|
|
2177
2297
|
}
|
|
2178
|
-
else if (isBlazor() && parent.events && parent.events.imageResizing.hasDelegate === true) {
|
|
2298
|
+
else if (isBlazor() && parent.events && parent.events.imageResizing.hasDelegate === true && !parent.isResizeOkBtn) {
|
|
2179
2299
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2180
|
-
parent.dotNetRef.invokeMethodAsync('OnImageResizingAsync', resizeEventArgs).then(function (args) {
|
|
2300
|
+
parent.dotNetRef.invokeMethodAsync('OnImageResizingAsync', 'ImageResizing', resizeEventArgs, null).then(function (args) {
|
|
2301
|
+
_this.resizeEventCancel = args.cancel;
|
|
2181
2302
|
if (!args.cancel) {
|
|
2182
2303
|
_this.resizeEventHandler(args);
|
|
2183
2304
|
}
|
|
2305
|
+
else if (parent.aspectHeight && parent.aspectWidth) {
|
|
2306
|
+
parent.aspectHeight = resizeEventArgs.previousHeight;
|
|
2307
|
+
parent.aspectWidth = resizeEventArgs.previousWidth;
|
|
2308
|
+
}
|
|
2184
2309
|
});
|
|
2185
2310
|
}
|
|
2186
|
-
else {
|
|
2311
|
+
else if (!this.resizeEventCancel) {
|
|
2187
2312
|
this.resizeEventHandler(resizeEventArgs);
|
|
2188
2313
|
}
|
|
2189
2314
|
};
|
|
@@ -2192,8 +2317,8 @@ var Transform = /** @class */ (function () {
|
|
|
2192
2317
|
var isRotate;
|
|
2193
2318
|
var aspectRatioWidth = parent.element.querySelector('#' + parent.element.id + '_resizeWidth');
|
|
2194
2319
|
var aspectRatioHeight = parent.element.querySelector('#' + parent.element.id + '_resizeHeight');
|
|
2195
|
-
var
|
|
2196
|
-
var
|
|
2320
|
+
var heightElem = parent.element.querySelector('.e-ie-toolbar-e-resize-height-input .e-textbox');
|
|
2321
|
+
var widthElem = parent.element.querySelector('.e-ie-toolbar-e-resize-width-input .e-textbox');
|
|
2197
2322
|
if (args.isAspectRatio) {
|
|
2198
2323
|
if (this.resizedImgAngle == null || this.resizedImgAngle !== parent.transform.degree) {
|
|
2199
2324
|
this.resizedImgAngle = parent.transform.degree;
|
|
@@ -2201,22 +2326,43 @@ var Transform = /** @class */ (function () {
|
|
|
2201
2326
|
}
|
|
2202
2327
|
if (isRotate) {
|
|
2203
2328
|
parent.notify('transform', { prop: 'resizeImage', value: { width: args.width, height: 0 } });
|
|
2329
|
+
var originalWidth = parent.img.destWidth;
|
|
2330
|
+
var originalHeight = parent.img.destHeight;
|
|
2331
|
+
var aspectRatioWidthValue = void 0;
|
|
2332
|
+
if (!isBlazor()) {
|
|
2333
|
+
aspectRatioWidthValue = parseFloat(aspectRatioWidth.value === '' ? aspectRatioWidth.placeholder :
|
|
2334
|
+
aspectRatioWidth.value);
|
|
2335
|
+
}
|
|
2336
|
+
else {
|
|
2337
|
+
aspectRatioWidthValue = parseFloat(widthElem.value === '' ? widthElem.placeholder : widthElem.value);
|
|
2338
|
+
}
|
|
2204
2339
|
if (aspectRatioHeight) {
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2340
|
+
var value = aspectRatioWidthValue / (originalWidth / originalHeight);
|
|
2341
|
+
var height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2342
|
+
getComponent(aspectRatioHeight, 'numerictextbox').value = height;
|
|
2343
|
+
aspectRatioHeight.value = height.toString() + ' px';
|
|
2344
|
+
parent.aspectHeight = height;
|
|
2208
2345
|
if (aspectRatioWidth && aspectRatioWidth.value === '') {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2346
|
+
var aspectRatioHeightValue = parseFloat(aspectRatioHeight.value === '' ? aspectRatioHeight.placeholder :
|
|
2347
|
+
aspectRatioHeight.value);
|
|
2348
|
+
value = aspectRatioHeightValue / (originalHeight / originalWidth);
|
|
2349
|
+
var width = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2350
|
+
getComponent(aspectRatioWidth, 'numerictextbox').value = width;
|
|
2351
|
+
aspectRatioWidth.value = width.toString() + ' px';
|
|
2352
|
+
parent.aspectWidth = width;
|
|
2212
2353
|
}
|
|
2213
2354
|
}
|
|
2214
2355
|
else if (heightElem) {
|
|
2215
|
-
|
|
2216
|
-
|
|
2356
|
+
var value = aspectRatioWidthValue / (originalWidth / originalHeight);
|
|
2357
|
+
var height = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2358
|
+
heightElem.value = height.toString();
|
|
2359
|
+
parent.aspectHeight = height;
|
|
2217
2360
|
if (widthElem && widthElem.value === '') {
|
|
2218
|
-
|
|
2219
|
-
|
|
2361
|
+
var aspectRatioHeightValue = parseFloat(heightElem.value === '' ? heightElem.placeholder : heightElem.value);
|
|
2362
|
+
value = aspectRatioHeightValue / (originalHeight / originalWidth);
|
|
2363
|
+
var width = value % 1 >= 0.5 || value % 1 <= -0.5 ? Math.round(value) : (value < 0) ? Math.ceil(value) : Math.floor(value);
|
|
2364
|
+
widthElem.value = width.toString();
|
|
2365
|
+
parent.aspectWidth = width;
|
|
2220
2366
|
}
|
|
2221
2367
|
}
|
|
2222
2368
|
}
|
|
@@ -2232,7 +2378,9 @@ var Transform = /** @class */ (function () {
|
|
|
2232
2378
|
if (isRotate) {
|
|
2233
2379
|
parent.notify('transform', { prop: 'setPreventDownScale', value: { bool: true } });
|
|
2234
2380
|
parent.notify('transform', { prop: 'resizeCrop', value: { width: args.width, height: args.height } });
|
|
2381
|
+
parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: true } });
|
|
2235
2382
|
parent.okBtn();
|
|
2383
|
+
parent.notify('undo-redo', { prop: 'setPreventUR', value: { bool: false } });
|
|
2236
2384
|
parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
|
|
2237
2385
|
height: parent.img.srcHeight };
|
|
2238
2386
|
if (isBlazor()) {
|
|
@@ -2251,6 +2399,30 @@ var Transform = /** @class */ (function () {
|
|
|
2251
2399
|
}
|
|
2252
2400
|
}
|
|
2253
2401
|
this.resizedImgAngle = parent.transform.degree;
|
|
2402
|
+
args = { previousHeight: args.previousHeight, previousWidth: args.previousWidth, width: args.width, height: args.height, isAspectRatio: args.isAspectRatio };
|
|
2403
|
+
if (isBlazor() && parent.isResizeOkBtn && parent.events && parent.events.imageResized.hasDelegate === true) {
|
|
2404
|
+
var resizeArgs = { width: args.width, height: args.height, isAspectRatio: args.isAspectRatio };
|
|
2405
|
+
parent.dotNetRef.invokeMethodAsync('OnImageResizingAsync', 'ImageResized', null, resizeArgs);
|
|
2406
|
+
}
|
|
2407
|
+
else { }
|
|
2408
|
+
};
|
|
2409
|
+
Transform.prototype.straightenImage = function (degree) {
|
|
2410
|
+
var parent = this.parent;
|
|
2411
|
+
if (parent.toolbar && parent.toolbar.length === 0) {
|
|
2412
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
2413
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
2414
|
+
}
|
|
2415
|
+
if (isBlazor()) {
|
|
2416
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2417
|
+
parent.performCropClick();
|
|
2418
|
+
}
|
|
2419
|
+
else {
|
|
2420
|
+
parent.notify('toolbar', { prop: 'performCropTransformClick', value: { shape: null } });
|
|
2421
|
+
}
|
|
2422
|
+
parent.setStraighten(degree, true);
|
|
2423
|
+
if ((isBlazor() && parent.events && parent.events.straightening.hasDelegate === false) || !isBlazor()) {
|
|
2424
|
+
parent.okBtn();
|
|
2425
|
+
}
|
|
2254
2426
|
};
|
|
2255
2427
|
return Transform;
|
|
2256
2428
|
}());
|