From d29d29280be4fb1f9f6d4a8452e16098e9df3928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Wed, 16 Dec 2020 20:52:16 +0200 Subject: [PATCH] Remove initially drawn annotation rectangle --- .../file/file-preview-screen/file-preview-screen.component.ts | 2 ++ .../app/screens/file/model/manual-redaction-entry.wrapper.ts | 3 ++- .../src/app/screens/file/pdf-viewer/pdf-viewer.component.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index 17838a479..8e8affcc7 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -211,6 +211,8 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { this.ngZone.run(() => { this._dialogRef = this._dialogService.openManualRedactionDialog($event, async (response: ManualAnnotationResponse) => { if (response?.annotationId) { + const annotation = this.activeViewer.annotManager.getAnnotationById(response.manualRedactionEntryWrapper.rectId); + this.activeViewer.annotManager.deleteAnnotation(annotation); this.fileData.fileStatus = await this.appStateService.reloadActiveFile(); this._cleanupAndRedrawManualAnnotations(response.annotationId); } diff --git a/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts b/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts index a8d42635a..83fc278be 100644 --- a/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts +++ b/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts @@ -5,6 +5,7 @@ export class ManualRedactionEntryWrapper { public readonly quads: any, public readonly manualRedactionEntry: ManualRedactionEntry, public readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE', - public readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT' + public readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT', + public readonly rectId?: string ) {} } diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 8af3e9585..583972f0c 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -211,7 +211,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { this.instance.disableElements(['shapeToolGroupButton']); this.instance.enableElements(['shapeToolGroupButton']); // dispatch event - this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper([quad], mre, 'REDACTION', 'RECTANGLE')); + this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper([quad], mre, 'REDACTION', 'RECTANGLE', activeAnnotation.Id)); } }); }