opacity for preview

This commit is contained in:
Timo Bejan 2022-02-21 12:00:48 +02:00
parent 62e69e0e02
commit 9ecfc3df1c
2 changed files with 20 additions and 2 deletions

View File

@ -163,6 +163,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
.filter(a => a.getCustomData('changeLogRemoved') === 'false')
.filter(a => !ocrAnnotationIds.includes(a.Id));
const nonStandardEntries = annotations.filter(a => a.getCustomData('changeLogRemoved') === 'true');
this._setAnnotationsOpacity(standardEntries, true);
this._show(standardEntries);
this._hide(nonStandardEntries);
break;
@ -171,12 +172,14 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
const changeLogEntries = annotations.filter(a => a.getCustomData('changeLog') === 'true');
const nonChangeLogEntries = annotations.filter(a => a.getCustomData('changeLog') === 'false');
this._setAnnotationsColor(redactions, 'annotationColor');
this._setAnnotationsOpacity(changeLogEntries, true);
this._show(changeLogEntries);
this._hide(nonChangeLogEntries);
break;
}
case 'REDACTED': {
const nonRedactionEntries = annotations.filter(a => a.getCustomData('redaction') === 'false');
this._setAnnotationsOpacity(redactions);
this._setAnnotationsColor(redactions, 'redactionColor');
this._show(redactions);
this._hide(nonRedactionEntries);
@ -708,6 +711,12 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this._instance.Core.annotationManager.showAnnotations(annotations);
}
private _setAnnotationsOpacity(annotations: Annotation[], restoreToOriginal: boolean = false) {
annotations.forEach(annotation => {
annotation['Opacity'] = restoreToOriginal ? parseFloat(annotation.getCustomData('opacity')) : 1;
});
}
private _setAnnotationsColor(annotations: Annotation[], customData: string) {
annotations.forEach(annotation => {
annotation['StrokeColor'] = this._annotationDrawService.convertColor(this._instance, annotation.getCustomData(customData));

View File

@ -15,6 +15,10 @@ import Annotation = Core.Annotations.Annotation;
@Injectable()
export class AnnotationDrawService {
static readonly DEFAULT_RECTANGLE_ANNOTATION_OPACITY = 0.6;
static readonly DEFAULT_TEXT_ANNOTATION_OPACITY = 1;
static readonly DEFAULT_REMOVED_ANNOTATION_OPACITY = 0.2;
constructor(
private readonly _dictionariesMapService: DictionariesMapService,
private readonly _dossiersService: DossiersService,
@ -168,13 +172,17 @@ export class AnnotationDrawService {
annotationWrapper.superType,
annotationWrapper.type,
);
annotation.Opacity = annotationWrapper.isChangeLogRemoved ? 0.2 : 0.6;
annotation.Opacity = annotationWrapper.isChangeLogRemoved
? AnnotationDrawService.DEFAULT_REMOVED_ANNOTATION_OPACITY
: AnnotationDrawService.DEFAULT_RECTANGLE_ANNOTATION_OPACITY;
annotation.Height = firstPosition.height;
annotation.Intensity = 100;
} else {
annotation = new activeViewer.Core.Annotations.TextHighlightAnnotation();
annotation.Quads = this._rectanglesToQuads(annotationWrapper.positions, activeViewer, pageNumber);
annotation.Opacity = annotationWrapper.isChangeLogRemoved ? 0.2 : 1;
annotation.Opacity = annotationWrapper.isChangeLogRemoved
? AnnotationDrawService.DEFAULT_REMOVED_ANNOTATION_OPACITY
: AnnotationDrawService.DEFAULT_TEXT_ANNOTATION_OPACITY;
}
annotation.setContents(annotationWrapper.content);
@ -200,6 +208,7 @@ export class AnnotationDrawService {
annotation.setCustomData('skipped', String(annotationWrapper.isSkipped));
annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry));
annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isChangeLogRemoved));
annotation.setCustomData('opacity', String(annotation.Opacity));
annotation.setCustomData('redactionColor', String(this.getColor(activeViewer, dossierTemplateId, 'redaction', 'redaction')));
annotation.setCustomData(
'annotationColor',