diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index a576bfbfe..2e26c6346 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -273,9 +273,7 @@ export class AnnotationWrapper implements IListable { annotationWrapper.lastManualChange = lastRelevantManualChange?.manualRedactionType; annotationWrapper.pending = logEntry.state === EntryStates.PENDING; if (annotationWrapper.pending) { - const removedEntry = allLogEntries.find( - (e: IEntityLogEntry) => e.id === annotationWrapper.id && e.state === EntryStates.REMOVED, - ); + const removedEntry = allLogEntries.find((e: IEntityLogEntry) => e.id === annotationWrapper.id); logEntry.oldState = removedEntry?.state; } annotationWrapper.superType = SuperTypeMapper[logEntry.entryType][logEntry.state](logEntry); @@ -286,13 +284,14 @@ export class AnnotationWrapper implements IListable { annotationWrapper.typeLabel = dictionary?.virtual ? undefined : dictionary?.label; - if (annotationWrapper.pending) { - annotationWrapper.color = defaultColors[annotationDefaultColorConfig.analysis] as string; - } else { - const colorKey = annotationEntityColorConfig[annotationWrapper.superType]; - const defaultColor = annotationDefaultColorConfig[annotationWrapper.superType]; - annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string); + let colorKey = annotationEntityColorConfig[annotationWrapper.superType]; + if (annotationWrapper.pending && lastRelevantManualChange.manualRedactionType === ManualRedactionTypes.REMOVE_FROM_DICTIONARY) { + colorKey = annotationWrapper.isHint + ? annotationEntityColorConfig[SuperTypes.IgnoredHint] + : annotationEntityColorConfig[SuperTypes.Skipped]; } + const defaultColor = annotationDefaultColorConfig[annotationWrapper.superType]; + annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string); annotationWrapper['entry'] = logEntry; return annotationWrapper; diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index 2f51ba0c8..6589ef272 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -178,7 +178,7 @@ export class FileDataService extends EntitiesService a.id === annotation.id && !a.pending); + annotations[oldAnnotationIndex] = annotation; + continue; + } + annotations.push(annotation); } diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts index 1498b9ed4..ccafe0af3 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts @@ -11,7 +11,6 @@ import { REDDocumentViewer } from './document-viewer.service'; import { PdfViewer } from './pdf-viewer.service'; import Annotation = Core.Annotations.Annotation; import Quad = Core.Math.Quad; -import PolylineAnnotation = Core.Annotations.PolylineAnnotation; const DEFAULT_TEXT_ANNOTATION_OPACITY = 1; const DEFAULT_REMOVED_ANNOTATION_OPACITY = 0.2; @@ -129,24 +128,6 @@ export class AnnotationDrawService { return; } - if (annotationWrapper.pending) { - const polylineAnnot = this._pdf.polyline(); - polylineAnnot.ReadOnly = true; - polylineAnnot.StrokeColor = this.convertColor(annotationWrapper.color); - polylineAnnot.StrokeThickness = 4; - polylineAnnot.Id = annotationWrapper.id; - polylineAnnot.PageNumber = pageNumber; - polylineAnnot.Opacity = 0.5; - - const points = this.#computePolylinePoints(annotationWrapper.positions, annotationWrapper.pageNumber); - for (let i = 0; i < points.length; i++) { - const y = i % 2 === 1 ? points[i - 1].y : points[i].y; - polylineAnnot.addPathPoint(points[i].x, y); - } - - return polylineAnnot; - } - if (annotationWrapper.superType === SuperTypes.TextHighlight) { const rectangleAnnot = this._pdf.rectangle(); const pageHeight = this._documentViewer.getHeight(pageNumber); @@ -186,7 +167,7 @@ export class AnnotationDrawService { annotation.setCustomData('skipped', String(annotationWrapper.isSkipped)); annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry)); annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isRemoved)); - annotation.setCustomData('opacity', String(annotation.Opacity)); + annotation.setCustomData('opacity', String(!annotationWrapper.pending ? annotation.Opacity : annotation.Opacity / 2)); const redactionColor = this._defaultColorsService.getColor(dossierTemplateId, 'previewColor'); annotation.setCustomData('redactionColor', String(redactionColor)); @@ -211,24 +192,6 @@ export class AnnotationDrawService { return this._pdf.quad(x1, y1, x2, y2, x3, y3, x4, y4); } - #computePolylinePoints(positions: IRectangle[], pageNumber: number): IPoint[] { - const pageHeight = this._documentViewer.getHeight(pageNumber); - const points = [this.#topLeft(positions[0], pageHeight)]; - - for (let i = 0; i < positions.length; i++) { - points.push(this.#topRight(positions[i], pageHeight)); - points.push(this.#bottomRight(positions[i], pageHeight)); - } - - for (let i = positions.length - 1; i >= 0; i--) { - points.push(this.#bottomLeft(positions[i], pageHeight)); - points.push(this.#topLeft(positions[i], pageHeight)); - } - - points.push(this.#topRight(positions[0], pageHeight)); - return points; - } - #topLeft(rectangle: IRectangle, pageHeight: number): IPoint { const x = rectangle.topLeft.x; const y = pageHeight - (rectangle.topLeft.y + rectangle.height); diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts index 09fc4f9a7..90da413ac 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts @@ -243,10 +243,6 @@ export class PdfViewer { return new this.#instance.Core.Annotations.TextHighlightAnnotation(); } - polyline() { - return new this.#instance.Core.Annotations.PolylineAnnotation(); - } - isTextHighlight(annotation: Annotation): annotation is TextHighlightAnnotation { return annotation instanceof this.#instance.Core.Annotations.TextHighlightAnnotation; } diff --git a/libs/red-domain/src/lib/files/super-types.ts b/libs/red-domain/src/lib/files/super-types.ts index 02f2c80db..c673fc945 100644 --- a/libs/red-domain/src/lib/files/super-types.ts +++ b/libs/red-domain/src/lib/files/super-types.ts @@ -20,7 +20,9 @@ function wrongSuperTypeHandler(): never | undefined { function resolveRedactionType(entry: IEntityLogEntry, hint = false) { if (entry.state === EntryStates.PENDING && entry.oldState) { - return SuperTypeMapper[entry.entryType][entry.oldState](entry); + const oldState = entry.oldState; + delete entry.oldState; + return SuperTypeMapper[entry.entryType][oldState](entry); } const redaction = hint ? SuperTypes.Hint : SuperTypes.Redaction;