diff --git a/src/atlasViewer/atlasViewer.component.ts b/src/atlasViewer/atlasViewer.component.ts index 6d44baeb9f12658b593978da841e0a4a094cc1f6..cae9d027e425bcbd6a49af168f50f2d34225eb0a 100644 --- a/src/atlasViewer/atlasViewer.component.ts +++ b/src/atlasViewer/atlasViewer.component.ts @@ -45,7 +45,7 @@ import { LocalFileService } from "src/services/localFile.service"; import { MatDialog, MatDialogRef, MatSnackBar, MatSnackBarRef, MatBottomSheet, MatBottomSheetRef } from "@angular/material"; import {ADD_TO_REGIONS_SELECTION_WITH_IDS} from "src/services/state/viewerState.store"; import {VIEWER_STATE_ACTION_TYPES} from "src/services/effect/effect"; -import {RegionToolsMenuComponent} from "src/ui/regionToolsMenu/regionToolsMenu.component"; +import {RegionMenuComponent} from "src/ui/regionToolsMenu/regionMenu.component"; /** * TODO @@ -119,7 +119,7 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit { public sidePanelOpen$: Observable<boolean> - onhoverSegmentsForFixed$: Observable<any> + onhoverSegmentsForFixed$: Observable<string[]> regionToolsMenuVisible = false constructor( diff --git a/src/atlasViewer/atlasViewer.template.html b/src/atlasViewer/atlasViewer.template.html index f3d7f314ba7c1bace8e14173120e67f2e2a78f02..235e6d3228813c2f91f4c225c5dccc460526edf1 100644 --- a/src/atlasViewer/atlasViewer.template.html +++ b/src/atlasViewer/atlasViewer.template.html @@ -41,7 +41,7 @@ <ui-nehuba-container iav-mouse-hover #iavMouseHoverEl="iavMouseHover" [currentOnHoverObs$]="iavMouseHoverEl.currentOnHoverObs$" [currentOnHover]="iavMouseHoverEl.currentOnHoverObs$ | async" - mapClickDirective + iav-captureClickListenerDirective (mouseDownEmitter)="mouseDownNehuba($event)" (mapClicked)="mouseUpNehuba($event)"> </ui-nehuba-container> @@ -132,16 +132,15 @@ <panel-component class="shadow p-0 m-0" fixedMouseContextualContainerDirective> <div body class="pe-all" *ngIf="(onhoverSegmentsForFixed$ | async) as onHoverSegments"> <mat-card *ngIf="onHoverSegments.length > 0 && regionToolsMenuVisible" class="d-flex flex-column p-0"> - <div *ngFor="let onHoverRegion of onHoverSegments; let i = index" - class="border-dark rounded mt-2"> + <div *ngFor="let onHoverRegion of onHoverSegments; let first = first" + class="border-dark rounded"> + <mat-divider *ngIf="!first"></mat-divider> - <region-tools-menu #regionToolsMenu + <region-menu #regionToolsMenu [selectedRegions$]="selectedRegions$" - [onHoverRegion]="onHoverRegion"> - </region-tools-menu> + [region]="onHoverRegion"> + </region-menu> - <mat-divider *ngIf="onHoverSegments.length > 1 && i !== onHoverSegments.length-1" - class="mb-n2"></mat-divider> </div> </mat-card> </div> diff --git a/src/main.module.ts b/src/main.module.ts index 0834d401cc1da8205b77020351a1e5688fe2b4a6..1db540e32e8630cc0ba0a226ad50a9bac91b52cb 100644 --- a/src/main.module.ts +++ b/src/main.module.ts @@ -53,7 +53,7 @@ import 'hammerjs' import 'src/res/css/version.css' import 'src/theme.scss' import 'src/res/css/extra_styles.css' -import {MapClickDirective} from "src/util/directives/mapClick.directive"; +import {CaptureClickListenerDirective} from "src/util/directives/captureClickListener.directive"; @NgModule({ imports : [ @@ -108,7 +108,7 @@ import {MapClickDirective} from "src/util/directives/mapClick.directive"; PluginFactoryDirective, FloatingMouseContextualContainerDirective, DragDropDirective, - MapClickDirective, + CaptureClickListenerDirective, /* pipes */ GetNamesPipe, diff --git a/src/ui/regionToolsMenu/regionToolsMenu.component.ts b/src/ui/regionToolsMenu/regionMenu.component.ts similarity index 89% rename from src/ui/regionToolsMenu/regionToolsMenu.component.ts rename to src/ui/regionToolsMenu/regionMenu.component.ts index 03ef23331a404ab499ae02700b19797b5b581a42..3a64bf7d8451e4e3f778855d2e8c00e86f7fe477 100644 --- a/src/ui/regionToolsMenu/regionToolsMenu.component.ts +++ b/src/ui/regionToolsMenu/regionMenu.component.ts @@ -8,13 +8,13 @@ import {ADD_TO_REGIONS_SELECTION_WITH_IDS} from "src/services/state/viewerState. import {Store} from "@ngrx/store"; @Component({ - selector: 'region-tools-menu', - templateUrl: './regionToolsMenu.template.html', - styleUrls: ['./regionToolsMenu.style.css'] + selector: 'region-menu', + templateUrl: './regionMenu.template.html', + styleUrls: ['./regionMenu.style.css'] }) -export class RegionToolsMenuComponent { +export class RegionMenuComponent { @Input() selectedRegions$: any - @Input() onHoverRegion: any + @Input() region: any regionToolsMenuVisible = false collapsedRegionDescription = false diff --git a/src/ui/regionToolsMenu/regionToolsMenu.style.css b/src/ui/regionToolsMenu/regionMenu.style.css similarity index 100% rename from src/ui/regionToolsMenu/regionToolsMenu.style.css rename to src/ui/regionToolsMenu/regionMenu.style.css diff --git a/src/ui/regionToolsMenu/regionToolsMenu.template.html b/src/ui/regionToolsMenu/regionMenu.template.html similarity index 75% rename from src/ui/regionToolsMenu/regionToolsMenu.template.html rename to src/ui/regionToolsMenu/regionMenu.template.html index 627d216810b114582df8fde8d150e68eaf1e86b8..eeaed9f0a9dbaba6a91e09f4a4e50937b7638301 100644 --- a/src/ui/regionToolsMenu/regionToolsMenu.template.html +++ b/src/ui/regionToolsMenu/regionMenu.template.html @@ -1,14 +1,14 @@ -<div class="text-nowrap text-truncate mt-2 ml-2 mr-2 overflow-hidden" [matTooltip]="onHoverRegion.name" - matTooltipShowDelay="1000">{{onHoverRegion.name}}</div> +<div class="text-nowrap text-truncate mt-2 ml-2 mr-2 overflow-hidden" [matTooltip]="region.name" + matTooltipShowDelay="1000">{{region.name}}</div> <!-- ToDo implement it with Descriptions--> -<!-- <div > <!–*ngIf="!onHoverRegion.description && !onHoverRegion.description.length"–>--> +<!-- <div > <!–*ngIf="!region.description && !region.description.length"–>--> <!-- <div class="row m-2 position-relative overflow-hidden"--> <!-- [class.regionDescriptionTextOpened] = "collapsedRegionDescription"--> <!-- [class.overflow-y-auto] = "collapsedRegionDescription"--> <!-- [class.regionDescriptionTextClass] = "!collapsedRegionDescription"--> <!-- [class.linear-gradient-fade] = "(+regionDescriptionText.scrollHeight > +regionDescriptionText.clientHeight) && !collapsedRegionDescription"--> <!-- #regionDescriptionText>--> -<!-- {{onHoverRegion.description}}--> +<!-- {{region.description}}--> <!-- </div>--> <!-- <div (click)="collapsedRegionDescription = true"--> <!-- *ngIf="+regionDescriptionText.scrollHeight > +regionDescriptionText.clientHeight && !collapsedRegionDescription"--> @@ -26,18 +26,18 @@ style="font-size: 12px" class="p-0 w-100" *ngIf="(selectedRegions$ | async) as selectedRegions" - (click)="toggleRegionWithId(onHoverRegion.ngId, onHoverRegion.labelIndex, regionIsSelected(selectedRegions, onHoverRegion.ngId, onHoverRegion.labelIndex)); regionToolsMenuVisible = false; collapsedRegionDescription = false"> + (click)="toggleRegionWithId(region.ngId, region.labelIndex, regionIsSelected(selectedRegions, region.ngId, region.labelIndex)); regionToolsMenuVisible = false; collapsedRegionDescription = false"> <span class="fa-stack fa-1x"> <i class="fas fa-hand-pointer fa-stack-1x"></i> <i class="fas fa-slash fa-stack-1x fa-inverse" - *ngIf="regionIsSelected(selectedRegions, onHoverRegion.ngId, onHoverRegion.labelIndex)"></i> + *ngIf="regionIsSelected(selectedRegions, region.ngId, region.labelIndex)"></i> </span> - <span [innerText]="regionIsSelected(selectedRegions, onHoverRegion.ngId, onHoverRegion.labelIndex)? 'Deselect' : 'Select'"></span> + <span [innerText]="regionIsSelected(selectedRegions, region.ngId, region.labelIndex)? 'Deselect' : 'Select'"></span> </button> <button mat-button style="font-size: 12px" class="p-0 w-100" - (click)="navigateTo(onHoverRegion.position); regionToolsMenuVisible = false; collapsedRegionDescription = false"> + (click)="navigateTo(region.position); regionToolsMenuVisible = false; collapsedRegionDescription = false"> <i class="fas fa-crosshairs"></i> Navigate </button> diff --git a/src/ui/ui.module.ts b/src/ui/ui.module.ts index 841b34d7f5487e645248e7bccc7a631e2e1a66c1..0cbb08e0902e243e0c6ba0b0c5e8c6fab344baca 100644 --- a/src/ui/ui.module.ts +++ b/src/ui/ui.module.ts @@ -72,7 +72,7 @@ import { CurrentlySelectedRegions } from './viewerStateController/regionsListVie import { RegionTextSearchAutocomplete } from "./viewerStateController/regionSearch/regionSearch.component"; import { RegionsListView } from "./viewerStateController/regionsListView/simpleRegionsListView/regionListView.component"; import {TakeScreenshotComponent} from "src/ui/takeScreenshot/takeScreenshot.component"; -import {RegionToolsMenuComponent} from "src/ui/regionToolsMenu/regionToolsMenu.component"; +import {RegionMenuComponent} from "src/ui/regionToolsMenu/regionMenu.component"; import {FixedMouseContextualContainerDirective} from "src/util/directives/FixedMouseContextualContainerDirective.directive"; @NgModule({ @@ -121,7 +121,7 @@ import {FixedMouseContextualContainerDirective} from "src/util/directives/FixedM RegionTextSearchAutocomplete, RegionsListView, TakeScreenshotComponent, - RegionToolsMenuComponent, + RegionMenuComponent, /* pipes */ GroupDatasetByRegion, @@ -184,7 +184,7 @@ import {FixedMouseContextualContainerDirective} from "src/util/directives/FixedM ElementOutClickDirective, SearchSideNav, ViewerStateMini, - RegionToolsMenuComponent, + RegionMenuComponent, FixedMouseContextualContainerDirective ] }) diff --git a/src/util/directives/mapClick.directive.ts b/src/util/directives/captureClickListener.directive.ts similarity index 89% rename from src/util/directives/mapClick.directive.ts rename to src/util/directives/captureClickListener.directive.ts index 9845527b4e6a6dc9818846b27d17390c60e50025..bd92d61fe6cf9944e5142078b964c4e31044cd55 100644 --- a/src/util/directives/mapClick.directive.ts +++ b/src/util/directives/captureClickListener.directive.ts @@ -1,13 +1,13 @@ import {Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output} from "@angular/core"; import {Observable, Observer, Subscription} from "rxjs"; import {switchMapTo, takeUntil} from "rxjs/operators"; -import {RegionToolsMenuComponent} from "src/ui/regionToolsMenu/regionToolsMenu.component"; +import {RegionMenuComponent} from "src/ui/regionToolsMenu/regionMenu.component"; @Directive({ - selector: '[mapClickDirective]' + selector: '[iav-captureClickListenerDirective]' }) -export class MapClickDirective implements OnInit, OnDestroy { +export class CaptureClickListenerDirective implements OnInit, OnDestroy { private subscriptions: Subscription[] = [] @Output() mapClicked: EventEmitter<any> = new EventEmitter()