RED-2491 RED-2330
This commit is contained in:
parent
72e3f9813b
commit
c59641651c
@ -573,7 +573,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
this.addSubscription = timer(0, 5000).subscribe(async () => this.appStateService.reloadActiveFile());
|
||||
this.addSubscription = this.appStateService.fileReanalysed$.subscribe(async (file: File) => {
|
||||
if (file.fileId === this.fileId) {
|
||||
console.log('file', file);
|
||||
await this._loadFileData(!this._reloadFileOnReanalysis);
|
||||
this._reloadFileOnReanalysis = false;
|
||||
this._loadingService.stop();
|
||||
@ -621,9 +620,9 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
/* Get the documentElement (<html>) to display the page in fullscreen */
|
||||
|
||||
private _cleanupAndRedrawManualAnnotations() {
|
||||
this._fileDownloadService.loadActiveFileRedactionLog().subscribe(redactionLogPreview => {
|
||||
this._fileDownloadService.loadActiveFileRedactionLog().subscribe(async redactionLogPreview => {
|
||||
this.fileData.redactionLog = redactionLogPreview;
|
||||
this._annotationDrawService.drawAnnotations(
|
||||
await this._annotationDrawService.drawAnnotations(
|
||||
this._instance,
|
||||
this.annotationData.allAnnotations,
|
||||
this.hideSkipped,
|
||||
@ -635,25 +634,25 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
private async _cleanupAndRedrawManualAnnotationsForEntirePage(page: number) {
|
||||
const currentPageAnnotations = this.annotations.filter(a => a.pageNumber === page);
|
||||
const currentPageAnnotationIds = currentPageAnnotations.map(a => a.id);
|
||||
this.fileData.file = await this.appStateService.reloadActiveFile();
|
||||
|
||||
this._fileDownloadService.loadActiveFileRedactionLog().subscribe(redactionLogPreview => {
|
||||
this.fileData.redactionLog = redactionLogPreview;
|
||||
this.rebuildFilters();
|
||||
if (this.viewMode === 'STANDARD') {
|
||||
currentPageAnnotationIds.forEach(id => {
|
||||
this._findAndDeleteAnnotation(id);
|
||||
});
|
||||
const newPageAnnotations = this.annotations.filter(item => item.pageNumber === page);
|
||||
this._handleDeltaAnnotationFilters(currentPageAnnotations, newPageAnnotations);
|
||||
this._annotationDrawService.drawAnnotations(
|
||||
this._instance,
|
||||
newPageAnnotations,
|
||||
this.hideSkipped,
|
||||
this.viewerComponent.utils.isCompareMode,
|
||||
);
|
||||
}
|
||||
});
|
||||
this.fileData.file = await this.appStateService.reloadActiveFile();
|
||||
this.fileData.redactionLog = await this._fileDownloadService.loadActiveFileRedactionLog().toPromise();
|
||||
|
||||
this.rebuildFilters();
|
||||
|
||||
if (this.viewMode === 'STANDARD') {
|
||||
currentPageAnnotationIds.forEach(id => {
|
||||
this._findAndDeleteAnnotation(id);
|
||||
});
|
||||
const newPageAnnotations = this.annotations.filter(item => item.pageNumber === page);
|
||||
this._handleDeltaAnnotationFilters(currentPageAnnotations, newPageAnnotations);
|
||||
await this._annotationDrawService.drawAnnotations(
|
||||
this._instance,
|
||||
newPageAnnotations,
|
||||
this.hideSkipped,
|
||||
this.viewerComponent.utils.isCompareMode,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _handleDeltaAnnotationFilters(currentPageAnnotations: AnnotationWrapper[], newPageAnnotations: AnnotationWrapper[]) {
|
||||
|
||||
@ -126,7 +126,6 @@ export class AnnotationActionsService {
|
||||
annotations: AnnotationWrapper[],
|
||||
annotationsChanged: EventEmitter<AnnotationWrapper>,
|
||||
): Record<string, unknown>[] {
|
||||
console.log('============ get actions');
|
||||
const availableActions = [];
|
||||
|
||||
const annotationPermissions = annotations.map(annotation => ({
|
||||
|
||||
@ -7,6 +7,7 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { RedactionLogService } from './redaction-log.service';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
@Injectable()
|
||||
@ -18,23 +19,45 @@ export class AnnotationDrawService {
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
) {}
|
||||
|
||||
drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], hideSkipped = false, compareMode = false) {
|
||||
async drawAnnotations(
|
||||
activeViewer: WebViewerInstance,
|
||||
annotationWrappers: AnnotationWrapper[],
|
||||
hideSkipped = false,
|
||||
compareMode = false,
|
||||
) {
|
||||
if (!activeViewer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pdfNet = activeViewer.Core.PDFNet;
|
||||
|
||||
await pdfNet.runWithCleanup(
|
||||
async () => {
|
||||
await this._drawAnnotations(activeViewer, annotationWrappers, hideSkipped, compareMode);
|
||||
},
|
||||
environment.licenseKey ? atob(environment.licenseKey) : null,
|
||||
);
|
||||
}
|
||||
|
||||
private async _drawAnnotations(
|
||||
activeViewer: WebViewerInstance,
|
||||
annotationWrappers: AnnotationWrapper[],
|
||||
hideSkipped = false,
|
||||
compareMode = false,
|
||||
) {
|
||||
const annotations = annotationWrappers.map(annotation =>
|
||||
this._computeAnnotation(activeViewer, annotation, hideSkipped, compareMode),
|
||||
);
|
||||
const annotationManager = activeViewer.Core.annotationManager;
|
||||
annotationManager.addAnnotations(annotations, { imported: true });
|
||||
annotationManager.drawAnnotationsFromList(annotations);
|
||||
await annotationManager.drawAnnotationsFromList(annotations);
|
||||
|
||||
if (this._userPreferenceService.areDevFeaturesEnabled) {
|
||||
this._redactionLogService
|
||||
const sectionsGrid = await this._redactionLogService
|
||||
.getSectionGrid(this._dossiersService.activeDossierId, this._appStateService.activeFileId)
|
||||
.subscribe(sectionGrid => {
|
||||
this._drawSections(activeViewer, sectionGrid);
|
||||
});
|
||||
.toPromise()
|
||||
.catch(() => ({ rectanglesPerPage: {} }));
|
||||
await this._drawSections(activeViewer, sectionsGrid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +96,7 @@ export class AnnotationDrawService {
|
||||
return new activeViewer.Core.Math.Quad(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
}
|
||||
|
||||
private _drawSections(activeViewer: WebViewerInstance, sectionGrid: SectionGrid) {
|
||||
private async _drawSections(activeViewer: WebViewerInstance, sectionGrid: SectionGrid) {
|
||||
const sections = [];
|
||||
for (const page of Object.keys(sectionGrid.rectanglesPerPage)) {
|
||||
const sectionRectangles: SectionRectangle[] = sectionGrid.rectanglesPerPage[page];
|
||||
@ -86,7 +109,7 @@ export class AnnotationDrawService {
|
||||
}
|
||||
const annotationManager = activeViewer.Core.annotationManager;
|
||||
annotationManager.addAnnotations(sections, { imported: true });
|
||||
annotationManager.drawAnnotationsFromList(sections);
|
||||
await annotationManager.drawAnnotationsFromList(sections);
|
||||
}
|
||||
|
||||
private _computeSection(activeViewer: WebViewerInstance, pageNumber: number, sectionRectangle: SectionRectangle) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user