Pull request #185: show fields' content when changing mode
Merge in RED/ui from RED-1054 to master * commit 'a6b0fcb191510b1d532093192ee58aff6d05deee': show fields' content when changing mode
This commit is contained in:
commit
8f95197266
@ -1,7 +1,7 @@
|
||||
import { ChangeDetectorRef, Component, HostListener, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { WebViewerInstance } from '@pdftron/webviewer';
|
||||
import { Annotations, WebViewerInstance } from '@pdftron/webviewer';
|
||||
import { PdfViewerComponent } from '../../components/pdf-viewer/pdf-viewer.component';
|
||||
import { debounce } from '@utils/debounce';
|
||||
import { MatDialogRef, MatDialogState } from '@angular/material/dialog';
|
||||
@ -129,39 +129,31 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
}
|
||||
|
||||
updateViewMode() {
|
||||
const allAnnotations = this._instance.annotManager.getAnnotationsList();
|
||||
|
||||
const redactions = allAnnotations.filter((a) => a.getCustomData('redaction'));
|
||||
const annotations = this._getAnnotations((a) => a.getCustomData('redacto-manager'));
|
||||
const redactions = annotations.filter((a) => a.getCustomData('redaction'));
|
||||
|
||||
switch (this.viewMode) {
|
||||
case 'STANDARD': {
|
||||
const standardEntries = allAnnotations.filter((a) => !a.getCustomData('changeLogRemoved'));
|
||||
const nonStandardEntries = allAnnotations.filter((a) => a.getCustomData('changeLogRemoved'));
|
||||
redactions.forEach((redaction) => {
|
||||
redaction['StrokeColor'] = redaction.getCustomData('annotationColor');
|
||||
});
|
||||
this._instance.annotManager.showAnnotations(standardEntries);
|
||||
this._instance.annotManager.hideAnnotations(nonStandardEntries);
|
||||
this._setAnnotationsColor(redactions, 'annotationColor');
|
||||
const standardEntries = annotations.filter((a) => !a.getCustomData('changeLogRemoved'));
|
||||
const nonStandardEntries = annotations.filter((a) => a.getCustomData('changeLogRemoved'));
|
||||
this._show(standardEntries);
|
||||
this._hide(nonStandardEntries);
|
||||
break;
|
||||
}
|
||||
case 'DELTA': {
|
||||
const changeLogEntries = allAnnotations.filter((a) => a.getCustomData('changeLog'));
|
||||
const nonChangeLogEntries = allAnnotations.filter((a) => !a.getCustomData('changeLog'));
|
||||
redactions.forEach((redaction) => {
|
||||
redaction['StrokeColor'] = redaction.getCustomData('annotationColor');
|
||||
});
|
||||
this._instance.annotManager.showAnnotations(changeLogEntries);
|
||||
this._instance.annotManager.hideAnnotations(nonChangeLogEntries);
|
||||
const changeLogEntries = annotations.filter((a) => a.getCustomData('changeLog'));
|
||||
const nonChangeLogEntries = annotations.filter((a) => !a.getCustomData('changeLog'));
|
||||
this._setAnnotationsColor(redactions, 'annotationColor');
|
||||
this._show(changeLogEntries);
|
||||
this._hide(nonChangeLogEntries);
|
||||
break;
|
||||
}
|
||||
case 'REDACTED': {
|
||||
const redactionEntries = allAnnotations.filter((a) => a.getCustomData('redaction'));
|
||||
const nonRedactionEntries = allAnnotations.filter((a) => !a.getCustomData('redaction'));
|
||||
redactions.forEach((redaction) => {
|
||||
redaction['StrokeColor'] = redaction.getCustomData('redactionColor');
|
||||
});
|
||||
this._instance.annotManager.showAnnotations(redactionEntries);
|
||||
this._instance.annotManager.hideAnnotations(nonRedactionEntries);
|
||||
const nonRedactionEntries = annotations.filter((a) => !a.getCustomData('redaction'));
|
||||
this._setAnnotationsColor(redactions, 'redactionColor');
|
||||
this._show(redactions);
|
||||
this._hide(nonRedactionEntries);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -580,12 +572,26 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
}
|
||||
|
||||
private _handleIgnoreAnnotationsDrawing() {
|
||||
const allAnnotations = this._instance.annotManager.getAnnotationsList();
|
||||
const ignoreAnnotations = allAnnotations.filter((a) => a.getCustomData('skipped'));
|
||||
if (this.hideSkipped) {
|
||||
this._instance.annotManager.hideAnnotations(ignoreAnnotations);
|
||||
} else {
|
||||
this._instance.annotManager.showAnnotations(ignoreAnnotations);
|
||||
}
|
||||
const ignored = this._getAnnotations((a) => a.getCustomData('skipped'));
|
||||
return this.hideSkipped ? this._hide(ignored) : this._show(ignored);
|
||||
}
|
||||
|
||||
private _getAnnotations(predicate: (value) => unknown) {
|
||||
const annotations = this._instance.annotManager.getAnnotationsList();
|
||||
return predicate ? annotations.filter(predicate) : annotations;
|
||||
}
|
||||
|
||||
private _hide(annotations: Annotations.Annotation[]): void {
|
||||
this._instance.annotManager.hideAnnotations(annotations);
|
||||
}
|
||||
|
||||
private _show(annotations: Annotations.Annotation[]): void {
|
||||
this._instance.annotManager.showAnnotations(annotations);
|
||||
}
|
||||
|
||||
private _setAnnotationsColor(annotations, customData: string) {
|
||||
annotations.forEach((annotation) => {
|
||||
annotation['StrokeColor'] = annotation.getCustomData(customData);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,6 +83,7 @@ export class AnnotationDrawService {
|
||||
highlight.Opacity = annotationWrapper.isChangeLogRemoved ? 0.2 : 1;
|
||||
highlight.Hidden = annotationWrapper.isChangeLogRemoved || (hideSkipped && annotationWrapper.isSkipped) || annotationWrapper.isOCR;
|
||||
|
||||
highlight.setCustomData('redacto-manager', true);
|
||||
highlight.setCustomData('redaction', annotationWrapper.isRedacted);
|
||||
highlight.setCustomData('skipped', annotationWrapper.isSkipped);
|
||||
highlight.setCustomData('changeLog', annotationWrapper.isChangeLogEntry);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user