RED-5399 - fixed bugs

This commit is contained in:
Valentin Mihai 2022-10-31 21:04:20 +02:00
parent 046c2ece1b
commit 00e6ef9b8f
5 changed files with 13 additions and 17 deletions

View File

@ -241,11 +241,13 @@ export class FilePreviewScreenComponent
case ViewModes.REDACTED: {
const nonRedactionEntries = annotations.filter(a => !bool(a.getCustomData('redaction')));
if (this._readableRedactionsService.active) {
this._readableRedactionsService.makeRedactionsReadable(redactions);
this._setAnnotationsOpacity(redactions, true);
this._setAnnotationsColor(redactions, 'annotationColor');
} else {
this._setAnnotationsOpacity(redactions);
this._setAnnotationsColor(redactions, 'redactionColor');
}
this._setAnnotationsColor(redactions, 'redactionColor');
this._annotationManager.show(redactions);
this._annotationManager.hide(nonRedactionEntries);
break;

View File

@ -1,5 +1,5 @@
import { ChangeDetectorRef, Inject, Injectable, NgZone } from '@angular/core';
import { IHeaderElement, IManualRedactionEntry } from '@red/domain';
import { IHeaderElement, IManualRedactionEntry, ViewModes } from '@red/domain';
import { Core } from '@pdftron/webviewer';
import { TranslateService } from '@ngx-translate/core';
import {
@ -274,6 +274,12 @@ export class PdfProxyService {
private _handleCustomActions() {
const isCurrentPageExcluded = this._state.file.isPageExcluded(this._pdf.currentPage);
if (this._viewModeService.viewMode === ViewModes.REDACTED) {
this._viewerHeaderService.enable([HeaderElements.TOGGLE_READABLE_REDACTIONS]);
} else {
this._viewerHeaderService.disable([HeaderElements.TOGGLE_READABLE_REDACTIONS]);
}
if (this.canPerformActions && !isCurrentPageExcluded) {
try {
this._pdf.instance.UI.enableTools(['AnnotationCreateRectangle']);
@ -282,7 +288,6 @@ export class PdfProxyService {
}
this._pdf.enable(TEXT_POPUPS_TO_TOGGLE);
this._viewerHeaderService.enable(HEADER_ITEMS_TO_TOGGLE);
this._viewerHeaderService.disable([HeaderElements.TOGGLE_READABLE_REDACTIONS]);
if (this._documentViewer.selectedText.length > 2) {
this._pdf.enable([TextPopups.ADD_DICTIONARY, TextPopups.ADD_FALSE_POSITIVE]);
@ -305,7 +310,6 @@ export class PdfProxyService {
this._pdf.disable(textPopupElementsToDisable);
this._viewerHeaderService.disable(headerElementsToDisable);
this._viewerHeaderService.enable([HeaderElements.TOGGLE_READABLE_REDACTIONS]);
}
private _getManualRedaction(quads: Record<string, Quad[]>, text?: string, convertQuads = false): IManualRedactionEntry {

View File

@ -6,12 +6,8 @@ import { HeaderElements } from '../../file-preview/utils/constants';
import { PdfViewer } from './pdf-viewer.service';
import { REDAnnotationManager } from './annotation-manager.service';
import { AnnotationDrawService } from './annotation-draw.service';
import { Core } from '@pdftron/webviewer';
import Annotation = Core.Annotations.Annotation;
import { BehaviorSubject, Observable } from 'rxjs';
const READABLE_REDACTION_OPACITY = 0.4;
@Injectable()
export class ReadableRedactionsService {
readonly #enableIcon = this._convertPath('/assets/icons/general/pdftron-action-enable-tooltips.svg');
@ -43,12 +39,6 @@ export class ReadableRedactionsService {
return this.active ? this.#enableIcon : this.#disableIcon;
}
makeRedactionsReadable(redactions: Annotation[]): void {
redactions.forEach(redaction => {
redaction['Opacity'] = READABLE_REDACTION_OPACITY;
});
}
toggleReadableRedactions(): void {
this.#active$.next(!this.active);

View File

@ -26,7 +26,7 @@ export class ViewerHeaderService {
readonly #config = new Map<HeaderElementType, boolean>([
[HeaderElements.SHAPE_TOOL_GROUP_BUTTON, true],
[HeaderElements.TOGGLE_TOOLTIPS, true],
[HeaderElements.TOGGLE_READABLE_REDACTIONS, true],
[HeaderElements.TOGGLE_READABLE_REDACTIONS, false],
[HeaderElements.LOAD_ALL_ANNOTATIONS, false],
[HeaderElements.COMPARE_BUTTON, true],
[HeaderElements.CLOSE_COMPARE_BUTTON, false],

View File

@ -1771,7 +1771,7 @@
"search": "Search for selection"
}
},
"toggle-readable-redactions": "Show redactions as {active, select, true{opaque} false{transparent} other{}}",
"toggle-readable-redactions": "Show redactions {active, select, true{as in final document} false{in preview color} other{}}",
"toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips"
},
"permissions-screen": {