Skip to content
Snippets Groups Projects
Commit ca09b7b1 authored by fsdavid's avatar fsdavid
Browse files

Fix and merge dev snap to nav

parent f1f08e6d
No related branches found
No related tags found
No related merge requests found
<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';
describe('ChangePerspectiveOrientationComponent', () => {
let component: ChangePerspectiveOrientationComponent;
let fixture: ComponentFixture<ChangePerspectiveOrientationComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ChangePerspectiveOrientationComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ChangePerspectiveOrientationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } 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 implements OnInit {
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], [0,0,1,0]]
}
constructor(private store$: Store<any>,) { }
ngOnInit(): void {
}
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