@syncfusion/ej2-image-editor 23.2.7 → 24.1.41
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 +3 -59
- 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 +7146 -4325
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +7215 -4381
- 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 +1682 -881
- 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 +921 -550
- package/src/image-editor/action/transform.d.ts +2 -0
- package/src/image-editor/action/transform.js +514 -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 +672 -171
- 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 +1371 -822
- 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
|
@@ -13,6 +13,8 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
13
13
|
this.selPoints = [];
|
|
14
14
|
this.dummyPoints = [];
|
|
15
15
|
this.tempFHDStyles = { strokeColor: null, fillColor: null, strokeWidth: null };
|
|
16
|
+
this.straightenPoint = { x: null, y: null, ratioX: null, ratioY: null };
|
|
17
|
+
this.straightenPointAngle = 0;
|
|
16
18
|
this.parent = parent;
|
|
17
19
|
this.addEventListener();
|
|
18
20
|
}
|
|
@@ -85,7 +87,12 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
85
87
|
this.panFHDColl(args.value['xDiff'], args.value['yDiff'], args.value['panRegion']);
|
|
86
88
|
break;
|
|
87
89
|
case 'updateFHDColl':
|
|
88
|
-
|
|
90
|
+
if (args.value && args.value['isPreventApply']) {
|
|
91
|
+
this.updateFHDColl(args.value['isPreventApply']);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.updateFHDColl();
|
|
95
|
+
}
|
|
89
96
|
break;
|
|
90
97
|
case 'zoomFHDColl':
|
|
91
98
|
this.zoomFHDColl(args.value['isPreventApply']);
|
|
@@ -147,6 +154,28 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
147
154
|
case 'getFreehandSelectedIndex':
|
|
148
155
|
args.value['obj']['freehandSelectedIndex'] = this.fhdSelIdx;
|
|
149
156
|
break;
|
|
157
|
+
case 'setCenterSelPoints':
|
|
158
|
+
this.setCenterSelPoints();
|
|
159
|
+
break;
|
|
160
|
+
case 'getStraightenPoint':
|
|
161
|
+
args.value['obj']['straightenPoint'] = extend({}, this.straightenPoint, {}, true);
|
|
162
|
+
break;
|
|
163
|
+
case 'setStraightenPoint':
|
|
164
|
+
this.straightenPoint.x = args.value['x'];
|
|
165
|
+
this.straightenPoint.y = args.value['y'];
|
|
166
|
+
if (args.value['ratioX'] && args.value['ratioY']) {
|
|
167
|
+
this.straightenPoint.ratioX = args.value['ratioX'];
|
|
168
|
+
this.straightenPoint.ratioY = args.value['ratioY'];
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
case 'resetStraightenPoint':
|
|
172
|
+
this.straightenPoint = { x: null, y: null, ratioX: null, ratioY: null };
|
|
173
|
+
this.prevStraightenObj = null;
|
|
174
|
+
this.straightenPointAngle = 0;
|
|
175
|
+
break;
|
|
176
|
+
case 'getStraightenPointAngle':
|
|
177
|
+
args.value['obj']['angle'] = this.straightenPointAngle;
|
|
178
|
+
break;
|
|
150
179
|
case 'reset':
|
|
151
180
|
this.reset();
|
|
152
181
|
break;
|
|
@@ -168,6 +197,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
168
197
|
this.dummyPoints = [];
|
|
169
198
|
this.freehandDownPoint = { x: 0, y: 0 };
|
|
170
199
|
this.selPointColl = {};
|
|
200
|
+
this.straightenPointAngle = 0;
|
|
171
201
|
this.fhdHovIdx = null;
|
|
172
202
|
this.pointCounter = 0;
|
|
173
203
|
this.fhdSelID = null;
|
|
@@ -175,16 +205,14 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
175
205
|
this.currFHDIdx = 0;
|
|
176
206
|
this.fhdSelIdx = null;
|
|
177
207
|
this.tempFHDStyles = { strokeColor: null, fillColor: null, strokeWidth: null };
|
|
208
|
+
this.straightenPoint = { x: null, y: null, ratioX: null, ratioY: null };
|
|
209
|
+
this.prevStraightenObj = null;
|
|
178
210
|
};
|
|
179
211
|
FreehandDrawing.prototype.getModuleName = function () {
|
|
180
212
|
return 'freehand-draw';
|
|
181
213
|
};
|
|
182
214
|
FreehandDrawing.prototype.hoverFhd = function (fillStyle, strokeWidth) {
|
|
183
215
|
var parent = this.parent;
|
|
184
|
-
parent.lowerCanvas = document.querySelector('#' + parent.element.id + '_lowerCanvas');
|
|
185
|
-
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
186
|
-
parent.upperCanvas = document.querySelector('#' + parent.element.id + '_upperCanvas');
|
|
187
|
-
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
188
216
|
var context = this.upperContext;
|
|
189
217
|
var idx = -1;
|
|
190
218
|
if (this.fhdHovIdx > -1) {
|
|
@@ -237,10 +265,11 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
237
265
|
context.lineWidth = tempLineWidth;
|
|
238
266
|
};
|
|
239
267
|
FreehandDrawing.prototype.freehandDownHandler = function (e, canvas) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this.
|
|
243
|
-
|
|
268
|
+
var parent = this.parent;
|
|
269
|
+
parent.lowerCanvas = document.querySelector('#' + parent.element.id + '_lowerCanvas');
|
|
270
|
+
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
271
|
+
parent.upperCanvas = document.querySelector('#' + parent.element.id + '_upperCanvas');
|
|
272
|
+
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
244
273
|
this.fhdObj.time = new Date().getTime();
|
|
245
274
|
this.isFreehandDrawing = true;
|
|
246
275
|
if (e.type === 'mousedown') {
|
|
@@ -253,9 +282,8 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
253
282
|
EventHandler.add(canvas, 'mousemove touchmove', this.freehandMoveHandler, this);
|
|
254
283
|
var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
|
|
255
284
|
startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
|
|
256
|
-
strokeColor:
|
|
257
|
-
|
|
258
|
-
var shapeChangingArgs = { action: 'draw-start', previousShapeSettings: shapeSettings,
|
|
285
|
+
strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth, points: null };
|
|
286
|
+
var shapeChangingArgs = { cancel: false, action: 'draw-start', previousShapeSettings: shapeSettings,
|
|
259
287
|
currentShapeSettings: shapeSettings };
|
|
260
288
|
this.triggerShapeChanging(shapeChangingArgs);
|
|
261
289
|
};
|
|
@@ -285,20 +313,14 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
285
313
|
prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
286
314
|
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
287
315
|
var selPointCollObj = { selPointColl: null };
|
|
288
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
289
|
-
value: { obj: selPointCollObj } });
|
|
316
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false, value: { obj: selPointCollObj } });
|
|
290
317
|
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
291
318
|
var fhCnt = parent.freehandCounter;
|
|
292
|
-
parent.pointColl[fhCnt] = {
|
|
293
|
-
|
|
294
|
-
parent.pointColl[fhCnt].strokeColor = parent.activeObj.strokeSettings.strokeColor;
|
|
295
|
-
parent.pointColl[fhCnt].strokeWidth = this.penStrokeWidth;
|
|
296
|
-
parent.pointColl[fhCnt].flipState = parent.transform.currFlipState;
|
|
297
|
-
parent.pointColl[fhCnt].id = 'pen_' + (this.currFHDIdx + 1);
|
|
319
|
+
parent.pointColl[fhCnt] = { points: extend([], parent.points), strokeColor: parent.activeObj.strokeSettings.strokeColor,
|
|
320
|
+
strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState, id: 'pen_' + (this.currFHDIdx + 1) };
|
|
298
321
|
parent.points = [];
|
|
299
322
|
this.dummyPoints = [];
|
|
300
|
-
this.selPointColl[fhCnt] = {};
|
|
301
|
-
this.selPointColl[fhCnt].points = extend([], this.selPoints);
|
|
323
|
+
this.selPointColl[fhCnt] = { points: extend([], this.selPoints) };
|
|
302
324
|
this.selPoints = [];
|
|
303
325
|
this.pointCounter = 0;
|
|
304
326
|
parent.freehandCounter++;
|
|
@@ -310,9 +332,9 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
310
332
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
311
333
|
var shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
|
|
312
334
|
startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
|
|
313
|
-
strokeColor:
|
|
314
|
-
points:
|
|
315
|
-
var shapeChangingArgs = { action: 'draw-end', previousShapeSettings: shapeSettings,
|
|
335
|
+
strokeColor: parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
|
|
336
|
+
points: parent.pointColl[this.currFHDIdx].points };
|
|
337
|
+
var shapeChangingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: shapeSettings,
|
|
316
338
|
currentShapeSettings: shapeSettings };
|
|
317
339
|
this.triggerShapeChanging(shapeChangingArgs);
|
|
318
340
|
this.currFHDIdx++;
|
|
@@ -345,8 +367,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
345
367
|
var startPoint;
|
|
346
368
|
var endPoint;
|
|
347
369
|
this.selPoints.push({ x: x, y: y, ratioX: (x - parent.img.destLeft) / parent.img.destWidth,
|
|
348
|
-
ratioY: (y - parent.img.destTop) / parent.img.destHeight,
|
|
349
|
-
time: this.fhdObj.time });
|
|
370
|
+
ratioY: (y - parent.img.destTop) / parent.img.destHeight, time: this.fhdObj.time });
|
|
350
371
|
if (!lastPoint || !(lastPoint && isLastPointTooClose) || mouseDown) {
|
|
351
372
|
this.fhdObj.time = new Date().getTime();
|
|
352
373
|
parent.points.push({ x: x, y: y, ratioX: (x - parent.img.destLeft) / parent.img.destWidth,
|
|
@@ -500,8 +521,9 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
500
521
|
cp2 * (1.0 - t) * t * t + endPoint * t * t * t;
|
|
501
522
|
};
|
|
502
523
|
FreehandDrawing.prototype.drawArc = function (x, y, size, context) {
|
|
503
|
-
|
|
504
|
-
|
|
524
|
+
var img = this.parent.img;
|
|
525
|
+
if ((x > img.destLeft && y > img.destTop && x < (img.destLeft + img.destWidth) &&
|
|
526
|
+
y < (img.destTop + img.destHeight) ||
|
|
505
527
|
(context !== this.lowerContext && context !== this.upperContext))) {
|
|
506
528
|
context.moveTo(x, y);
|
|
507
529
|
context.arc(x, y, size, 0, 2 * Math.PI, false);
|
|
@@ -509,18 +531,11 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
509
531
|
};
|
|
510
532
|
FreehandDrawing.prototype.freehandRedraw = function (context, points) {
|
|
511
533
|
var parent = this.parent;
|
|
512
|
-
parent.lowerCanvas = document.querySelector('#' + parent.element.id + '_lowerCanvas');
|
|
513
|
-
this.lowerContext = parent.lowerCanvas.getContext('2d');
|
|
514
|
-
parent.upperCanvas = document.querySelector('#' + parent.element.id + '_upperCanvas');
|
|
515
|
-
this.upperContext = parent.upperCanvas.getContext('2d');
|
|
516
534
|
var temp = context.filter;
|
|
517
535
|
context.filter = 'none';
|
|
518
536
|
if (points) {
|
|
519
|
-
parent.pointColl[parent.freehandCounter] = {
|
|
520
|
-
|
|
521
|
-
parent.pointColl[parent.freehandCounter].strokeColor = parent.activeObj.strokeSettings.strokeColor;
|
|
522
|
-
parent.pointColl[parent.freehandCounter].strokeWidth = this.penStrokeWidth;
|
|
523
|
-
parent.pointColl[parent.freehandCounter].flipState = parent.transform.currFlipState;
|
|
537
|
+
parent.pointColl[parent.freehandCounter] = { points: points, strokeColor: parent.activeObj.strokeSettings.strokeColor,
|
|
538
|
+
strokeWidth: this.penStrokeWidth, flipState: parent.transform.currFlipState };
|
|
524
539
|
parent.freehandCounter++;
|
|
525
540
|
}
|
|
526
541
|
if (parent.freehandCounter > 0) {
|
|
@@ -558,7 +573,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
558
573
|
}
|
|
559
574
|
context.closePath();
|
|
560
575
|
}
|
|
561
|
-
if (context
|
|
576
|
+
if (context === this.lowerContext) {
|
|
562
577
|
parent.notify('draw', { prop: 'applyFrame', value: { ctx: this.lowerContext, frame: parent.frameObj.type, preventImg: true } });
|
|
563
578
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
564
579
|
}
|
|
@@ -629,21 +644,25 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
629
644
|
};
|
|
630
645
|
FreehandDrawing.prototype.cancelFhd = function () {
|
|
631
646
|
var parent = this.parent;
|
|
647
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
648
|
+
var selectedPoint = parent.pointColl[this.fhdSelIdx];
|
|
632
649
|
if (!isBlazor()) {
|
|
633
650
|
parent.notify('toolbar', { prop: 'setSelectedFreehandColor', value: { color: '#42a5f5' } });
|
|
634
651
|
}
|
|
635
652
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
653
|
+
this.lowerContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
636
654
|
this.pointCounter = 0;
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
655
|
+
if (selectedPoint) {
|
|
656
|
+
selectedPoint.strokeColor = this.tempFHDStyles.strokeColor;
|
|
657
|
+
selectedPoint.strokeWidth = this.tempFHDStyles.strokeWidth;
|
|
658
|
+
selectedPoint.isSelected = false;
|
|
641
659
|
}
|
|
642
660
|
this.fhdHovIdx = this.fhdSelIdx = this.fhdSelID = null;
|
|
643
661
|
parent.notify('selection', { prop: 'resetFreehandDrawVariables' });
|
|
644
662
|
parent.activeObj.strokeSettings.strokeColor = this.tempFHDStyles.strokeColor;
|
|
645
663
|
parent.activeObj.strokeSettings.strokeWidth = this.penStrokeWidth = this.tempFHDStyles.strokeWidth;
|
|
646
664
|
this.tempFHDStyles = { strokeColor: null, strokeWidth: null, fillColor: null };
|
|
665
|
+
parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null } });
|
|
647
666
|
if (!isBlazor()) {
|
|
648
667
|
parent.notify('toolbar', { prop: 'refresh-main-toolbar', onPropertyChange: false });
|
|
649
668
|
}
|
|
@@ -665,11 +684,12 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
665
684
|
}
|
|
666
685
|
}
|
|
667
686
|
this.fhdSelIdx = this.fhdHovIdx;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
687
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
688
|
+
var point = parent.pointColl[this.fhdSelIdx];
|
|
689
|
+
point.isSelected = true;
|
|
690
|
+
this.fhdSelID = point.id;
|
|
691
|
+
if (point.strokeColor !== '#42a5f5') {
|
|
692
|
+
parent.activeObj.strokeSettings.strokeColor = this.tempFHDStyles.strokeColor = point.strokeColor;
|
|
673
693
|
}
|
|
674
694
|
parent.activeObj.strokeSettings.strokeWidth = this.tempFHDStyles.strokeWidth =
|
|
675
695
|
parent.pointColl[this.fhdHovIdx].strokeWidth;
|
|
@@ -677,22 +697,25 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
677
697
|
parent.notify('selection', { prop: 'getFreehandDrawEditing', onPropertyChange: false, value: { obj: obj } });
|
|
678
698
|
if (obj['bool']) {
|
|
679
699
|
var shapeSettings = { id: 'pen_' + (this.fhdSelIdx + 1), type: ShapeType.FreehandDraw,
|
|
680
|
-
startX:
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
var shapeChangingArgs = { action: 'select', previousShapeSettings: shapeSettings,
|
|
700
|
+
startX: point.points[0].x, startY: point.points[0].y, strokeColor: point.strokeColor,
|
|
701
|
+
strokeWidth: point.strokeWidth, points: point.points, opacity: point.opacity };
|
|
702
|
+
var shapeChangingArgs = { cancel: false, action: 'select', previousShapeSettings: shapeSettings,
|
|
684
703
|
currentShapeSettings: shapeSettings };
|
|
685
704
|
this.triggerShapeChanging(shapeChangingArgs);
|
|
686
705
|
}
|
|
687
706
|
else {
|
|
688
707
|
parent.okBtn();
|
|
689
708
|
}
|
|
709
|
+
if (isBlazor()) {
|
|
710
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
711
|
+
parent.getShapeValue('pen');
|
|
712
|
+
}
|
|
690
713
|
};
|
|
691
714
|
FreehandDrawing.prototype.deleteFhd = function (index, isId) {
|
|
692
715
|
var parent = this.parent;
|
|
693
716
|
if (this.isFHDIdx(index)) {
|
|
694
717
|
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
695
|
-
// eslint-disable-next-line
|
|
718
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
696
719
|
var tempPointColl = extend({}, parent.pointColl, {}, true);
|
|
697
720
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
698
721
|
var tempSelPointColl = extend({}, this.selPointColl, {}, true);
|
|
@@ -734,18 +757,31 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
734
757
|
};
|
|
735
758
|
FreehandDrawing.prototype.zoomFHDColl = function (isPreventApply) {
|
|
736
759
|
var parent = this.parent;
|
|
737
|
-
|
|
760
|
+
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
761
|
+
width: parent.img.destWidth, height: parent.img.destHeight };
|
|
762
|
+
parent.notify('shape', { prop: 'straightenShapes', onPropertyChange: false });
|
|
738
763
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
739
764
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
740
765
|
this.pointCounter = 0;
|
|
741
766
|
var len = parent.points.length;
|
|
742
767
|
for (var l = 0; l < len; l++) {
|
|
743
|
-
|
|
744
|
-
|
|
768
|
+
var point = parent.points[l];
|
|
769
|
+
point.x = this.zoomX(point.ratioX);
|
|
770
|
+
point.y = this.zoomY(point.ratioY);
|
|
745
771
|
}
|
|
746
772
|
}
|
|
747
|
-
// Updating each points for cursor styles for zoom
|
|
748
773
|
this.updateFHDCurPts();
|
|
774
|
+
if (this.straightenPoint.x && this.straightenPoint.y) {
|
|
775
|
+
this.straightenPoint.x = this.zoomX(this.straightenPoint.ratioX);
|
|
776
|
+
this.straightenPoint.y = this.zoomY(this.straightenPoint.ratioY);
|
|
777
|
+
}
|
|
778
|
+
if (parent.transform.straighten !== 0) {
|
|
779
|
+
parent.notify('shape', { prop: 'straightenFHD', onPropertyChange: false });
|
|
780
|
+
}
|
|
781
|
+
parent.img.destLeft = destPoints.startX;
|
|
782
|
+
parent.img.destTop = destPoints.startY;
|
|
783
|
+
parent.img.destWidth = destPoints.width;
|
|
784
|
+
parent.img.destHeight = destPoints.height;
|
|
749
785
|
if (isNullOrUndefined(isPreventApply)) {
|
|
750
786
|
this.freehandRedraw(this.lowerContext, null);
|
|
751
787
|
}
|
|
@@ -758,39 +794,39 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
758
794
|
this.pointCounter = 0;
|
|
759
795
|
var len = this.selPoints.length;
|
|
760
796
|
for (var l = 0; l < len; l++) {
|
|
761
|
-
|
|
762
|
-
|
|
797
|
+
var point = this.selPoints[l];
|
|
798
|
+
point.x = this.zoomX(point.ratioX);
|
|
799
|
+
point.y = this.zoomY(point.ratioY);
|
|
763
800
|
}
|
|
764
801
|
}
|
|
765
802
|
}
|
|
766
803
|
};
|
|
767
804
|
FreehandDrawing.prototype.rotateFhdColl = function () {
|
|
768
805
|
var parent = this.parent;
|
|
769
|
-
|
|
806
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
770
807
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
771
808
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
772
809
|
this.pointCounter = 0;
|
|
773
810
|
var len = parent.points.length;
|
|
774
811
|
for (var l = 0; l < len; l++) {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
812
|
+
var point = parent.points[l];
|
|
813
|
+
point.y = destTop + (destHeight * point.ratioX);
|
|
814
|
+
point.x = (destLeft + destWidth) - (destWidth * point.ratioY);
|
|
815
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
816
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
780
817
|
}
|
|
781
818
|
}
|
|
782
|
-
// Update rotation points for each point for cursor styles
|
|
783
819
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
784
820
|
if (this.selPointColl[n]) {
|
|
785
821
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
786
822
|
this.pointCounter = 0;
|
|
787
823
|
var len = this.selPoints.length;
|
|
788
824
|
for (var l = 0; l < len; l++) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
825
|
+
var point = this.selPoints[l];
|
|
826
|
+
point.y = destTop + (destHeight * point.ratioX);
|
|
827
|
+
point.x = (destLeft + destWidth) - (destWidth * point.ratioY);
|
|
828
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
829
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
794
830
|
}
|
|
795
831
|
}
|
|
796
832
|
}
|
|
@@ -814,28 +850,26 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
814
850
|
};
|
|
815
851
|
FreehandDrawing.prototype.pointsHorizontalFlip = function () {
|
|
816
852
|
var parent = this.parent;
|
|
817
|
-
|
|
853
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
818
854
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
819
855
|
if (parent.pointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
820
856
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
821
857
|
this.pointCounter = 0;
|
|
822
858
|
var len = parent.points.length;
|
|
823
859
|
for (var l = 0; l < len; l++) {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
860
|
+
var point = parent.points[l];
|
|
861
|
+
if (point.x <= destLeft + (destWidth / 2)) {
|
|
862
|
+
point.x = (destLeft + destWidth) - (point.x - destLeft);
|
|
827
863
|
}
|
|
828
|
-
else if (
|
|
829
|
-
|
|
830
|
-
parent.points[l].x);
|
|
864
|
+
else if (point.x >= destLeft + (destWidth / 2)) {
|
|
865
|
+
point.x = destLeft + (destLeft + destWidth - point.x);
|
|
831
866
|
}
|
|
832
|
-
|
|
833
|
-
|
|
867
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
868
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
834
869
|
}
|
|
835
870
|
parent.pointColl[n].shapeFlip = parent.transform.currFlipState;
|
|
836
871
|
}
|
|
837
872
|
}
|
|
838
|
-
// Update flip value for each points for cursor styles
|
|
839
873
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
840
874
|
if (this.selPointColl[n]) {
|
|
841
875
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
@@ -843,16 +877,15 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
843
877
|
this.pointCounter = 0;
|
|
844
878
|
var len = this.selPoints.length;
|
|
845
879
|
for (var l = 0; l < len; l++) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
880
|
+
var point = this.selPoints[l];
|
|
881
|
+
if (point.x <= destLeft + (destWidth / 2)) {
|
|
882
|
+
point.x = (destLeft + destWidth) - (point.x - destLeft);
|
|
849
883
|
}
|
|
850
|
-
else if (
|
|
851
|
-
|
|
852
|
-
this.selPoints[l].x);
|
|
884
|
+
else if (point.x >= destLeft + (destWidth / 2)) {
|
|
885
|
+
point.x = destLeft + (destLeft + destWidth - point.x);
|
|
853
886
|
}
|
|
854
|
-
|
|
855
|
-
|
|
887
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
888
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
856
889
|
}
|
|
857
890
|
}
|
|
858
891
|
}
|
|
@@ -861,28 +894,26 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
861
894
|
};
|
|
862
895
|
FreehandDrawing.prototype.pointsVerticalFlip = function () {
|
|
863
896
|
var parent = this.parent;
|
|
864
|
-
|
|
897
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
865
898
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
866
899
|
if (parent.pointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
867
900
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
868
901
|
this.pointCounter = 0;
|
|
869
902
|
var len = parent.points.length;
|
|
870
903
|
for (var l = 0; l < len; l++) {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
904
|
+
var point = parent.points[l];
|
|
905
|
+
if (point.y <= destTop + (destHeight / 2)) {
|
|
906
|
+
point.y = (destTop + destHeight) - (point.y - destTop);
|
|
874
907
|
}
|
|
875
|
-
else if (
|
|
876
|
-
|
|
877
|
-
parent.points[l].y);
|
|
908
|
+
else if (point.y >= destTop + (destHeight / 2)) {
|
|
909
|
+
point.y = destTop + (destTop + destHeight - point.y);
|
|
878
910
|
}
|
|
879
|
-
|
|
880
|
-
|
|
911
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
912
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
881
913
|
}
|
|
882
914
|
parent.pointColl[n].shapeFlip = parent.transform.currFlipState;
|
|
883
915
|
}
|
|
884
916
|
}
|
|
885
|
-
// Update flip value for each points for cursor styles
|
|
886
917
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
887
918
|
if (this.selPointColl[n]) {
|
|
888
919
|
if (this.selPointColl[n].shapeFlip !== parent.transform.currFlipState) {
|
|
@@ -890,48 +921,68 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
890
921
|
this.pointCounter = 0;
|
|
891
922
|
var len = this.selPoints.length;
|
|
892
923
|
for (var l = 0; l < len; l++) {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
924
|
+
var point = this.selPoints[l];
|
|
925
|
+
if (point.y <= destTop + (destHeight / 2)) {
|
|
926
|
+
point.y = (destTop + destHeight) - (point.y - destTop);
|
|
896
927
|
}
|
|
897
|
-
else if (
|
|
898
|
-
|
|
899
|
-
this.selPoints[l].y);
|
|
928
|
+
else if (point.y >= destTop + (destHeight / 2)) {
|
|
929
|
+
point.y = destTop + (destTop + destHeight - point.y);
|
|
900
930
|
}
|
|
901
|
-
|
|
902
|
-
|
|
931
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
932
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
903
933
|
}
|
|
904
934
|
}
|
|
905
935
|
}
|
|
906
936
|
}
|
|
907
937
|
this.updateFHDCurPts();
|
|
908
938
|
};
|
|
909
|
-
FreehandDrawing.prototype.updateFHDColl = function () {
|
|
939
|
+
FreehandDrawing.prototype.updateFHDColl = function (isPreventApply) {
|
|
910
940
|
var parent = this.parent;
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
941
|
+
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
942
|
+
width: parent.img.destWidth, height: parent.img.destHeight };
|
|
943
|
+
parent.notify('shape', { prop: 'straightenShapes', onPropertyChange: false });
|
|
944
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
945
|
+
for (var i = 0, iLen = parent.objColl.length; i < iLen; i++) {
|
|
946
|
+
var currObj = parent.objColl[i];
|
|
947
|
+
if (currObj.shape === 'line' || currObj.shape === 'arrow') {
|
|
948
|
+
parent.notify('shape', { prop: 'straightenShapePoints', value: { obj: currObj, isReverse: true } });
|
|
949
|
+
}
|
|
950
|
+
else if (currObj.shape === 'path') {
|
|
951
|
+
var temp = parent.transform.straighten;
|
|
952
|
+
parent.transform.straighten = -parent.transform.straighten;
|
|
953
|
+
parent.notify('shape', { prop: 'straightenPath', onPropertyChange: false, value: { obj: currObj } });
|
|
954
|
+
parent.transform.straighten = temp;
|
|
955
|
+
}
|
|
956
|
+
currObj.imageRatio = { startX: ((currObj.activePoint.startX - destLeft) /
|
|
957
|
+
destWidth), startY: ((currObj.activePoint.startY - destTop) / destHeight),
|
|
958
|
+
endX: ((currObj.activePoint.endX - destLeft) / destWidth),
|
|
959
|
+
endY: ((currObj.activePoint.endY - destTop) / destHeight),
|
|
960
|
+
width: destWidth / currObj.activePoint.width, height: destHeight /
|
|
961
|
+
currObj.activePoint.height };
|
|
962
|
+
if (currObj.shape === 'path') {
|
|
963
|
+
for (var j = 0, jLen = currObj.pointColl.length; j < jLen; j++) {
|
|
964
|
+
currObj.pointColl[j].ratioX =
|
|
965
|
+
(currObj.pointColl[j].x - destLeft) / destWidth;
|
|
966
|
+
currObj.pointColl[j].ratioY =
|
|
967
|
+
(currObj.pointColl[j].y - destTop) / destHeight;
|
|
924
968
|
}
|
|
925
969
|
}
|
|
926
970
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
927
971
|
}
|
|
972
|
+
if (parent.freehandCounter > 0 && parent.transform.straighten !== 0) {
|
|
973
|
+
var temp = parent.transform.straighten;
|
|
974
|
+
parent.transform.straighten = -parent.transform.straighten;
|
|
975
|
+
parent.notify('shape', { prop: 'straightenFHD', onPropertyChange: false });
|
|
976
|
+
parent.transform.straighten = temp;
|
|
977
|
+
}
|
|
928
978
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
929
979
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
930
980
|
this.pointCounter = 0;
|
|
931
981
|
var len = parent.points.length;
|
|
932
982
|
for (var l = 0; l < len; l++) {
|
|
933
|
-
|
|
934
|
-
|
|
983
|
+
var point = parent.points[l];
|
|
984
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
985
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
935
986
|
}
|
|
936
987
|
}
|
|
937
988
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
@@ -940,56 +991,81 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
940
991
|
this.pointCounter = 0;
|
|
941
992
|
var len = this.selPoints.length;
|
|
942
993
|
for (var l = 0; l < len; l++) {
|
|
943
|
-
|
|
944
|
-
|
|
994
|
+
var point = this.selPoints[l];
|
|
995
|
+
point.ratioX = (point.x - destLeft) / destWidth;
|
|
996
|
+
point.ratioY = (point.y - destTop) / destHeight;
|
|
945
997
|
}
|
|
946
998
|
}
|
|
947
999
|
}
|
|
1000
|
+
if (this.straightenPoint.x && this.straightenPoint.y) {
|
|
1001
|
+
this.straightenPoint.ratioX = (this.straightenPoint.x - destLeft) / destWidth;
|
|
1002
|
+
this.straightenPoint.ratioY = (this.straightenPoint.y - destTop) / destHeight;
|
|
1003
|
+
}
|
|
1004
|
+
parent.img.destLeft = destPoints.startX;
|
|
1005
|
+
parent.img.destTop = destPoints.startY;
|
|
1006
|
+
parent.img.destWidth = destPoints.width;
|
|
1007
|
+
parent.img.destHeight = destPoints.height;
|
|
1008
|
+
parent.notify('shape', { prop: 'zoomObjColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
1009
|
+
parent.notify('freehand-draw', { prop: 'zoomFHDColl', onPropertyChange: false, value: { isPreventApply: isPreventApply } });
|
|
948
1010
|
};
|
|
949
1011
|
FreehandDrawing.prototype.panFHDColl = function (xDiff, yDiff, panRegion) {
|
|
950
1012
|
var parent = this.parent;
|
|
951
|
-
// Updating point collection for panning
|
|
952
1013
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
953
1014
|
parent.points = extend([], parent.pointColl[n].points, []);
|
|
954
1015
|
this.pointCounter = 0;
|
|
955
1016
|
var len = parent.points.length;
|
|
956
1017
|
for (var l = 0; l < len; l++) {
|
|
1018
|
+
var point = parent.points[l];
|
|
957
1019
|
if (panRegion === '' || panRegion === 'vertical') {
|
|
958
|
-
|
|
1020
|
+
point.x += xDiff;
|
|
959
1021
|
}
|
|
960
1022
|
else {
|
|
961
|
-
|
|
1023
|
+
point.x -= xDiff;
|
|
962
1024
|
}
|
|
963
1025
|
if (panRegion === '' || panRegion === 'horizontal') {
|
|
964
|
-
|
|
1026
|
+
point.y += yDiff;
|
|
965
1027
|
}
|
|
966
1028
|
else {
|
|
967
|
-
|
|
1029
|
+
point.y -= yDiff;
|
|
968
1030
|
}
|
|
969
1031
|
}
|
|
970
1032
|
}
|
|
971
|
-
// Updating each points for cursor styles for panning
|
|
972
1033
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
973
1034
|
if (this.selPointColl[n]) {
|
|
974
1035
|
this.selPoints = extend([], this.selPointColl[n].points, []);
|
|
975
1036
|
this.pointCounter = 0;
|
|
976
1037
|
var len = this.selPoints.length;
|
|
977
1038
|
for (var l = 0; l < len; l++) {
|
|
1039
|
+
var point = this.selPoints[l];
|
|
978
1040
|
if (panRegion === '' || panRegion === 'vertical') {
|
|
979
|
-
|
|
1041
|
+
point.x += xDiff;
|
|
980
1042
|
}
|
|
981
1043
|
else {
|
|
982
|
-
|
|
1044
|
+
point.x -= xDiff;
|
|
983
1045
|
}
|
|
984
1046
|
if (panRegion === '' || panRegion === 'horizontal') {
|
|
985
|
-
|
|
1047
|
+
point.y += yDiff;
|
|
986
1048
|
}
|
|
987
1049
|
else {
|
|
988
|
-
|
|
1050
|
+
point.y -= yDiff;
|
|
989
1051
|
}
|
|
990
1052
|
}
|
|
991
1053
|
}
|
|
992
1054
|
}
|
|
1055
|
+
if (this.straightenPoint.x && this.straightenPoint.y) {
|
|
1056
|
+
if (panRegion === '' || panRegion === 'vertical') {
|
|
1057
|
+
this.straightenPoint.x += xDiff;
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
this.straightenPoint.x -= xDiff;
|
|
1061
|
+
}
|
|
1062
|
+
if (panRegion === '' || panRegion === 'horizontal') {
|
|
1063
|
+
this.straightenPoint.y += yDiff;
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
this.straightenPoint.y -= yDiff;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
993
1069
|
this.freehandRedraw(this.lowerContext, null);
|
|
994
1070
|
};
|
|
995
1071
|
FreehandDrawing.prototype.freeHandDraw = function (value) {
|
|
@@ -1008,7 +1084,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
1008
1084
|
parent.activeObj.strokeSettings = obj['strokeSettings'];
|
|
1009
1085
|
}
|
|
1010
1086
|
if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
|
|
1011
|
-
parent.activeObj.strokeSettings.strokeWidth =
|
|
1087
|
+
parent.activeObj.strokeSettings.strokeWidth = 2;
|
|
1012
1088
|
}
|
|
1013
1089
|
if (!isBlazor()) {
|
|
1014
1090
|
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
@@ -1047,6 +1123,7 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
1047
1123
|
};
|
|
1048
1124
|
FreehandDrawing.prototype.updateCropPtsForSel = function () {
|
|
1049
1125
|
var parent = this.parent;
|
|
1126
|
+
var actPoint = parent.activeObj.activePoint;
|
|
1050
1127
|
for (var n = 0; n < parent.freehandCounter; n++) {
|
|
1051
1128
|
var obj = { selPointColl: extend([], this.selPointColl) };
|
|
1052
1129
|
if (obj['selPointColl'][n]) {
|
|
@@ -1054,20 +1131,21 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
1054
1131
|
this.pointCounter = 0;
|
|
1055
1132
|
var len = this.selPoints.length;
|
|
1056
1133
|
for (var l = 0; l < len; l++) {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
parent.activeObj.activePoint.startY) / parent.activeObj.activePoint.height;
|
|
1134
|
+
var point = this.selPoints[l];
|
|
1135
|
+
point.ratioX = (point.x - actPoint.startX) / actPoint.width;
|
|
1136
|
+
point.ratioY = (point.y - actPoint.startY) / actPoint.height;
|
|
1061
1137
|
}
|
|
1062
1138
|
}
|
|
1063
1139
|
}
|
|
1064
1140
|
};
|
|
1065
1141
|
FreehandDrawing.prototype.triggerShapeChanging = function (shapeChangingArgs) {
|
|
1066
1142
|
var _this = this;
|
|
1143
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1067
1144
|
var parent = this.parent;
|
|
1145
|
+
var point = parent.pointColl[this.fhdSelIdx];
|
|
1068
1146
|
if (isBlazor() && parent.events && parent.events.shapeChanging.hasDelegate === true) {
|
|
1069
1147
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
1070
|
-
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then(function (shapeChangingArgs) {
|
|
1148
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then(function (shapeChangingArgs) {
|
|
1071
1149
|
_this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
1072
1150
|
if (parent.activeObj.strokeSettings.strokeColor !== shapeChangingArgs.currentShapeSettings.strokeColor) {
|
|
1073
1151
|
parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
@@ -1077,9 +1155,10 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
1077
1155
|
}
|
|
1078
1156
|
}
|
|
1079
1157
|
if (_this.fhdSelID) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1158
|
+
point.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
1159
|
+
point.strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
1160
|
+
point.points = shapeChangingArgs.currentShapeSettings.points;
|
|
1161
|
+
point.opacity = shapeChangingArgs.currentShapeSettings.opacity;
|
|
1083
1162
|
}
|
|
1084
1163
|
if (shapeChangingArgs.action === 'select') {
|
|
1085
1164
|
_this.freehandRedraw(_this.upperContext);
|
|
@@ -1096,9 +1175,10 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
1096
1175
|
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
1097
1176
|
}
|
|
1098
1177
|
if (this.fhdSelID) {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1178
|
+
point.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
1179
|
+
point.strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
1180
|
+
point.points = shapeChangingArgs.currentShapeSettings.points;
|
|
1181
|
+
point.opacity = shapeChangingArgs.currentShapeSettings.opacity;
|
|
1102
1182
|
}
|
|
1103
1183
|
if (shapeChangingArgs.action === 'select') {
|
|
1104
1184
|
this.freehandRedraw(this.upperContext);
|
|
@@ -1107,6 +1187,27 @@ var FreehandDrawing = /** @class */ (function () {
|
|
|
1107
1187
|
}
|
|
1108
1188
|
}
|
|
1109
1189
|
};
|
|
1190
|
+
FreehandDrawing.prototype.setCenterSelPoints = function () {
|
|
1191
|
+
var parent = this.parent;
|
|
1192
|
+
var destPoints = { startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
1193
|
+
width: parent.img.destWidth, height: parent.img.destHeight };
|
|
1194
|
+
parent.notify('shape', { prop: 'straightenShapes', onPropertyChange: false });
|
|
1195
|
+
var _a = parent.img, destLeft = _a.destLeft, destTop = _a.destTop, destWidth = _a.destWidth, destHeight = _a.destHeight;
|
|
1196
|
+
var actPoint = parent.activeObj.activePoint;
|
|
1197
|
+
if (isNullOrUndefined(this.prevStraightenObj) ||
|
|
1198
|
+
(JSON.stringify(this.prevStraightenObj.activePoint) !== JSON.stringify(actPoint))) {
|
|
1199
|
+
this.straightenPoint = { x: actPoint.startX + (actPoint.width / 2),
|
|
1200
|
+
y: actPoint.startY + (actPoint.height / 2),
|
|
1201
|
+
ratioX: (actPoint.startX + (actPoint.width / 2) - destLeft) / destWidth,
|
|
1202
|
+
ratioY: (actPoint.startY + (actPoint.height / 2) - destTop) / destHeight };
|
|
1203
|
+
this.prevStraightenObj = extend({}, parent.activeObj, {}, true);
|
|
1204
|
+
this.straightenPointAngle = parent.transform.straighten;
|
|
1205
|
+
}
|
|
1206
|
+
parent.img.destLeft = destPoints.startX;
|
|
1207
|
+
parent.img.destTop = destPoints.startY;
|
|
1208
|
+
parent.img.destWidth = destPoints.width;
|
|
1209
|
+
parent.img.destHeight = destPoints.height;
|
|
1210
|
+
};
|
|
1110
1211
|
return FreehandDrawing;
|
|
1111
1212
|
}());
|
|
1112
1213
|
export { FreehandDrawing };
|