fixed preview color

This commit is contained in:
Timo Bejan 2022-02-02 12:17:35 +02:00
parent 1b4d5c2c93
commit 719aabba4d
3 changed files with 26 additions and 8 deletions

View File

@ -437,8 +437,8 @@ export class PdfViewerComponent extends AutoUnsubscribe implements OnInit, OnCha
this.documentViewer.getTool('AnnotationCreateRectangle').setStyles({
StrokeThickness: 2,
StrokeColor: this._annotationDrawService.getColor(this.instance, dossierTemplateId, 'manual'),
FillColor: this._annotationDrawService.getColor(this.instance, dossierTemplateId, 'manual'),
StrokeColor: this._annotationDrawService.getAndConvertColor(this.instance, dossierTemplateId, 'manual'),
FillColor: this._annotationDrawService.getAndConvertColor(this.instance, dossierTemplateId, 'manual'),
Opacity: 0.6,
});
}

View File

@ -693,9 +693,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this._instance.Core.annotationManager.showAnnotations(annotations);
}
private _setAnnotationsColor(annotations, customData: string) {
private async _setAnnotationsColor(annotations: Annotation[], customData: string) {
annotations.forEach(annotation => {
annotation['StrokeColor'] = annotation.getCustomData(customData);
annotation['StrokeColor'] = this._annotationDrawService.convertColor(this._instance, annotation.getCustomData(customData));
});
}
}

View File

@ -59,7 +59,15 @@ export class AnnotationDrawService {
color = this._appStateService.getDictionaryColor(superType, dossierTemplateId);
break;
}
const rgbColor = hexToRgb(color);
return color;
}
public getAndConvertColor(activeViewer: WebViewerInstance, dossierTemplateId: string, superType: string, dictionary?: string) {
return this.convertColor(activeViewer, this.getColor(activeViewer, dossierTemplateId, superType, dictionary));
}
public convertColor(activeViewer: WebViewerInstance, hexColor: string) {
const rgbColor = hexToRgb(hexColor);
return new activeViewer.Core.Annotations.Color(rgbColor.r, rgbColor.g, rgbColor.b);
}
@ -131,7 +139,7 @@ export class AnnotationDrawService {
rectangleAnnot.Width = rectangle.width + 2;
rectangleAnnot.Height = rectangle.height + 2;
rectangleAnnot.ReadOnly = true;
rectangleAnnot.StrokeColor = this.getColor(activeViewer, dossierTemplateId, 'analysis', 'analysis');
rectangleAnnot.StrokeColor = this.getAndConvertColor(activeViewer, dossierTemplateId, 'analysis', 'analysis');
rectangleAnnot.StrokeThickness = 1;
return rectangleAnnot;
@ -154,7 +162,12 @@ export class AnnotationDrawService {
annotation.X = firstPosition.topLeft.x;
annotation.Y = pageHeight - (firstPosition.topLeft.y + firstPosition.height);
annotation.Width = firstPosition.width;
annotation.FillColor = this.getColor(activeViewer, dossierTemplateId, annotationWrapper.superType, annotationWrapper.type);
annotation.FillColor = this.getAndConvertColor(
activeViewer,
dossierTemplateId,
annotationWrapper.superType,
annotationWrapper.type,
);
annotation.Opacity = annotationWrapper.isChangeLogRemoved ? 0.2 : 0.6;
annotation.Height = firstPosition.height;
annotation.Intensity = 100;
@ -167,7 +180,12 @@ export class AnnotationDrawService {
annotation.setContents(annotationWrapper.content);
annotation.PageNumber = pageNumber;
annotation.StrokeColor = this.getColor(activeViewer, dossierTemplateId, annotationWrapper.superType, annotationWrapper.type);
annotation.StrokeColor = this.getAndConvertColor(
activeViewer,
dossierTemplateId,
annotationWrapper.superType,
annotationWrapper.type,
);
annotation.Id = annotationWrapper.id;
annotation.ReadOnly = true;
// change log entries are drawn lighter