annotation filter expansion
This commit is contained in:
parent
bc8eab3e92
commit
2e8c73d21a
@ -538,8 +538,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
.pipe(filter(file => file.fileId === this.fileId))
|
.pipe(filter(file => file.fileId === this.fileId))
|
||||||
.subscribe(async file => {
|
.subscribe(async file => {
|
||||||
if (file.lastProcessed !== this.fileData?.file.lastProcessed) {
|
if (file.lastProcessed !== this.fileData?.file.lastProcessed) {
|
||||||
|
const previousAnnotations = this.visibleAnnotations;
|
||||||
await this._loadFileData(file);
|
await this._loadFileData(file);
|
||||||
await this._reloadAnnotations();
|
await this._reloadAnnotations(previousAnnotations);
|
||||||
}
|
}
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
});
|
});
|
||||||
@ -591,13 +592,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
this._workloadComponent?.scrollAnnotations();
|
this._workloadComponent?.scrollAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _reloadAnnotations() {
|
private async _reloadAnnotations(previousAnnotations?: AnnotationWrapper[]) {
|
||||||
this.fileData.redactionLog = await this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).toPromise();
|
this._deleteAnnotations();
|
||||||
this._instance.Core.annotationManager.deleteAnnotations(this._instance.Core.annotationManager.getAnnotationsList(), {
|
await this._cleanupAndRedrawAnnotations(previousAnnotations);
|
||||||
imported: true,
|
|
||||||
force: true,
|
|
||||||
});
|
|
||||||
await this._cleanupAndRedrawAnnotations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _reloadAnnotationsForPage(page: number) {
|
private async _reloadAnnotationsForPage(page: number) {
|
||||||
@ -612,22 +609,32 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
const currentPageAnnotations = this.visibleAnnotations.filter(a => a.pageNumber === page);
|
const currentPageAnnotations = this.visibleAnnotations.filter(a => a.pageNumber === page);
|
||||||
this.fileData.redactionLog = await this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).toPromise();
|
this.fileData.redactionLog = await this._fileDownloadService.loadRedactionLogFor(this.dossierId, this.fileId).toPromise();
|
||||||
|
|
||||||
|
this._deleteAnnotations(currentPageAnnotations);
|
||||||
await this._cleanupAndRedrawAnnotations(currentPageAnnotations, annotation => annotation.pageNumber === page);
|
await this._cleanupAndRedrawAnnotations(currentPageAnnotations, annotation => annotation.pageNumber === page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _deleteAnnotations(annotationsToDelete?: AnnotationWrapper[]) {
|
||||||
|
if (!annotationsToDelete) {
|
||||||
|
this._instance.Core.annotationManager.deleteAnnotations(this._instance.Core.annotationManager.getAnnotationsList(), {
|
||||||
|
imported: true,
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
annotationsToDelete?.forEach(annotation => {
|
||||||
|
this._findAndDeleteAnnotation(annotation.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private async _cleanupAndRedrawAnnotations(
|
private async _cleanupAndRedrawAnnotations(
|
||||||
annotationsToDelete?: AnnotationWrapper[],
|
currentAnnotations?: AnnotationWrapper[],
|
||||||
newAnnotationsFilter?: (annotation: AnnotationWrapper) => boolean,
|
newAnnotationsFilter?: (annotation: AnnotationWrapper) => boolean,
|
||||||
) {
|
) {
|
||||||
this.rebuildFilters();
|
this.rebuildFilters();
|
||||||
|
|
||||||
if (this.viewModeService.viewMode === 'STANDARD') {
|
if (this.viewModeService.viewMode === 'STANDARD') {
|
||||||
const startTime = new Date().getTime();
|
const startTime = new Date().getTime();
|
||||||
annotationsToDelete?.forEach(annotation => {
|
const newAnnotations = newAnnotationsFilter ? this.visibleAnnotations.filter(newAnnotationsFilter) : this.visibleAnnotations;
|
||||||
this._findAndDeleteAnnotation(annotation.id);
|
this._handleDeltaAnnotationFilters(currentAnnotations ?? [], newAnnotations);
|
||||||
});
|
|
||||||
const newAnnotations = newAnnotationsFilter ? this.allAnnotations.filter(newAnnotationsFilter) : this.allAnnotations;
|
|
||||||
this._handleDeltaAnnotationFilters(annotationsToDelete ?? [], newAnnotations);
|
|
||||||
await this._redrawAnnotations(newAnnotations);
|
await this._redrawAnnotations(newAnnotations);
|
||||||
console.log(
|
console.log(
|
||||||
`[REDACTION] Annotations redraw time: ${new Date().getTime() - startTime} ms for ${newAnnotations.length} annotations`,
|
`[REDACTION] Annotations redraw time: ${new Date().getTime() - startTime} ms for ${newAnnotations.length} annotations`,
|
||||||
@ -658,7 +665,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
|||||||
const oldPageSpecificFilters = this._annotationProcessingService.getAnnotationFilter(currentPageAnnotations);
|
const oldPageSpecificFilters = this._annotationProcessingService.getAnnotationFilter(currentPageAnnotations);
|
||||||
const newPageSpecificFilters = this._annotationProcessingService.getAnnotationFilter(newPageAnnotations);
|
const newPageSpecificFilters = this._annotationProcessingService.getAnnotationFilter(newPageAnnotations);
|
||||||
|
|
||||||
console.log(currentPageAnnotations, newPageAnnotations);
|
|
||||||
handleFilterDelta(oldPageSpecificFilters, newPageSpecificFilters, primaryFilters);
|
handleFilterDelta(oldPageSpecificFilters, newPageSpecificFilters, primaryFilters);
|
||||||
this._filterService.addFilterGroup({
|
this._filterService.addFilterGroup({
|
||||||
...primaryFilterGroup,
|
...primaryFilterGroup,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user