diff --git a/common/constants.js b/common/constants.js index 2deb29b253716abf1597f47982ba101cac6b5fb2..be7e879b735c2d8b7719401e6679f5a748816264 100644 --- a/common/constants.js +++ b/common/constants.js @@ -147,7 +147,7 @@ If you do not accept the Terms & Conditions you are not permitted to access or u REMOVE_FRONTAL_OCTANT_HELPER_TEXT: `Hide the octant facing the user, and overlaying the slice views.`, - AUXMESH_DESC: `Some templates contains auxiliary meshes. They compliment the appearance of the template in perspective view.`, + AUXMESH_DESC: `Some templates contain auxiliary meshes, which compliment the appearance of the template in the perspective view.`, } exports.QUICKTOUR_DESC ={ diff --git a/src/atlasComponents/sapiViews/core/parcellation/isGroupedParcellation.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/isGroupedParcellation.pipe.ts new file mode 100644 index 0000000000000000000000000000000000000000..bdcd4f5183e582f5a08848c4852fac1196b7b74b --- /dev/null +++ b/src/atlasComponents/sapiViews/core/parcellation/isGroupedParcellation.pipe.ts @@ -0,0 +1,13 @@ +import { Pipe, PipeTransform } from "@angular/core" +import { GroupedParcellation } from "./groupedParcellation" + +@Pipe({ + name: 'isGroupedParcellation', + pure: true +}) + +export class IsGroupedParcellation implements PipeTransform{ + public transform(input: unknown): input is GroupedParcellation { + return input['parcellations'] instanceof Array + } +} diff --git a/src/atlasComponents/sapiViews/core/parcellation/module.ts b/src/atlasComponents/sapiViews/core/parcellation/module.ts index d3074f6e8e56b7ddabbf65bd74336f7d098ae42a..1dba15a672f32048508569aa03b9a63f9e96fed0 100644 --- a/src/atlasComponents/sapiViews/core/parcellation/module.ts +++ b/src/atlasComponents/sapiViews/core/parcellation/module.ts @@ -13,6 +13,7 @@ import { FilterUnsupportedParcPipe } from "./filterUnsupportedParc.pipe"; import { ParcellationDoiPipe } from "./parcellationDoi.pipe"; import { ParcellationVisibilityService } from "./parcellationVis.service"; import { ParcellationGroupSelectedPipe } from "./parcellationGroupSelected.pipe"; +import { IsGroupedParcellation } from "./isGroupedParcellation.pipe"; @NgModule({ imports: [ @@ -29,12 +30,14 @@ import { ParcellationGroupSelectedPipe } from "./parcellationGroupSelected.pipe" FilterUnsupportedParcPipe, ParcellationDoiPipe, ParcellationGroupSelectedPipe, + IsGroupedParcellation, ], exports: [ FilterGroupedParcellationPipe, FilterUnsupportedParcPipe, ParcellationGroupSelectedPipe, ParcellationDoiPipe, + IsGroupedParcellation, ], providers: [ ParcellationVisibilityService, diff --git a/src/atlasComponents/sapiViews/core/parcellation/parcellationGroupSelected.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/parcellationGroupSelected.pipe.ts index 97867311c4d2af1aa72992d683a35a744afab168..ad36105afe5198c558c9ff5b553b17d365102435 100644 --- a/src/atlasComponents/sapiViews/core/parcellation/parcellationGroupSelected.pipe.ts +++ b/src/atlasComponents/sapiViews/core/parcellation/parcellationGroupSelected.pipe.ts @@ -1,10 +1,9 @@ import { Pipe, PipeTransform } from "@angular/core"; import { SxplrParcellation } from "src/atlasComponents/sapi/sxplrTypes"; import { GroupedParcellation } from "./groupedParcellation"; +import { IsGroupedParcellation } from "./isGroupedParcellation.pipe" -function isGroupedParc(parc: GroupedParcellation|unknown): parc is GroupedParcellation { - return !!parc['parcellations'] -} +const pipe = new IsGroupedParcellation() @Pipe({ name: 'parcellationGroupSelected', @@ -13,7 +12,7 @@ function isGroupedParc(parc: GroupedParcellation|unknown): parc is GroupedParcel export class ParcellationGroupSelectedPipe implements PipeTransform { public transform(parc: GroupedParcellation|unknown, selectedParcellation: SxplrParcellation): boolean { - if (!isGroupedParc(parc)) return false + if (!pipe.transform(parc)) return false return parc.parcellations.some(p => p.id === selectedParcellation.id) } } diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html index 498b112315c00cc88cbe975ae52dae7ac2001d03..b482392ae68a739aa05afffc337a1bfecd190a7d 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html @@ -9,13 +9,9 @@ [elevation]="2" [disabled]="isBusy"> - <ng-template sxplrSmartChipHeader> - Parcellation - </ng-template> - <ng-template sxplrSmartChipContent> <span class="chip-text"> - {{ ATP.parcellation.name }} + Parcellation ({{ parcellations.length }}) </span> <ng-content select="[parcellation-chip-suffix]"> @@ -38,6 +34,7 @@ <ng-container *ngTemplateOutlet="optionTmpl; context: { $implicit: parc, + suffixText: (parc | isGroupedParcellation) && '(' + parc.parcellations.length + ')' , overridePrefixIconTmpl: (parc | parcellationGroupSelected : ATP.parcellation) ? halfSelectedTmpl : null @@ -53,13 +50,10 @@ (itemClicked)="selectLeaf({ template: $event })" [elevation]="4" [disabled]="isBusy"> - <ng-template sxplrSmartChipHeader> - Template - </ng-template> <ng-template sxplrSmartChipContent> <span class="chip-text"> - {{ ATP.template.name }} + Template ({{ availableTemplates.length }}) </span> </ng-template> <ng-template sxplrSmartChipMenu let-space> @@ -75,13 +69,9 @@ [elevation]="6" [disabled]="isBusy"> - <ng-template sxplrSmartChipHeader> - Atlas - </ng-template> - <ng-template sxplrSmartChipContent> <span class="chip-text"> - {{ ATP.atlas.name }} + Atlas ({{ allAtlases.length}}) </span> </ng-template> <ng-template sxplrSmartChipMenu let-atlas> @@ -101,7 +91,8 @@ #optionTmpl let-item let-overridePrefixIconTmpl="overridePrefixIconTmpl" - let-overrideSuffixIcon="overrideSuffixIcon"> + let-overrideSuffixIcon="overrideSuffixIcon" + let-suffixText="suffixText"> <!-- prefix --> <ng-template [ngIf]="overridePrefixIconTmpl" [ngIfElse]="defaultPrefix"> @@ -122,6 +113,9 @@ [matTooltip]="item.version?.name || item.name || item.fullName" [matTooltipPosition]="'above'"> {{ item.version?.name || item.name || item.fullName }} + <ng-template [ngIf]="suffixText"> + {{ suffixText }} + </ng-template> </span> <!-- suffix --> diff --git a/src/components/readmore/readmoreCmp/readmore.style.css b/src/components/readmore/readmoreCmp/readmore.style.css index 166ec29d499bd01a7010e8753854ef89d1cfd161..f49a4a951ac455d5760907af91b22502799574eb 100644 --- a/src/components/readmore/readmoreCmp/readmore.style.css +++ b/src/components/readmore/readmoreCmp/readmore.style.css @@ -13,3 +13,41 @@ div.readmore-content { overflow:hidden; } + +.veil +{ + position: relative; +} + +.veil::before +{ + position: absolute; + left: 0; + top: 0; + content: ''; + width: 100%; + height: 100%; + pointer-events: none; + z-index: 999; +} + +.veil::before +{ + + background: linear-gradient( + to bottom, + rgba(200,200,200, 0), + 70%, + rgba(200,200,200, 1) + ); +} + +:host-context([darktheme=true]) .veil::before +{ + background: linear-gradient( + to bottom, + rgba(50,50,50, 0), + 70%, + rgba(50,50,50, 1) + ); +} diff --git a/src/components/readmore/readmoreCmp/readmore.template.html b/src/components/readmore/readmoreCmp/readmore.template.html index 0eea38ac44faaa477c9757137a660c8804e3b5f4..2315e05ad02ec9e12563466cdfaa1c2078edb1aa 100644 --- a/src/components/readmore/readmoreCmp/readmore.template.html +++ b/src/components/readmore/readmoreCmp/readmore.template.html @@ -7,7 +7,8 @@ fullHeight: fullHeight, animationLength: animationLength }}" - class="readmore-content"> + class="readmore-content" + [ngClass]="show ? 'full' : 'veil'"> <div #contentContainer> <ng-content> </ng-content> diff --git a/src/components/smartChip/component/smartChip.style.scss b/src/components/smartChip/component/smartChip.style.scss index d9fda5b28f12edf04e0f6465f8838cf47dd2f23d..5feb29c580900bbb05dbc0762ef336b29bc87386 100644 --- a/src/components/smartChip/component/smartChip.style.scss +++ b/src/components/smartChip/component/smartChip.style.scss @@ -1,7 +1,6 @@ :host { margin: 0.5rem 1rem; - margin-top: 1.5rem; min-height: 32px; height: 1px; position: relative; diff --git a/src/features/module.ts b/src/features/module.ts index ae034a2ea47fa96cea6005dedfb7f552d0876794..7341ca0f925c7c27d8b7662e07edde19b631826c 100644 --- a/src/features/module.ts +++ b/src/features/module.ts @@ -22,7 +22,6 @@ import { FeatureViewComponent } from "./feature-view/feature-view.component"; import { TransformPdToDsPipe } from "./transform-pd-to-ds.pipe"; import { NgLayerCtlModule } from "src/viewerModule/nehuba/ngLayerCtlModule/module"; import { VoiBboxDirective } from "./voi-bbox.directive"; -import { ShowBBoxToggleDirective } from "./showBbox-toggle.directive"; @NgModule({ imports: [ @@ -50,7 +49,6 @@ import { ShowBBoxToggleDirective } from "./showBbox-toggle.directive"; CategoryAccDirective, VoiBboxDirective, - ShowBBoxToggleDirective, FeatureNamePipe, TransformPdToDsPipe, @@ -59,7 +57,6 @@ import { ShowBBoxToggleDirective } from "./showBbox-toggle.directive"; EntryComponent, FeatureViewComponent, VoiBboxDirective, - ShowBBoxToggleDirective, ], schemas: [ CUSTOM_ELEMENTS_SCHEMA, diff --git a/src/features/showBbox-toggle.directive.ts b/src/features/showBbox-toggle.directive.ts deleted file mode 100644 index 511b6ed1af8e9daf54c45dfa7f54c53bf8cc5914..0000000000000000000000000000000000000000 --- a/src/features/showBbox-toggle.directive.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Directive, Injectable } from "@angular/core"; -import { ComponentStore } from "@ngrx/component-store"; -import { map } from "rxjs/operators"; - -interface IVoiState { - showVoiFlag: boolean -} - -@Injectable() -class VoiStore extends ComponentStore<IVoiState>{ - constructor(){ - super({ showVoiFlag: false }) - } -} - -@Directive({ - selector: '[showBboxToggle]', - exportAs: 'showBboxToggle', - providers: [ - VoiStore - ] -}) -export class ShowBBoxToggleDirective { - public readonly showVoiFlag$ = this.voiStore.state$.pipe( - map(v => v.showVoiFlag) - ) - - constructor(private readonly voiStore: VoiStore){ - - } - - public setState(flag: boolean) { - this.voiStore.setState({ - showVoiFlag: flag - }) - } -} diff --git a/src/viewerModule/nehuba/config.service/util.ts b/src/viewerModule/nehuba/config.service/util.ts index 8e21802d3e504ecd25fbcf4d4388d203613ffe7d..078bad8ba3872d451ad802641475d610343f0495 100644 --- a/src/viewerModule/nehuba/config.service/util.ts +++ b/src/viewerModule/nehuba/config.service/util.ts @@ -157,7 +157,9 @@ const BACKCOMAP_KEY_DICT = { export function getParcNgId(atlas: SxplrAtlas, tmpl: SxplrTemplate, parc: SxplrParcellation, region: SxplrRegion): string { - + if (!region) { + return null + } let laterality: string = "whole brain" if (region.name.indexOf("left") >= 0) laterality = "left hemisphere" if (region.name.indexOf("right") >= 0) laterality = "right hemisphere" diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts index fb796e465b98a5795c561f0907edd0a9c9afbbfe..b19b8224e9b8ea1117baacc101101e233564b184 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.component.ts +++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts @@ -62,8 +62,6 @@ export class ViewerCmp implements OnDestroy { public CONST = CONST public ARIA_LABELS = ARIA_LABELS - - public showVoiFlag = true public quickTourRegionSearch: IQuickTourData = { order: 7, diff --git a/src/viewerModule/viewerCmp/viewerCmp.template.html b/src/viewerModule/viewerCmp/viewerCmp.template.html index 1cc5c69a384329045a5a1205c4b156b6196f380d..395ccba4f4f6c16ba74c0b3e215959d1ad7efd0f 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.template.html +++ b/src/viewerModule/viewerCmp/viewerCmp.template.html @@ -400,7 +400,7 @@ #sapiViewsCoreRegion="sapiViewsCoreRegion"> <ng-template sxplrSmartChipContent> <span class="regionname"> - {{ region.name }} + Region </span> <button class="sxplr-mr-n3" mat-icon-button @@ -408,9 +408,6 @@ <i class="fas fa-times"></i> </button> </ng-template> - <ng-template sxplrSmartChipHeader> - Region - </ng-template> </sxplr-smart-chip> </ng-template> @@ -958,7 +955,7 @@ <ng-template #spatialFeatureListTmpl> <mat-card class="sxplr-pe-all" [ngClass]="{ - 'sxplr-d-none': !showVoiFlag || (voiFeatureEntryCmp.totals$ | async) === 0 + 'sxplr-d-none': !(voiSwitch.switchState$ | async) || (voiFeatureEntryCmp.totals$ | async) === 0 }"> <mat-card-header> <mat-card-title> @@ -978,17 +975,10 @@ </ng-template> </mat-card-subtitle> </mat-card-header> - - <mat-slide-toggle - showBboxToggle - #showBboxToggle="showBboxToggle" - (change)="showBboxToggle.setState($event.checked)"> - Show image location - </mat-slide-toggle> </mat-card> <sxplr-feature-entry - [ngClass]="showVoiFlag ? 'sxplr-d-block' : 'sxplr-d-none'" + [ngClass]="(voiSwitch.switchState$ | async) ? 'sxplr-d-block' : 'sxplr-d-none'" class="sxplr-pe-all mat-elevation-z8" [template]="templateSelected$ | async" [bbox]="bbox.bbox$ | async | getProperty : 'bbox'" @@ -1000,16 +990,19 @@ 'sxplr-d-none': (voiFeatureEntryCmp.totals$ | async) === 0 }" class="sxplr-pe-all sxplr-w-100" - (click)="showVoiFlag = !showVoiFlag"> + iav-switch + [iav-switch-state]="false" + #voiSwitch="iavSwitch" + (click)="voiSwitch.toggle()"> - <ng-template [ngIf]="showVoiFlag"> + <ng-template [ngIf]="voiSwitch.switchState$ | async" [ngIfElse]="chevronCollapseTmpl"> <i class="fas fa-chevron-up"></i> <span> Collapse </span> </ng-template> - <ng-template [ngIf]="!showVoiFlag"> + <ng-template #chevronCollapseTmpl> <i class="fas fa-chevron-down"></i> <span> Explore {{ voiFeatureEntryCmp.totals$ | async }} spatial features @@ -1017,7 +1010,7 @@ </ng-template> </button> <div - *ngIf="showBboxToggle.showVoiFlag$ | async" + *ngIf="voiSwitch.switchState$| async" voiBbox [features]="voiFeatureEntryCmp.features$ | async">