RED-3800 run update view mode on view mode change
This commit is contained in:
parent
a942939af0
commit
aeebd0a5f7
@ -5,7 +5,6 @@ import {
|
||||
effect,
|
||||
ElementRef,
|
||||
HostListener,
|
||||
Injector,
|
||||
NgZone,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
@ -139,7 +138,6 @@ export class FilePreviewScreenComponent
|
||||
private readonly _helpModeService: HelpModeService,
|
||||
private readonly _suggestionsService: SuggestionsService,
|
||||
private readonly _dialog: MatDialog,
|
||||
private readonly _injector: Injector,
|
||||
) {
|
||||
super();
|
||||
effect(() => {
|
||||
@ -175,6 +173,12 @@ export class FilePreviewScreenComponent
|
||||
this.pdf.disable(textActions);
|
||||
}
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
if (this._viewModeService.viewMode()) {
|
||||
this.updateViewMode().then();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get changed() {
|
||||
@ -469,9 +473,8 @@ export class FilePreviewScreenComponent
|
||||
return combineLatest([currentPageAnnotations$, this._documentViewer.loaded$]).pipe(
|
||||
filter(([, loaded]) => loaded),
|
||||
map(([annotations]) => annotations),
|
||||
map(annotations => this.drawChangedAnnotations(...annotations)),
|
||||
tap(annotations => this.drawChangedAnnotations(...annotations)?.then(() => this.updateViewMode())),
|
||||
tap(([, newAnnotations]) => this.#highlightSelectedAnnotations(newAnnotations)),
|
||||
tap(() => this.updateViewMode()),
|
||||
);
|
||||
}
|
||||
|
||||
@ -489,8 +492,7 @@ export class FilePreviewScreenComponent
|
||||
const annotationsToDraw = this.#getAnnotationsToDraw(oldAnnotations, newAnnotations);
|
||||
this._logger.info('[ANNOTATIONS] To draw: ', annotationsToDraw);
|
||||
this._annotationManager.delete(annotationsToDraw);
|
||||
this.#cleanupAndRedrawAnnotations(annotationsToDraw);
|
||||
return [oldAnnotations, newAnnotations];
|
||||
return this.#cleanupAndRedrawAnnotations(annotationsToDraw);
|
||||
}
|
||||
|
||||
@Debounce(30)
|
||||
@ -670,12 +672,12 @@ export class FilePreviewScreenComponent
|
||||
|
||||
return of([true, annotations] as const);
|
||||
}),
|
||||
map(([confirmed, annotations]) => {
|
||||
if (confirmed) {
|
||||
this.drawChangedAnnotations([], annotations);
|
||||
filter(([confirmed]) => confirmed),
|
||||
map(([, annotations]) => {
|
||||
this.drawChangedAnnotations([], annotations).then(() => {
|
||||
this._toaster.success(_('load-all-annotations-success'));
|
||||
this._viewerHeaderService.disableLoadAllAnnotations();
|
||||
}
|
||||
});
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
@ -721,7 +723,7 @@ export class FilePreviewScreenComponent
|
||||
|
||||
#cleanupAndRedrawAnnotations(newAnnotations: List<AnnotationWrapper>) {
|
||||
if (!newAnnotations.length) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const currentFilters = this._filterService.getGroup('primaryFilters')?.filters || [];
|
||||
@ -731,7 +733,7 @@ export class FilePreviewScreenComponent
|
||||
this.#handleDeltaAnnotationFilters(currentFilters);
|
||||
}
|
||||
|
||||
this._annotationDrawService.draw(newAnnotations, this._skippedService.hideSkipped(), this.state.dossierTemplateId).then();
|
||||
return this._annotationDrawService.draw(newAnnotations, this._skippedService.hideSkipped(), this.state.dossierTemplateId);
|
||||
}
|
||||
|
||||
#handleDeltaAnnotationFilters(currentFilters: NestedFilter[]) {
|
||||
|
||||
@ -2,11 +2,10 @@ import { Injectable } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { bool } from '@iqser/common-ui';
|
||||
import { Core } from '@pdftron/webviewer';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
import { REDAnnotationManager } from '../../pdf-viewer/services/annotation-manager.service';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { AnnotationDrawService } from '../../pdf-viewer/services/annotation-draw.service';
|
||||
import { ReadableRedactionsService } from '../../pdf-viewer/services/readable-redactions.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
@Injectable()
|
||||
export class SuggestionsService {
|
||||
@ -15,7 +14,6 @@ export class SuggestionsService {
|
||||
constructor(
|
||||
private readonly _annotationManager: REDAnnotationManager,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _annotationDrawService: AnnotationDrawService,
|
||||
private readonly _readableRedactionsService: ReadableRedactionsService,
|
||||
) {}
|
||||
|
||||
|
||||
@ -7,9 +7,7 @@ import { RedactionLogService } from '@services/files/redaction-log.service';
|
||||
|
||||
import { IRectangle, ISectionGrid, ISectionRectangle, SuperTypes } from '@red/domain';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
import { PdfViewer } from './pdf-viewer.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { REDAnnotationManager } from './annotation-manager.service';
|
||||
import { List } from '@iqser/common-ui';
|
||||
import { REDDocumentViewer } from './document-viewer.service';
|
||||
@ -23,10 +21,8 @@ const DEFAULT_REMOVED_ANNOTATION_OPACITY = 0.2;
|
||||
@Injectable()
|
||||
export class AnnotationDrawService {
|
||||
constructor(
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
private readonly _redactionLogService: RedactionLogService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _activatedRoute: ActivatedRoute,
|
||||
private readonly _annotationManager: REDAnnotationManager,
|
||||
private readonly _pdf: PdfViewer,
|
||||
private readonly _documentViewer: REDDocumentViewer,
|
||||
@ -35,7 +31,7 @@ export class AnnotationDrawService {
|
||||
|
||||
async draw(annotations: List<AnnotationWrapper>, hideSkipped: boolean, dossierTemplateId: string) {
|
||||
try {
|
||||
this._pdf.runWithCleanup(() => this._draw(annotations, hideSkipped, dossierTemplateId)).then();
|
||||
return this._pdf.runWithCleanup(() => this._draw(annotations, hideSkipped, dossierTemplateId));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user