From ae88ef2564c77f6ad515b670967d2644d2cb24fd Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Thu, 23 Jun 2022 20:32:24 +0300 Subject: [PATCH] RED-4346: fix value after rectangle resize --- .../services/annotation-actions.service.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index 2a0f691f4..36dd47ea4 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -420,7 +420,7 @@ export class AnnotationActionsService { async acceptResize($event: MouseEvent, annotation: AnnotationWrapper): Promise { const fileId = this._state.fileId; const textAndPositions = await this._extractTextAndPositions(annotation.id); - const text = annotation.value === 'Rectangle' ? 'Rectangle' : annotation.isImage ? 'Image' : textAndPositions.text; + const text = annotation.rectangle ? annotation.value : annotation.isImage ? 'Image' : textAndPositions.text; const data = { annotation, text }; this._dialogService.openDialog('resizeAnnotation', $event, data, (result: { comment: string; updateDictionary: boolean }) => { const resizeRequest: IResizeRequest = { @@ -572,17 +572,18 @@ export class AnnotationActionsService { text: words.join(' '), positions: rectangles, }; - } else { - const rect = toPosition( - viewerAnnotation.getPageNumber(), - this._documentViewer.getHeight(viewerAnnotation.getPageNumber()), - this._annotationDrawService.annotationToQuads(viewerAnnotation), - ); - return { - positions: [rect], - text: null, - }; } + + const position = toPosition( + viewerAnnotation.getPageNumber(), + this._documentViewer.getHeight(viewerAnnotation.getPageNumber()), + this._annotationDrawService.annotationToQuads(viewerAnnotation), + ); + + return { + positions: [position], + text: null, + }; } private async _extractTextFromRect(page: Core.PDFNet.Page, rect: Core.PDFNet.Rect) {