RED-4027: Fixed annotations sorting
This commit is contained in:
parent
5523a2a815
commit
6b3f117745
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user