RED-10034: Removed unnecessary draw call?
This commit is contained in:
parent
7b9c0d85cd
commit
ccd008666e
@ -100,13 +100,13 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
readonly roles = Roles;
|
||||
readonly fileId = this.state.fileId;
|
||||
readonly dossierId = this.state.dossierId;
|
||||
protected readonly isDocumine = getConfig().IS_DOCUMINE;
|
||||
@ViewChild('annotationFilterTemplate', {
|
||||
read: TemplateRef,
|
||||
static: false,
|
||||
})
|
||||
private readonly _filterTemplate: TemplateRef<unknown>;
|
||||
#loadAllAnnotationsEnabled = false;
|
||||
protected readonly isDocumine = getConfig().IS_DOCUMINE;
|
||||
|
||||
constructor(
|
||||
readonly pdf: PdfViewer,
|
||||
@ -447,11 +447,11 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
this._annotationManager.delete(annotationsToDelete);
|
||||
}
|
||||
|
||||
drawChangedAnnotations(oldAnnotations: AnnotationWrapper[], newAnnotations: AnnotationWrapper[]) {
|
||||
async drawChangedAnnotations(oldAnnotations: AnnotationWrapper[], newAnnotations: AnnotationWrapper[]): Promise<void> {
|
||||
const annotationsToDraw = this.#getAnnotationsToDraw(oldAnnotations, newAnnotations);
|
||||
this._logger.info('[ANNOTATIONS] To draw: ', annotationsToDraw);
|
||||
this._annotationManager.delete(annotationsToDraw);
|
||||
return this.#cleanupAndRedrawAnnotations(annotationsToDraw);
|
||||
await this.#cleanupAndRedrawAnnotations(annotationsToDraw);
|
||||
}
|
||||
|
||||
async #openRedactTextDialog(manualRedactionEntryWrapper: ManualRedactionEntryWrapper) {
|
||||
@ -702,7 +702,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
this._errorService.set(error);
|
||||
}
|
||||
|
||||
#cleanupAndRedrawAnnotations(newAnnotations: List<AnnotationWrapper>) {
|
||||
async #cleanupAndRedrawAnnotations(newAnnotations: List<AnnotationWrapper>): Promise<void> {
|
||||
if (!newAnnotations.length) {
|
||||
return undefined;
|
||||
}
|
||||
@ -716,7 +716,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}, 100);
|
||||
}
|
||||
|
||||
return this._annotationDrawService.draw(newAnnotations, this._skippedService.hideSkipped(), this.state.dossierTemplateId);
|
||||
await this._annotationDrawService.draw(newAnnotations, this._skippedService.hideSkipped(), this.state.dossierTemplateId);
|
||||
}
|
||||
|
||||
#handleDeltaAnnotationFilters(currentFilters: NestedFilter[]) {
|
||||
|
||||
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { List } from '@iqser/common-ui/lib/utils';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { Core } from '@pdftron/webviewer';
|
||||
import { IRectangle, ISectionRectangle, IPoint, SuperTypes } from '@red/domain';
|
||||
import { IPoint, IRectangle, ISectionRectangle, SuperTypes } from '@red/domain';
|
||||
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
|
||||
import { hexToRgb } from '@utils/functions';
|
||||
import { BoundingBox, Table } from '../../file-preview/services/tables.service';
|
||||
|
||||
@ -19,14 +19,14 @@ const MOVE_OPTION = 'move';
|
||||
|
||||
@Injectable()
|
||||
export class REDAnnotationManager {
|
||||
resizingAnnotationId?: string = undefined;
|
||||
annotationHasBeenResized?: boolean = false;
|
||||
readonly #hidden = signal(new Set<string>());
|
||||
readonly hidden = this.#hidden.asReadonly();
|
||||
#manager: AnnotationManager;
|
||||
readonly #logger = inject(NGXLogger);
|
||||
readonly #annotationSelected$ = new Subject<[Annotation[], string]>();
|
||||
readonly annotationSelected$ = this.#annotationSelected$.asObservable();
|
||||
resizingAnnotationId?: string = undefined;
|
||||
annotationHasBeenResized?: boolean = false;
|
||||
readonly hidden = this.#hidden.asReadonly();
|
||||
|
||||
get selected() {
|
||||
return this.#manager.getSelectedAnnotations();
|
||||
@ -128,21 +128,15 @@ export class REDAnnotationManager {
|
||||
annotations.forEach(annotation => this.#manager.redrawAnnotation(annotation));
|
||||
}
|
||||
|
||||
add(annotations: Annotation | Annotation[]) {
|
||||
async add(annotations: Annotation | Annotation[]): Promise<void> {
|
||||
try {
|
||||
annotations = asList(annotations);
|
||||
this.#manager.addAnnotations(annotations, { imported: true });
|
||||
return this.#manager.drawAnnotationsFromList(annotations);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
showHidden() {
|
||||
const hidden = this.#getByIds([...this.hidden().values()]);
|
||||
this.show(hidden);
|
||||
}
|
||||
|
||||
#listenForAnnotationSelected() {
|
||||
this.#manager.addEventListener('annotationSelected', async (annotations: Annotation[], action: string) => {
|
||||
this.#logger.info('[PDF] Annotation selected: ', annotations, action);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { GenericService, isIqserDevMode, Toaster } from '@iqser/common-ui';
|
||||
import { EntryStates, IEntityLog, IEntityLogEntry, ISectionGrid } from '@red/domain';
|
||||
import { GenericService, Toaster } from '@iqser/common-ui';
|
||||
import { EntryStates, IEntityLog, IEntityLogEntry } from '@red/domain';
|
||||
import { firstValueFrom, of } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@ -20,10 +20,6 @@ export class EntityLogService extends GenericService<unknown> {
|
||||
return entityLog;
|
||||
}
|
||||
|
||||
getSectionGrid(dossierId: string, fileId: string) {
|
||||
return this._getOne<ISectionGrid>([dossierId, fileId], 'sectionGrid');
|
||||
}
|
||||
|
||||
#filterInvalidEntries(entityLogEntry: IEntityLogEntry[]) {
|
||||
return entityLogEntry.filter(entry => {
|
||||
entry.positions = entry.positions?.filter(p => !!p.rectangle?.length);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user