diff --git a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts index 6886c42eb..5bda73779 100644 --- a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts @@ -205,15 +205,17 @@ export class AnnotationProcessingService { private _checkByFilterKey = (filter: NestedFilter | IFilter, annotation: AnnotationWrapper) => filter.id === annotation.filterKey; private _sortAnnotations(annotations: AnnotationWrapper[]): AnnotationWrapper[] { - return annotations.sort((ann1, ann2) => { - if (ann1.pageNumber === ann2.pageNumber) { - if (ann1.y === ann2.y) { - return ann1.x < ann2.x ? 1 : -1; + return annotations.sort((first, second) => { + if (first.pageNumber === second.pageNumber) { + if (first.y > second.y) { + return -1; + } else if (first.y < second.y) { + return 1; } else { - return ann1.y < ann2.y ? 1 : -1; + return first.x < second.x ? -1 : 1; } } - return ann1.pageNumber < ann2.pageNumber ? -1 : 1; + return first.pageNumber < second.pageNumber ? -1 : 1; }); } } diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts index edd66edb7..b620bfca7 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts @@ -7,7 +7,6 @@ import { Input, OnChanges, Output, - SimpleChanges, TemplateRef, } from '@angular/core'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; @@ -49,11 +48,7 @@ export class AnnotationsListComponent extends HasScrollbarDirective implements O super(_elementRef, _changeDetector); } - ngOnChanges(changes?: SimpleChanges): void { - if (changes.annotations && this.annotations && !this._viewModeService.isTextHighlights) { - this.annotations = this.annotations.sort(this.annotationsPositionCompare); - } - + ngOnChanges(): void { if (this._viewModeService.isTextHighlights) { this._updateHighlightGroups(); } @@ -92,16 +87,6 @@ export class AnnotationsListComponent extends HasScrollbarDirective implements O } } - annotationsPositionCompare(first: AnnotationWrapper, second: AnnotationWrapper): number { - if (first.y > second.y) { - return -1; - } else if (first.y < second.y) { - return 1; - } else { - return first.x < second.x ? -1 : 1; - } - } - showHighlightGroup(idx: number): TextHighlightsGroup { return this._viewModeService.isTextHighlights && this.highlightGroups$.value.find(h => h.startIdx === idx); } diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts index 75203612f..be00a494a 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts @@ -383,7 +383,7 @@ export class FileWorkloadComponent { } else { this.displayedPages = this.#allPages; } - this.displayedPages = this.displayedPages.sort((a, b) => a - b); + this.displayedPages.sort((a, b) => a - b); return this.displayedAnnotations; }