diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.scss b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.scss index 36304a969..76eb01385 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.scss +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.scss @@ -58,14 +58,17 @@ } } - &:hover, - &.help-mode { + &:hover { background-color: var(--iqser-annotation-hover); ::ng-deep .annotation-actions { display: flex; } } + + &.active { + background-color: var(--iqser-annotation-hover); + } } .hide-comments { diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html index f5cc9ecf5..6dcee8419 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html @@ -162,7 +162,6 @@ #annotationsElement (keydown)="preventKeyDefault($event)" (keyup)="preventKeyDefault($event)" - [class.active-panel]="!pagesPanelActive" [hidden]="excludedPagesService.shown()" class="annotations" id="annotations-list" 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 3bc1ba7b9..f72d24724 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 @@ -94,6 +94,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On protected displayedPages: number[] = []; protected pagesPanelActive = true; protected enabledFilters = []; + #displayedPagesChanged = false; constructor( readonly filterService: FilterService, @@ -407,7 +408,8 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On ): Map { const onlyPageWithAnnotations = this.viewModeService.onlyPagesWithAnnotations(); if (!primary || primary.length === 0) { - this.displayedPages = onlyPageWithAnnotations ? [] : this.#allPages; + const pages = onlyPageWithAnnotations ? [] : this.#allPages; + this.#setDisplayedPages(pages); return; } @@ -429,15 +431,16 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On this.enabledFilters = this.filterService.enabledFlatFilters; if (this.enabledFilters.some(f => f.id === 'pages-without-annotations')) { if (this.enabledFilters.length === 1 && !onlyPageWithAnnotations) { - this.displayedPages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page)); + const pages = this.#allPages.filter(page => !pagesThatDisplayAnnotations.includes(page)); + this.#setDisplayedPages(pages); } else { - this.displayedPages = []; + this.#setDisplayedPages([]); } this.displayedAnnotations.clear(); } else if (this.enabledFilters.length || onlyPageWithAnnotations || componentReferenceIds) { - this.displayedPages = pagesThatDisplayAnnotations; + this.#setDisplayedPages(pagesThatDisplayAnnotations); } else { - this.displayedPages = this.#allPages; + this.#setDisplayedPages(this.#allPages); } this.displayedPages.sort((a, b) => a - b); @@ -533,9 +536,25 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On } #scrollToFirstAnnotationPage(annotations: Map[]>) { - if (this.isDocumine && annotations.size && !this.displayedPages.includes(this.pdf.currentPage())) { + if (this.isDocumine && annotations.size && this.#displayedPagesChanged && !this.displayedPages.includes(this.pdf.currentPage())) { const page = annotations.keys().next().value; this.pdf.navigateTo(page); } } + + #setDisplayedPages(newDisplayedPages: number[]) { + if (!this.#samePages(newDisplayedPages)) { + this.displayedPages = newDisplayedPages; + this.#displayedPagesChanged = true; + return; + } + this.#displayedPagesChanged = false; + } + + #samePages(newDisplayedPages: number[]) { + return ( + this.displayedPages.length === newDisplayedPages.length && + this.displayedPages.every((value, index) => value === newDisplayedPages[index]) + ); + } }