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