From 2bf40effe3506f4c2f419743e5e3e1130541e0ca Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Wed, 9 Feb 2022 12:48:36 +0200 Subject: [PATCH] height offset --- .../services/annotation-actions.service.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-actions.service.ts index b57215858..fe8a26895 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-actions.service.ts @@ -435,7 +435,7 @@ export class AnnotationActionsService { this._annotationDrawService.annotationToQuads(viewerAnnotation, viewer); } - acceptResize( + async acceptResize( $event: MouseEvent, viewer: WebViewerInstance, annotationWrapper: AnnotationWrapper, @@ -443,6 +443,7 @@ export class AnnotationActionsService { ) { const data = { dossier: this._dossier }; const fileId = this._screenStateService.fileId; + const textAndPositions = await this._extractTextAndPositions(viewer, annotationWrapper.id); this._dialogService.openDialog('resizeAnnotation', $event, data, async (result: { comment: string }) => { const textAndPositions = await this._extractTextAndPositions(viewer, annotationWrapper.id); const text = @@ -558,18 +559,20 @@ export class AnnotationActionsService { // TODO: this is an educated guess for lines that are close together // TODO: so that we do not extract text from line above/line below - const fivePercentHeightOffset = rect.height / 20; + const percentHeightOffset = rect.height / 10; const pdfNetRect = new viewer.Core.PDFNet.Rect( rect.topLeft.x, - rect.topLeft.y + fivePercentHeightOffset, + rect.topLeft.y + percentHeightOffset, rect.topLeft.x + rect.width, - rect.topLeft.y + rect.height - fivePercentHeightOffset, + rect.topLeft.y + rect.height - percentHeightOffset, ); const quadWords = await this._extractTextFromRect(viewer, page, pdfNetRect); words.push(...quadWords); } + console.log(words.join(' ')); + return { text: words.join(' '), positions: rectangles,