diff --git a/src/atlasViewer/atlasViewer.template.html b/src/atlasViewer/atlasViewer.template.html index 205d21f7fe4231bc9d960ae93a32c8c8e446556c..e6f5ac669baa096ca1e84ee760fa608514b856e3 100644 --- a/src/atlasViewer/atlasViewer.template.html +++ b/src/atlasViewer/atlasViewer.template.html @@ -133,6 +133,7 @@ </div> + <!-- TODO move to nehuba overlay container --> <panel-component class="shadow" fixedMouseContextualContainerDirective #rClContextMenu> <div heading> <h5 class="pe-all p-2 m-0"> @@ -147,14 +148,14 @@ data-toggle="tooltip" data-placement="top" [title]="onhoverSegmentFixed.name"> - Search KG for {{ onhoverSegmentFixed.name }} + Search for data related to {{ onhoverSegmentFixed.name }} </div> <div *ngIf="(selectedRegions$ | async)?.length > 0 && (selectedRegions$ | async); let selectedRegions" (click)="searchRegion(selectedRegions)" class="ws-no-wrap text-left pe-all mt-0 btn btn-sm btn-secondary btn-block"> - Search KG for {{ selectedRegions && selectedRegions.length }} selected regions + Search for data related to all {{ selectedRegions && selectedRegions.length }} selected regions </div> <div diff --git a/src/ui/menuicons/menuicons.component.ts b/src/ui/menuicons/menuicons.component.ts index 6751331d0d4e8d122ca78af616dc227a4092496b..57250e2b4963c7a15b1685e7b1a5dc32a50b7199 100644 --- a/src/ui/menuicons/menuicons.component.ts +++ b/src/ui/menuicons/menuicons.component.ts @@ -72,8 +72,8 @@ export class MenuIconsBar{ dataBrowser.instance.template = template dataBrowser.instance.parcellation = parcellation const title = regions.length > 1 - ? `Data associated with ${regions.length} regions` - : `Data associated with ${regions[0].name}` + ? `Search: ${regions.length} regions` + : `Search: ${regions[0].name}` const widgetUnit = this.widgetServices.addNewWidget(dataBrowser, { exitable: true, persistency: true, diff --git a/src/ui/nehubaContainer/nehubaContainer.template.html b/src/ui/nehubaContainer/nehubaContainer.template.html index 83066042e55fd28269815978ba971520c65bdca9..4356da032ab0fb41b1761d4ac770ed3cbfb31e4a 100644 --- a/src/ui/nehubaContainer/nehubaContainer.template.html +++ b/src/ui/nehubaContainer/nehubaContainer.template.html @@ -71,7 +71,7 @@ <layout-floating-container *ngIf="viewerLoaded"> <!-- StatusCard container--> -<ui-status-card [selectedTemplate]="selectedTemplate" [isMobile]="isMobile" + <ui-status-card [selectedTemplate]="selectedTemplate" [isMobile]="isMobile" [onHoverSegmentName]="onHoverSegmentName$ | async" [nehubaViewer]="nehubaViewer"> </ui-status-card> </layout-floating-container> diff --git a/src/ui/signinBanner/signinBanner.components.ts b/src/ui/signinBanner/signinBanner.components.ts index 60f8ce728f760a834f9daf309c2c22c63f57509e..e3870a457c8225554a9c2e124b0f560b6d318345 100644 --- a/src/ui/signinBanner/signinBanner.components.ts +++ b/src/ui/signinBanner/signinBanner.components.ts @@ -4,9 +4,10 @@ import { AuthService, User } from "src/services/auth.service"; import { Store, select } from "@ngrx/store"; import { ViewerConfiguration } from "src/services/state/viewerConfig.store"; import { Subscription, Observable } from "rxjs"; -import { safeFilter, isDefined, NEWVIEWER, SELECT_REGIONS, SELECT_PARCELLATION } from "src/services/stateStore.service"; +import { safeFilter, isDefined, NEWVIEWER, SELECT_REGIONS, SELECT_PARCELLATION, CHANGE_NAVIGATION } from "src/services/stateStore.service"; import { map, filter, distinctUntilChanged } from "rxjs/operators"; import { regionFlattener } from "src/util/regionFlattener"; +import { ToastService } from "src/services/toastService.service"; @Component({ selector: 'signin-banner', @@ -31,7 +32,8 @@ export class SigninBanner implements OnInit, OnDestroy{ constructor( private constantService: AtlasViewerConstantsServices, private authService: AuthService, - private store: Store<ViewerConfiguration> + private store: Store<ViewerConfiguration>, + private toastService: ToastService ){ this.loadedTemplates$ = this.store.pipe( select('viewerState'), @@ -98,16 +100,48 @@ export class SigninBanner implements OnInit, OnDestroy{ handleRegionClick({ mode = 'single', region }){ if (!region) return - const flattenedRegion = regionFlattener(region).filter(r => isDefined(r.labelIndex)) - const flattenedRegionNames = new Set(flattenedRegion.map(r => r.name)) - const selectedRegionNames = new Set(this.selectedRegions.map(r => r.name)) - const selectAll = flattenedRegion.every(r => !selectedRegionNames.has(r.name)) - this.store.dispatch({ - type: SELECT_REGIONS, - selectRegions: selectAll - ? this.selectedRegions.concat(flattenedRegion) - : this.selectedRegions.filter(r => !flattenedRegionNames.has(r.name)) - }) + + /** + * single click on region hierarchy => toggle selection + */ + if (mode === 'single') { + const flattenedRegion = regionFlattener(region).filter(r => isDefined(r.labelIndex)) + const flattenedRegionNames = new Set(flattenedRegion.map(r => r.name)) + const selectedRegionNames = new Set(this.selectedRegions.map(r => r.name)) + const selectAll = flattenedRegion.every(r => !selectedRegionNames.has(r.name)) + this.store.dispatch({ + type: SELECT_REGIONS, + selectRegions: selectAll + ? this.selectedRegions.concat(flattenedRegion) + : this.selectedRegions.filter(r => !flattenedRegionNames.has(r.name)) + }) + } + + /** + * double click on region hierarchy => navigate to region area if it exists + */ + if (mode === 'double') { + + /** + * if position is defined, go to position (in nm) + * if not, show error messagea s toast + * + * nb: currently, only supports a single triplet + */ + if (region.position) { + this.store.dispatch({ + type: CHANGE_NAVIGATION, + navigation: { + position: region.position + } + }) + } else { + this.toastService.showToast(`${region.name} does not have a position defined`, { + timeout: 5000, + dismissable: true + }) + } + } } displayActiveParcellation(parcellation:any){