RED-6240 - Use Applied Redaction Color in Preview mode

This commit is contained in:
Valentin Mihai 2023-04-03 15:58:20 +03:00
parent 9e0c852a9a
commit 21d1cc6507
2 changed files with 7 additions and 12 deletions

View File

@ -247,10 +247,8 @@ export class FilePreviewScreenComponent
const nonRedactionEntries = annotations.filter(
a => !bool(a.getCustomData('redaction')) || bool(a.getCustomData('changeLogRemoved')),
);
if (this._readableRedactionsService.active) {
this._readableRedactionsService.setAnnotationsColor(redactions, 'redactionColor');
this._readableRedactionsService.setAnnotationsOpacity(redactions);
}
this._readableRedactionsService.setAnnotationsColor(redactions, 'redactionColor');
this._readableRedactionsService.setAnnotationsOpacity(redactions);
this._annotationManager.show(redactions);
this._annotationManager.hide(nonRedactionEntries);
this._suggestionsService.hideSuggestionsInPreview(redactions);

View File

@ -63,14 +63,11 @@ export class ReadableRedactionsService {
(ctx: CanvasRenderingContext2D, pageMatrix, rotation, options) => {
const annotation = options.annotation;
ctx.globalCompositeOperation = 'source-over';
(options.annotation as any).Quads.forEach(q => {
const yMin = Math.min(q.y1, q.y2, q.y3, q.y4);
const height = Math.sqrt(Math.pow(q.x1 - q.x4, 2) + Math.pow(q.y1 - q.y4, 2));
const width = Math.sqrt(Math.pow(q.x1 - q.x2, 2) + Math.pow(q.y1 - q.y2, 2));
ctx.fillStyle = annotation.getCustomData('redactionColor');
ctx.fillRect(q.x1, yMin, width, height);
});
ctx.fillStyle = annotation.getCustomData('redactionColor');
ctx.fillRect(annotation.getX(), annotation.getY(), annotation.getWidth(), annotation.getHeight());
},
{
generateAppearance: false,
},
);
}