Skip to content

Commit 7fbdb13

Browse files
authored
feat(app): added button to close/open the VP
2 parents d04e3f4 + 2d670f9 commit 7fbdb13

9 files changed

Lines changed: 89 additions & 1 deletion

File tree

packages/phoenix-ng/projects/phoenix-app/src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { HomeComponent } from './home/home.component';
77
import { GeometryComponent } from './sections/geometry/geometry.component';
88
import { AtlasComponent } from './sections/atlas/atlas.component';
99
import { LHCbComponent } from './sections/lhcb/lhcb.component';
10+
import { VPToggleComponent } from './sections/lhcb/vp-toggle/vp-toggle.component';
1011
import { CMSComponent } from './sections/cms/cms.component';
1112
import { TrackmlComponent } from './sections/trackml/trackml.component';
1213
import { PhoenixUIModule } from 'phoenix-ui-components';
@@ -39,6 +40,7 @@ if (environment?.singleEvent) {
3940
GeometryComponent,
4041
AtlasComponent,
4142
LHCbComponent,
43+
VPToggleComponent,
4244
CMSComponent,
4345
TrackmlComponent,
4446
PlaygroundComponent,

packages/phoenix-ng/projects/phoenix-app/src/app/sections/lhcb/lhcb.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
[eventDataImportOptions]="eventDataImportOptions"
2323
></app-io-options>
2424
<app-share-link></app-share-link>
25+
<app-vp-toggle></app-vp-toggle>
2526
</app-ui-menu-wrapper>
2627
<app-embed-menu></app-embed-menu>
2728
<app-experiment-info
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<app-menu-toggle
2+
[tooltip]="(open ? 'Close' : 'Open') + 'VP'"
3+
[icon]="open ? 'closevp' : 'openvp'"
4+
(click)="toggleVP()"
5+
>
6+
</app-menu-toggle>

packages/phoenix-ng/projects/phoenix-app/src/app/sections/lhcb/vp-toggle/vp-toggle.component.scss

Whitespace-only changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { VPToggleComponent } from './vp-toggle.component';
4+
5+
describe('VPToggleComponent', () => {
6+
let component: VPToggleComponent;
7+
let fixture: ComponentFixture<VPToggleComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [VPToggleComponent],
12+
}).compileComponents();
13+
});
14+
15+
beforeEach(() => {
16+
fixture = TestBed.createComponent(VPToggleComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
});
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
25+
it('should toggle VP opening/closing', () => {
26+
expect(component.open).toBe(false);
27+
component.toggleVP();
28+
expect(component.open).toBe(true);
29+
});
30+
});
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Component, ComponentRef, OnDestroy, OnInit } from '@angular/core';
2+
import { EventDisplayService } from 'phoenix-ui-components';
3+
4+
@Component({
5+
selector: 'app-vp-toggle',
6+
templateUrl: './vp-toggle.component.html',
7+
styleUrls: ['./vp-toggle.component.scss'],
8+
})
9+
export class VPToggleComponent {
10+
open = false;
11+
12+
constructor(private eventDisplay: EventDisplayService) {}
13+
14+
moveVP(sceneManager, pos) {
15+
// changes Velo position symetrically by the given amount
16+
for (const item of ['Modules', 'Support', 'RFFoil', 'DeliveryPipes']) {
17+
sceneManager
18+
.getObjectByName('VP > Left > ' + item)
19+
.position.setComponent(0, pos);
20+
sceneManager
21+
.getObjectByName('VP > Right > ' + item)
22+
.position.setComponent(0, -pos);
23+
}
24+
}
25+
26+
toggleVP() {
27+
this.open = !this.open;
28+
this.moveVP(
29+
this.eventDisplay.getThreeManager().getSceneManager(),
30+
this.open ? 30 : 0
31+
);
32+
}
33+
}

packages/phoenix-ng/projects/phoenix-app/src/assets/geometry/LHCb/LHCb.gltf

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 8 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)