Skip to content
Snippets Groups Projects
Unverified Commit 6332c24b authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #1079 from FZJ-INM1-BDA/dev_snap_to_nav_merged

Add buttons to change perspective orientation
parents 387d070d a2c557d3
No related branches found
No related tags found
No related merge requests found
Showing with 120 additions and 2 deletions
......@@ -2,4 +2,5 @@
## Bugfix
- re-introduced explore in KG button for parcellation citations
\ No newline at end of file
- re-introduced explore in KG button for parcellation citations
# v2.5.7
## Feature
- Add menu to change perspective orientation by coronal/sagittal/axial views.
......@@ -40,6 +40,7 @@ pages:
- Fetching datasets: 'advanced/datasets.md'
- Display non-atlas volumes: 'advanced/otherVolumes.md'
- Release notes:
- v2.5.7: 'releases/v2.5.7.md'
- v2.5.6: 'releases/v2.5.6.md'
- v2.5.5: 'releases/v2.5.5.md'
- v2.5.4: 'releases/v2.5.4.md'
......
{
"name": "interactive-viewer",
"version": "2.5.6",
"version": "2.5.7",
"description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular",
"scripts": {
"build-aot": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'` ng build --prod && node ./third_party/matomo/processMatomo.js",
......
......@@ -75,6 +75,7 @@ describe('> pureConstant.service.ts', () => {
const expT1 = httpController.expectOne(`${MOCK_BS_ENDPOINT}/atlases/${encodeURIComponent(mockAtlas.id)}/spaces`)
expT1.flush([])
const expP1 = httpController.expectOne(`${MOCK_BS_ENDPOINT}/atlases/${encodeURIComponent(mockAtlas.id)}/parcellations`)
expP1.flush([])
})
......
<button mat-menu-item [mat-menu-trigger-for]="perspectiveOrientationMenu">
Change orientation to
</button>
<mat-menu #perspectiveOrientationMenu="matMenu">
<div class="d-flex align-items-center text-light">
<button mat-button color="basic" class="flex-grow-1 text-left"
(click)="set3DViewPoint('coronal', 'first')">
Coronal view
</button>
<button class="flex-grow-0" mat-button
(click)="set3DViewPoint('coronal', 'second')">
<i class="fas fa-arrows-alt-h"></i>
</button>
</div>
<div class="d-flex align-items-center text-light"> <!--mat-menu-item-->
<button mat-button color="basic" class="flex-grow-1 text-left"
(click)="set3DViewPoint('sagittal', 'first')">
Sagittal view
</button>
<button class="flex-grow-0" mat-button
(click)="set3DViewPoint('sagittal', 'second')">
<i class="fas fa-arrows-alt-h"></i>
</button>
</div>
<div class="d-flex align-items-center text-light"> <!--mat-menu-item-->
<button mat-button color="basic" class="flex-grow-1 text-left"
(click)="set3DViewPoint('axial', 'first')">
Axial view
</button>
<button class="flex-grow-0" mat-button
(click)="set3DViewPoint('axial', 'second')">
<i class="fas fa-arrows-alt-h"></i>
</button>
</div>
</mat-menu>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangePerspectiveOrientationComponent } from './changePerspectiveOrientation.component';
import { MockStore, provideMockStore } from "@ngrx/store/testing"
import { AngularMaterialModule } from 'src/sharedModules';
import { CommonModule } from '@angular/common';
describe('ChangePerspectiveOrientationComponent', () => {
let component: ChangePerspectiveOrientationComponent;
let fixture: ComponentFixture<ChangePerspectiveOrientationComponent>;
let mockStore: MockStore;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
AngularMaterialModule,
CommonModule
],
declarations: [ ChangePerspectiveOrientationComponent ],
providers: [provideMockStore()],
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ChangePerspectiveOrientationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import {viewerStateChangeNavigation} from "src/services/state/viewerState/actions";
import {Store} from "@ngrx/store";
@Component({
selector: 'app-change-perspective-orientation',
templateUrl: './changePerspectiveOrientation.component.html',
styleUrls: ['./changePerspectiveOrientation.component.sass']
})
export class ChangePerspectiveOrientationComponent {
private viewOrientations = {
coronal: [[0,-1,1,0], [-1,0,0,1]],
sagittal: [[-1,-1,1,1], [-1,1,-1,1]],
axial: [[0,0,1,0], [1,0,0,0]]
}
constructor(private store$: Store<any>,) { }
public set3DViewPoint(plane: 'coronal' | 'sagittal' | 'axial', view: 'first' | 'second') {
const orientation = this.viewOrientations[plane][view === 'first'? 0 : 1]
this.store$.dispatch(
viewerStateChangeNavigation({
navigation: {
perspectiveOrientation: orientation,
}
})
)
}
}
......@@ -5,6 +5,7 @@ import { ComponentsModule } from "src/components";
import { AngularMaterialModule } from "src/sharedModules";
import { UtilModule } from "src/util";
import { ViewerCtrlCmp } from "./viewerCtrlCmp/viewerCtrlCmp.component";
import {ChangePerspectiveOrientationComponent} from "src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component";
@NgModule({
imports: [
......@@ -17,6 +18,7 @@ import { ViewerCtrlCmp } from "./viewerCtrlCmp/viewerCtrlCmp.component";
],
declarations: [
ViewerCtrlCmp,
ChangePerspectiveOrientationComponent
],
exports: [
ViewerCtrlCmp
......
......@@ -41,3 +41,4 @@
</form>
</ng-container>
<app-change-perspective-orientation></app-change-perspective-orientation>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment