@syncfusion/ej2-image-editor 24.2.4 → 24.2.8
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 +20 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +328 -242
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +328 -243
- 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 +11 -11
- package/src/image-editor/action/draw.js +2 -1
- package/src/image-editor/action/selection.d.ts +2 -0
- package/src/image-editor/action/selection.js +256 -235
- package/src/image-editor/action/shape.js +56 -1
- package/src/image-editor/base/image-editor.js +12 -6
- package/src/image-editor/base/interface.d.ts +26 -2
- package/src/image-editor/renderer/toolbar.js +2 -0
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -63
- package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -39
|
@@ -35,6 +35,7 @@ var Selection = /** @class */ (function () {
|
|
|
35
35
|
this.isPinching = false;
|
|
36
36
|
this.isSliding = false;
|
|
37
37
|
this.mouseDown = '';
|
|
38
|
+
this.isSliderActive = false;
|
|
38
39
|
this.parent = parent;
|
|
39
40
|
this.addEventListener();
|
|
40
41
|
}
|
|
@@ -277,6 +278,12 @@ var Selection = /** @class */ (function () {
|
|
|
277
278
|
case 'setSliding':
|
|
278
279
|
this.isSliding = args.value['bool'];
|
|
279
280
|
break;
|
|
281
|
+
case 'setSliderActive':
|
|
282
|
+
this.isSliderActive = args.value['bool'];
|
|
283
|
+
break;
|
|
284
|
+
case 'getArrowType':
|
|
285
|
+
args.value['obj']['type'] = this.getArrowType(args.value['type']);
|
|
286
|
+
break;
|
|
280
287
|
}
|
|
281
288
|
};
|
|
282
289
|
Selection.prototype.getModuleName = function () {
|
|
@@ -324,6 +331,7 @@ var Selection = /** @class */ (function () {
|
|
|
324
331
|
this.initialPrevObj = {};
|
|
325
332
|
this.resizedElement = '';
|
|
326
333
|
this.mouseDown = '';
|
|
334
|
+
this.isSliderActive = false;
|
|
327
335
|
};
|
|
328
336
|
Selection.prototype.performTabAction = function () {
|
|
329
337
|
var parent = this.parent;
|
|
@@ -3181,272 +3189,273 @@ var Selection = /** @class */ (function () {
|
|
|
3181
3189
|
&& !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
|
|
3182
3190
|
return;
|
|
3183
3191
|
}
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
this.isTouch = false;
|
|
3190
|
-
}
|
|
3191
|
-
else if (e.type === 'touchend') {
|
|
3192
|
-
e.stopImmediatePropagation();
|
|
3193
|
-
}
|
|
3194
|
-
e.preventDefault();
|
|
3195
|
-
if (parent.togglePan) {
|
|
3196
|
-
this.canvasMouseUpHandler(e);
|
|
3197
|
-
}
|
|
3198
|
-
var x;
|
|
3199
|
-
var y;
|
|
3200
|
-
if (e.type === 'mouseup') {
|
|
3201
|
-
x = e.clientX;
|
|
3202
|
-
y = e.clientY;
|
|
3203
|
-
}
|
|
3204
|
-
else {
|
|
3205
|
-
x = this.touchEndPoint.x;
|
|
3206
|
-
y = this.touchEndPoint.y;
|
|
3207
|
-
}
|
|
3208
|
-
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
3209
|
-
x -= bbox.left;
|
|
3210
|
-
y -= bbox.top;
|
|
3211
|
-
if (e.type === 'touchend') {
|
|
3212
|
-
this.startTouches = this.tempTouches = [];
|
|
3213
|
-
this.isFirstMove = false;
|
|
3214
|
-
if (parent.textArea.style.display === 'none') {
|
|
3215
|
-
this.timer = 0;
|
|
3192
|
+
if (this.mouseDown === 'canvas' || this.isSliderActive ||
|
|
3193
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3194
|
+
e.target.closest('.e-image-editor') || e.target.closest('.e-ie-ddb-popup')) {
|
|
3195
|
+
if (e.type === 'touchstart') {
|
|
3196
|
+
this.isTouch = false;
|
|
3216
3197
|
}
|
|
3217
|
-
if (
|
|
3218
|
-
|
|
3219
|
-
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
3220
|
-
if (parent.isCropTab || parent.activeObj.shape) {
|
|
3221
|
-
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
|
|
3222
|
-
parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
|
|
3223
|
-
}
|
|
3224
|
-
if (parent.isStraightening) {
|
|
3225
|
-
parent.notify('draw', { prop: 'resetStraightenDestPoints' });
|
|
3226
|
-
parent.notify('draw', { prop: 'setDestForStraighten' });
|
|
3227
|
-
}
|
|
3228
|
-
return;
|
|
3198
|
+
else if (e.type === 'touchend') {
|
|
3199
|
+
e.stopImmediatePropagation();
|
|
3229
3200
|
}
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
if (parent.activeObj.shape !== undefined) {
|
|
3234
|
-
splitWords = parent.activeObj.shape.split('-');
|
|
3235
|
-
}
|
|
3236
|
-
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
3237
|
-
isCropSelection = true;
|
|
3238
|
-
}
|
|
3239
|
-
if (isBlazor() && parent.eventType) {
|
|
3240
|
-
if (parent.eventType === 'pan') {
|
|
3241
|
-
if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
|
|
3242
|
-
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
|
|
3243
|
-
}
|
|
3201
|
+
e.preventDefault();
|
|
3202
|
+
if (parent.togglePan) {
|
|
3203
|
+
this.canvasMouseUpHandler(e);
|
|
3244
3204
|
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then(function (shapeResizingArgs) {
|
|
3251
|
-
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
3252
|
-
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
3253
|
-
});
|
|
3254
|
-
}
|
|
3255
|
-
else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
|
|
3256
|
-
parent.events.onSelectionResizeEnd.hasDelegate === true) {
|
|
3257
|
-
var currentSelectionSettings = { type: parent.activeObj.shape,
|
|
3258
|
-
startX: this.shapeResizingArgs.currentShapeSettings.startX,
|
|
3259
|
-
startY: this.shapeResizingArgs.currentShapeSettings.startY,
|
|
3260
|
-
width: this.shapeResizingArgs.currentShapeSettings.width,
|
|
3261
|
-
height: this.shapeResizingArgs.currentShapeSettings.height };
|
|
3262
|
-
this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
|
|
3263
|
-
this.selectionResizingArgs.action = 'resize-end';
|
|
3264
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3265
|
-
parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then(function (selectionResizingArgs) {
|
|
3266
|
-
parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
|
|
3267
|
-
value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
|
|
3268
|
-
});
|
|
3269
|
-
}
|
|
3205
|
+
var x = void 0;
|
|
3206
|
+
var y = void 0;
|
|
3207
|
+
if (e.type === 'mouseup') {
|
|
3208
|
+
x = e.clientX;
|
|
3209
|
+
y = e.clientY;
|
|
3270
3210
|
}
|
|
3271
3211
|
else {
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3212
|
+
x = this.touchEndPoint.x;
|
|
3213
|
+
y = this.touchEndPoint.y;
|
|
3214
|
+
}
|
|
3215
|
+
var bbox = parent.lowerCanvas.getBoundingClientRect();
|
|
3216
|
+
x -= bbox.left;
|
|
3217
|
+
y -= bbox.top;
|
|
3218
|
+
if (e.type === 'touchend') {
|
|
3219
|
+
this.startTouches = this.tempTouches = [];
|
|
3220
|
+
this.isFirstMove = false;
|
|
3221
|
+
if (parent.textArea.style.display === 'none') {
|
|
3222
|
+
this.timer = 0;
|
|
3223
|
+
}
|
|
3224
|
+
if (this.isPinching) {
|
|
3225
|
+
this.isPinching = false;
|
|
3226
|
+
parent.notify('draw', { prop: 'redrawDownScale' });
|
|
3227
|
+
if (parent.isCropTab || parent.activeObj.shape) {
|
|
3228
|
+
parent.notify('draw', { prop: 'setStraightenActObj', value: { activeObj: null } });
|
|
3229
|
+
parent.notify('freehand-draw', { prop: 'resetStraightenPoint' });
|
|
3230
|
+
}
|
|
3231
|
+
if (parent.isStraightening) {
|
|
3232
|
+
parent.notify('draw', { prop: 'resetStraightenDestPoints' });
|
|
3233
|
+
parent.notify('draw', { prop: 'setDestForStraighten' });
|
|
3234
|
+
}
|
|
3235
|
+
return;
|
|
3280
3236
|
}
|
|
3281
3237
|
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
parent.
|
|
3285
|
-
|
|
3286
|
-
}
|
|
3287
|
-
if (this.currentDrawingShape === 'path') {
|
|
3288
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3289
|
-
var elem = e.srcElement;
|
|
3290
|
-
var elemId = elem.parentElement.id;
|
|
3291
|
-
var id_1 = parent.element.id;
|
|
3292
|
-
if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
|
|
3293
|
-
(elem.classList.contains('e-upload-icon') || elemId === id_1 + '_zoomIn' ||
|
|
3294
|
-
elemId === id_1 + '_zoomOut' || elemId === id_1 + '_annotationBtn' ||
|
|
3295
|
-
elemId === id_1 + '_borderColorBtn' || elemId === id_1 + '_borderWidthBtn' || elemId === id_1 + '_saveBtn')) {
|
|
3296
|
-
parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
|
|
3297
|
-
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3298
|
-
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
3299
|
-
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
3238
|
+
var isCropSelection = false;
|
|
3239
|
+
var splitWords = void 0;
|
|
3240
|
+
if (parent.activeObj.shape !== undefined) {
|
|
3241
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
3300
3242
|
}
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
|
|
3310
|
-
previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
|
|
3311
|
-
previousCropObj: prevCropObj_1, previousText: null,
|
|
3312
|
-
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
3243
|
+
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
3244
|
+
isCropSelection = true;
|
|
3245
|
+
}
|
|
3246
|
+
if (isBlazor() && parent.eventType) {
|
|
3247
|
+
if (parent.eventType === 'pan') {
|
|
3248
|
+
if (parent.events && parent.events.onPanEnd.hasDelegate === true) {
|
|
3249
|
+
parent.dotNetRef.invokeMethodAsync('PanEventAsync', 'OnPanEnd', parent.panEventArgs);
|
|
3250
|
+
}
|
|
3313
3251
|
}
|
|
3314
|
-
else {
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
3339
|
-
var selPointCollObj = { selPointColl: null };
|
|
3340
|
-
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
3341
|
-
value: { obj: selPointCollObj } });
|
|
3342
|
-
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
3343
|
-
if (!parent.togglePen && !isCropSelection) {
|
|
3344
|
-
if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
|
|
3345
|
-
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
3346
|
-
parent.objColl.push(parent.activeObj);
|
|
3347
|
-
if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
3348
|
-
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
3349
|
-
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
|
|
3350
|
-
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
3351
|
-
previousCropObj: prevCropObj, previousText: null,
|
|
3352
|
-
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
3252
|
+
else if (parent.eventType === 'resize') {
|
|
3253
|
+
if (!this.isCropSelection && parent.events && parent.events.onShapeResizeEnd.hasDelegate === true) {
|
|
3254
|
+
this.shapeResizingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
3255
|
+
this.shapeResizingArgs.action = this.currentDrawingShape !== '' ? 'drawing' : 'resize-end';
|
|
3256
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3257
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeResizeEnd', this.shapeResizingArgs, null).then(function (shapeResizingArgs) {
|
|
3258
|
+
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
3259
|
+
value: { shapeSettings: shapeResizingArgs.currentShapeSettings } });
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
else if (this.shapeResizingArgs && this.selectionResizingArgs && parent.events &&
|
|
3263
|
+
parent.events.onSelectionResizeEnd.hasDelegate === true) {
|
|
3264
|
+
var currentSelectionSettings = { type: parent.activeObj.shape,
|
|
3265
|
+
startX: this.shapeResizingArgs.currentShapeSettings.startX,
|
|
3266
|
+
startY: this.shapeResizingArgs.currentShapeSettings.startY,
|
|
3267
|
+
width: this.shapeResizingArgs.currentShapeSettings.width,
|
|
3268
|
+
height: this.shapeResizingArgs.currentShapeSettings.height };
|
|
3269
|
+
this.selectionResizingArgs.currentSelectionSettings = currentSelectionSettings;
|
|
3270
|
+
this.selectionResizingArgs.action = 'resize-end';
|
|
3271
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3272
|
+
parent.dotNetRef.invokeMethodAsync('SelectionEventAsync', 'OnSelectionResizeEnd', this.selectionResizingArgs).then(function (selectionResizingArgs) {
|
|
3273
|
+
parent.notify('shape', { prop: 'updateSelectionChangeEventArgs', onPropertyChange: false,
|
|
3274
|
+
value: { selectionSettings: selectionResizingArgs.currentSelectionSettings } });
|
|
3275
|
+
});
|
|
3353
3276
|
}
|
|
3354
|
-
this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
|
|
3355
|
-
this.tempObjColl = undefined;
|
|
3356
3277
|
}
|
|
3357
|
-
|
|
3358
|
-
this.
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3278
|
+
else {
|
|
3279
|
+
if (this.shapeMovingArgs && parent.events && parent.events.onShapeDragEnd.hasDelegate === true) {
|
|
3280
|
+
this.shapeMovingArgs.currentShapeSettings = this.updatePrevShapeSettings();
|
|
3281
|
+
this.shapeMovingArgs.action = 'drag-end';
|
|
3282
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3283
|
+
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShapeDragEnd', this.shapeMovingArgs, null).then(function (shapeMovingArgs) {
|
|
3284
|
+
parent.notify('shape', { prop: 'updateShapeChangeEventArgs', onPropertyChange: false,
|
|
3285
|
+
value: { shapeSettings: shapeMovingArgs.currentShapeSettings } });
|
|
3286
|
+
});
|
|
3362
3287
|
}
|
|
3363
3288
|
}
|
|
3289
|
+
this.shapeResizingArgs = null;
|
|
3290
|
+
this.shapeMovingArgs = null;
|
|
3291
|
+
parent.panEventArgs = null;
|
|
3292
|
+
parent.eventType = null;
|
|
3364
3293
|
}
|
|
3365
|
-
if (
|
|
3366
|
-
|
|
3367
|
-
var
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3294
|
+
if (this.currentDrawingShape === 'path') {
|
|
3295
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
3296
|
+
var elem = e.srcElement;
|
|
3297
|
+
var elemId = elem.parentElement.id;
|
|
3298
|
+
var id_1 = parent.element.id;
|
|
3299
|
+
if (e.currentTarget !== parent.upperCanvas && e.currentTarget !== parent.lowerCanvas && parent.activeObj.pointColl.length > 0 &&
|
|
3300
|
+
(elem.classList.contains('e-upload-icon') || elemId === id_1 + '_zoomIn' ||
|
|
3301
|
+
elemId === id_1 + '_zoomOut' || elemId === id_1 + '_annotationBtn' ||
|
|
3302
|
+
elemId === id_1 + '_borderColorBtn' || elemId === id_1 + '_borderWidthBtn' || elemId === id_1 + '_saveBtn')) {
|
|
3303
|
+
parent.notify('shape', { prop: 'stopPathDrawing', onPropertyChange: false, value: { e: e, isApply: true } });
|
|
3304
|
+
this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
|
|
3305
|
+
parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj, isCropRatio: null,
|
|
3306
|
+
points: null, isPreventDrag: true, saveContext: null, isPreventSelection: true } });
|
|
3373
3307
|
}
|
|
3374
|
-
|
|
3375
|
-
|
|
3308
|
+
return;
|
|
3309
|
+
}
|
|
3310
|
+
if (e.currentTarget === parent.upperCanvas && !parent.isResize) {
|
|
3311
|
+
this.pathAdjustedIndex = null;
|
|
3312
|
+
if (this.currentDrawingShape !== '') {
|
|
3313
|
+
if (this.currentDrawingShape === 'text') {
|
|
3314
|
+
var prevCropObj_1 = extend({}, parent.cropObj, {}, true);
|
|
3315
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
3316
|
+
value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
|
|
3317
|
+
previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
|
|
3318
|
+
previousCropObj: prevCropObj_1, previousText: null,
|
|
3319
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
3320
|
+
}
|
|
3321
|
+
else {
|
|
3322
|
+
parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
|
|
3323
|
+
}
|
|
3324
|
+
this.isShapeInserted = true;
|
|
3325
|
+
this.currentDrawingShape = '';
|
|
3326
|
+
if (parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) {
|
|
3327
|
+
parent.notify('draw', { prop: 'performCancel', value: { isContextualToolbar: null } });
|
|
3328
|
+
}
|
|
3329
|
+
var previousShapeSettings = this.updatePrevShapeSettings();
|
|
3330
|
+
var shapeResizingArgs = { cancel: false, action: 'draw-end', previousShapeSettings: previousShapeSettings };
|
|
3331
|
+
var shapeMovingArgs = { cancel: false, action: 'move', previousShapeSettings: previousShapeSettings };
|
|
3332
|
+
this.shapeResizingArgs = shapeResizingArgs;
|
|
3333
|
+
this.shapeMovingArgs = shapeMovingArgs;
|
|
3334
|
+
this.triggerShapeChange(shapeResizingArgs, shapeMovingArgs, 'mouse-up');
|
|
3335
|
+
}
|
|
3336
|
+
this.adjustActObjForLineArrow();
|
|
3337
|
+
this.updPtCollForShpRot();
|
|
3338
|
+
parent.currObjType.shape = parent.currObjType.shape.toLowerCase();
|
|
3339
|
+
var prevCropObj = extend({}, parent.cropObj, {}, true);
|
|
3340
|
+
var object = { currObj: {} };
|
|
3341
|
+
parent.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
|
|
3342
|
+
var prevObj = object['currObj'];
|
|
3343
|
+
prevObj.objColl = extend([], parent.objColl, [], true);
|
|
3344
|
+
prevObj.pointColl = extend([], parent.pointColl, [], true);
|
|
3345
|
+
prevObj.afterCropActions = extend([], parent.afterCropActions, [], true);
|
|
3346
|
+
var selPointCollObj = { selPointColl: null };
|
|
3347
|
+
parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
|
|
3348
|
+
value: { obj: selPointCollObj } });
|
|
3349
|
+
prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
|
|
3350
|
+
if (!parent.togglePen && !isCropSelection) {
|
|
3351
|
+
if (this.tempObjColl && parent.activeObj.activePoint.width !== 0) {
|
|
3352
|
+
parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
|
|
3353
|
+
parent.objColl.push(parent.activeObj);
|
|
3354
|
+
if (JSON.stringify(parent.activeObj.activePoint) !== JSON.stringify(this.tempActiveObj.activePoint)) {
|
|
3355
|
+
parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
|
|
3356
|
+
value: { operation: 'shapeTransform', previousObj: prevObj, previousObjColl: this.tempObjColl,
|
|
3357
|
+
previousPointColl: prevObj.pointColl, previousSelPointColl: prevObj.selPointColl,
|
|
3358
|
+
previousCropObj: prevCropObj, previousText: null,
|
|
3359
|
+
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
3360
|
+
}
|
|
3361
|
+
this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
|
|
3362
|
+
this.tempObjColl = undefined;
|
|
3363
|
+
}
|
|
3364
|
+
if (!this.isFhdEditing) {
|
|
3365
|
+
this.applyCurrActObj(x, y);
|
|
3366
|
+
parent.currObjType.isResize = false;
|
|
3367
|
+
if (!isBlazor()) {
|
|
3368
|
+
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3376
3371
|
}
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
var
|
|
3380
|
-
if (
|
|
3381
|
-
parent.
|
|
3382
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3372
|
+
if (parent.activeObj) {
|
|
3373
|
+
var isCropSelection_1 = false;
|
|
3374
|
+
var splitWords_1;
|
|
3375
|
+
if (parent.activeObj.shape !== undefined) {
|
|
3376
|
+
splitWords_1 = parent.activeObj.shape.split('-');
|
|
3383
3377
|
}
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3378
|
+
if (splitWords_1 === undefined && (parent.currObjType.isCustomCrop || parent.togglePen)) {
|
|
3379
|
+
isCropSelection_1 = true;
|
|
3380
|
+
}
|
|
3381
|
+
else if (splitWords_1 !== undefined && splitWords_1[0] === 'crop') {
|
|
3382
|
+
isCropSelection_1 = true;
|
|
3383
|
+
}
|
|
3384
|
+
var shape = parent.activeObj.shape;
|
|
3385
|
+
if (!isBlazor()) {
|
|
3386
|
+
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path'];
|
|
3387
|
+
if (shapeColl.indexOf(shape) > -1) {
|
|
3388
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
|
|
3389
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3390
|
+
}
|
|
3391
|
+
else if (shape === 'text') {
|
|
3392
|
+
if (parent.textArea.style.display === 'none') {
|
|
3393
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
|
|
3394
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
else if (this.isFhdEditing) {
|
|
3398
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'pen',
|
|
3387
3399
|
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3388
3400
|
}
|
|
3401
|
+
else if (!isCropSelection_1) {
|
|
3402
|
+
var eventargs = { type: 'main', isApplyBtn: null, isCropping: false, isZooming: null };
|
|
3403
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: eventargs });
|
|
3404
|
+
}
|
|
3405
|
+
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
3389
3406
|
}
|
|
3390
|
-
else
|
|
3391
|
-
|
|
3392
|
-
|
|
3407
|
+
else {
|
|
3408
|
+
var shapeColl = ['rectangle', 'ellipse', 'line', 'arrow', 'path', 'image'];
|
|
3409
|
+
if (shapeColl.indexOf(shape) > -1) {
|
|
3410
|
+
parent.updateToolbar(parent.element, parent.activeObj.shape);
|
|
3411
|
+
}
|
|
3412
|
+
else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
|
|
3413
|
+
parent.updateToolbar(parent.element, 'text');
|
|
3414
|
+
}
|
|
3393
3415
|
}
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
if (parent.activeObj.shape !== undefined) {
|
|
3419
|
+
splitWords = parent.activeObj.shape.split('-');
|
|
3420
|
+
}
|
|
3421
|
+
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
3422
|
+
isCropSelection = true;
|
|
3423
|
+
}
|
|
3424
|
+
if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
|
|
3425
|
+
parent.textArea.style.display === 'none') {
|
|
3426
|
+
if (parent.activeObj.shape === 'text') {
|
|
3427
|
+
if (!isBlazor()) {
|
|
3428
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'text',
|
|
3429
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3397
3430
|
}
|
|
3398
|
-
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
3399
3431
|
}
|
|
3400
3432
|
else {
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
}
|
|
3405
|
-
else if (parent.activeObj.shape === 'text' && parent.textArea.style.display === 'none') {
|
|
3406
|
-
parent.updateToolbar(parent.element, 'text');
|
|
3433
|
+
if (!isBlazor()) {
|
|
3434
|
+
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
|
|
3435
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3407
3436
|
}
|
|
3408
3437
|
}
|
|
3409
|
-
}
|
|
3410
|
-
}
|
|
3411
|
-
if (parent.activeObj.shape !== undefined) {
|
|
3412
|
-
splitWords = parent.activeObj.shape.split('-');
|
|
3413
|
-
}
|
|
3414
|
-
if (splitWords !== undefined && splitWords[0] === 'crop') {
|
|
3415
|
-
isCropSelection = true;
|
|
3416
|
-
}
|
|
3417
|
-
if (parent.activeObj.shape && !isCropSelection && e.currentTarget === parent.upperCanvas &&
|
|
3418
|
-
parent.textArea.style.display === 'none') {
|
|
3419
|
-
if (parent.activeObj.shape === 'text') {
|
|
3420
3438
|
if (!isBlazor()) {
|
|
3421
|
-
parent.notify('toolbar', { prop: '
|
|
3422
|
-
|
|
3439
|
+
parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
|
|
3440
|
+
parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
3423
3441
|
}
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
if (!isBlazor()) {
|
|
3427
|
-
parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
|
|
3428
|
-
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
3442
|
+
else {
|
|
3443
|
+
parent.updateToolbar(parent.element, 'quickAccessToolbar', parent.activeObj.shape);
|
|
3429
3444
|
}
|
|
3430
3445
|
}
|
|
3431
|
-
if (
|
|
3432
|
-
parent.notify('
|
|
3433
|
-
|
|
3446
|
+
if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
|
|
3447
|
+
parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
|
|
3448
|
+
value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
|
|
3434
3449
|
}
|
|
3435
3450
|
else {
|
|
3436
|
-
parent.
|
|
3451
|
+
parent.currObjType.shape = '';
|
|
3437
3452
|
}
|
|
3453
|
+
this.dragElement = '';
|
|
3454
|
+
this.mouseDown = '';
|
|
3455
|
+
this.isSliderActive = false;
|
|
3456
|
+
parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
|
|
3457
|
+
this.selMouseUpEvent();
|
|
3438
3458
|
}
|
|
3439
|
-
if (parent.togglePen && e.currentTarget === parent.upperCanvas) {
|
|
3440
|
-
parent.notify('freehand-draw', { prop: 'freehandUpHandler', onPropertyChange: false,
|
|
3441
|
-
value: { e: e, canvas: parent.upperCanvas, context: this.upperContext } });
|
|
3442
|
-
}
|
|
3443
|
-
else {
|
|
3444
|
-
parent.currObjType.shape = '';
|
|
3445
|
-
}
|
|
3446
|
-
this.dragElement = '';
|
|
3447
|
-
this.mouseDown = '';
|
|
3448
|
-
parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
|
|
3449
|
-
this.selMouseUpEvent();
|
|
3450
3459
|
};
|
|
3451
3460
|
Selection.prototype.adjustActObjForLineArrow = function (obj) {
|
|
3452
3461
|
var isAdjusted = false;
|
|
@@ -4869,7 +4878,7 @@ var Selection = /** @class */ (function () {
|
|
|
4869
4878
|
fontStyle.push('underline');
|
|
4870
4879
|
}
|
|
4871
4880
|
}
|
|
4872
|
-
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, width = _a.width, height = _a.height;
|
|
4881
|
+
var _a = parent.activeObj.activePoint, startX = _a.startX, startY = _a.startY, endX = _a.endX, endY = _a.endY, width = _a.width, height = _a.height;
|
|
4873
4882
|
var _b = parent.activeObj, keyHistory = _b.keyHistory, currIndex = _b.currIndex, shape = _b.shape, textSettings = _b.textSettings, strokeSettings = _b.strokeSettings, rotatedAngle = _b.rotatedAngle, imageElement = _b.imageElement, opacity = _b.opacity;
|
|
4874
4883
|
var shapeSettingsObj = {
|
|
4875
4884
|
id: !isNullOrUndefined(currIndex) ? currIndex : null,
|
|
@@ -4885,15 +4894,27 @@ var Selection = /** @class */ (function () {
|
|
|
4885
4894
|
fontFamily: shape === 'text' ? (textSettings ? textSettings.fontFamily : null) : null,
|
|
4886
4895
|
fontStyle: shape === 'text' ? fontStyle : null,
|
|
4887
4896
|
color: shape === 'text' ? (strokeSettings ? strokeSettings.strokeColor : null) : null,
|
|
4888
|
-
degree: shape === 'ellipse' || shape === 'rectangle' || shape === 'image' ? rotatedAngle * (180 / Math.PI) : null,
|
|
4897
|
+
degree: shape === 'ellipse' || shape === 'rectangle' || shape === 'image' || shape === 'text' ? rotatedAngle * (180 / Math.PI) : null,
|
|
4889
4898
|
imageData: shape === 'image' ? imageElement.src : null,
|
|
4890
|
-
opacity: shape === 'image' ? opacity : null
|
|
4899
|
+
opacity: shape === 'image' ? opacity : null,
|
|
4900
|
+
radiusX: shape === 'ellipse' ? width / 2 : null,
|
|
4901
|
+
radiusY: shape === 'ellipse' ? height / 2 : null,
|
|
4902
|
+
endX: shape === 'line' || shape === 'arrow' ? endX : null,
|
|
4903
|
+
endY: shape === 'line' || shape === 'arrow' ? endY : null,
|
|
4904
|
+
arrowHead: shape === 'arrow' ? this.getArrowType(parent.activeObj.start) : null,
|
|
4905
|
+
arrowTail: shape === 'arrow' ? this.getArrowType(parent.activeObj.end) : null,
|
|
4906
|
+
points: shape === 'path' ? parent.activeObj.pointColl : null
|
|
4891
4907
|
};
|
|
4892
4908
|
if (obj) {
|
|
4893
4909
|
obj['shapeSettingsObj'] = shapeSettingsObj;
|
|
4894
4910
|
}
|
|
4895
4911
|
return shapeSettingsObj;
|
|
4896
4912
|
};
|
|
4913
|
+
Selection.prototype.getArrowType = function (type) {
|
|
4914
|
+
var typeToArrowType = { 'none': 'None', 'arrow': 'Arrow', 'arrowSolid': 'SolidArrow',
|
|
4915
|
+
'circle': 'Circle', 'circleSolid': 'SolidCircle', 'square': 'Square', 'squareSolid': 'SolidSquare', 'bar': 'Bar' };
|
|
4916
|
+
return typeToArrowType["" + type];
|
|
4917
|
+
};
|
|
4897
4918
|
Selection.prototype.getRectanglePoints = function (rectX, rectY, rectWidth, rectHeight, rectAngle, pointX, pointY) {
|
|
4898
4919
|
var centerX = rectX + rectWidth / 2;
|
|
4899
4920
|
var centerY = rectY + rectHeight / 2;
|