@syncfusion/ej2-image-editor 24.2.3 → 24.2.5

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