Skip to content

Commit

Permalink
Controller update and small animation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Jun 7, 2024
1 parent effb90b commit d881e57
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
6 changes: 3 additions & 3 deletions firebird-ng/src/app/main-display/main-display.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@
<div>{{message}}</div>
&nbsp;&nbsp;

<button mat-raised-button aria-label="Rewind" matTooltip="Rewind time to 0" class="tcontrol" (click)="nextRandomEvent()">
<button mat-raised-button aria-label="Rewind" matTooltip="Play random NEXT EVENT" class="tcontrol" (click)="nextRandomEvent()">
<mat-icon>last_page</mat-icon>
</button>

<button mat-raised-button aria-label="Stop" matTooltip="Stop and show all particles" class="tcontrol" (click)="cycleGeometry()" >
<button mat-raised-button aria-label="Stop" matTooltip="Cycle through DETECTOR subsystems" class="tcontrol" (click)="cycleGeometry()" >
<mat-icon>view_in_ar</mat-icon>
</button>

<div>{{currentGeometry}}</div>
<div style="color: darkgray">{{currentGeometry}}</div>
</div>

<div id="eventDisplay"></div>
47 changes: 42 additions & 5 deletions firebird-ng/src/app/main-display/main-display.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class MainDisplayComponent implements OnInit {
protected eventsByName = new Map<string, any>();
private eventsArray: any[] = [];
selectedEventKey: string|undefined;
private beamAnimationTime: number = 1000;


constructor(
Expand Down Expand Up @@ -287,8 +288,8 @@ export class MainDisplayComponent implements OnInit {
const spherical = new THREE.Spherical().setFromVector3(currentPosition);

// Adjusting spherical coordinates
spherical.theta -= xAxisChange * 0.01; // Azimuth angle change
spherical.phi += yAxisChange * 0.01; // Polar angle change, for rotating up/down
spherical.theta -= xAxisChange * 0.023; // Azimuth angle change
spherical.phi += yAxisChange * 0.023; // Polar angle change, for rotating up/down

// Ensure phi is within bounds to avoid flipping
spherical.phi = Math.max(0.1, Math.min(Math.PI - 0.1, spherical.phi));
Expand Down Expand Up @@ -466,6 +467,18 @@ export class MainDisplayComponent implements OnInit {
this.onControllerBPressed(value);
});

this.controller.buttonRT.onPress.subscribe(value => {
this.onControllerRTPressed(value);
});

this.controller.buttonLT.onPress.subscribe(value => {
this.onControllerLTPressed(value);
});

this.controller.buttonY.onPress.subscribe(value => {
this.onControllerYPressed(value);
});

// let uiManager = this.eventDisplay.getUIManager();
let openThreeManager: any = this.eventDisplay.getThreeManager();
let threeManager = this.eventDisplay.getThreeManager();
Expand Down Expand Up @@ -601,10 +614,31 @@ export class MainDisplayComponent implements OnInit {

private onControllerBPressed(value: boolean) {
if(value) {
this.animateWithCollision();
this.beamAnimationTime = 1800;
this.nextRandomEvent("5x41");
}
}

private onControllerRTPressed(value: boolean) {

if(value) {
this.beamAnimationTime = 1200;
this.nextRandomEvent("10x100");
}
}

private onControllerLTPressed(value: boolean) {
if(value) {
this.beamAnimationTime = 700;
this.nextRandomEvent("18x275");
}

}

private onControllerYPressed(value: boolean) {
if(value) this.cycleGeometry();
}

changeCurrentTime(event: Event) {
if(!event) return;
const input = event.target as HTMLInputElement;
Expand Down Expand Up @@ -718,7 +752,7 @@ export class MainDisplayComponent implements OnInit {
trackInfo.trackNode.visible = false;
}
}
this.animationManager?.collideParticles(1000, 30, 5000, new Color(0xAAAAAA),
this.animationManager?.collideParticles(this.beamAnimationTime, 30, 5000, new Color(0xAAAAAA),
() => {
this.animateTime();
});
Expand Down Expand Up @@ -791,7 +825,7 @@ export class MainDisplayComponent implements OnInit {
} }

this._snackBar.open(`Showing event: ${eventName}`, 'Dismiss', {
duration: 1000, // Duration in milliseconds after which the snack-bar will auto dismiss
duration: 2000, // Duration in milliseconds after which the snack-bar will auto dismiss
horizontalPosition: 'right', // 'start' | 'center' | 'end' | 'left' | 'right'
verticalPosition: 'top', // 'top' | 'bottom'
});
Expand Down Expand Up @@ -822,4 +856,7 @@ export class MainDisplayComponent implements OnInit {
console.log(`User selected event ${this.selectedEventKey} `);
this.buildEventDataFromJSON(event);
}



}
4 changes: 2 additions & 2 deletions firebird-ng/src/app/three-event.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ThreeEventProcessor {
/** This is primer, all other DASHED line materials take this and clone and change color */
dashedLineMaterial = new LineMaterial( {
color: 0xffff00,
linewidth: 10, // in world units with size attenuation, pixels otherwise
linewidth: 20, // in world units with size attenuation, pixels otherwise
worldUnits: true,
dashed: true,
//dashScale: 100, // ???? Need this? What is it?
Expand All @@ -54,7 +54,7 @@ export class ThreeEventProcessor {
/** This is primer, all other SOLID line materials take this and clone and change color */
solidLineMaterial = new LineMaterial( {
color: 0xffff00,
linewidth: 10, // in world units with size attenuation, pixels otherwise
linewidth: 20, // in world units with size attenuation, pixels otherwise
worldUnits: true,
dashed: false,
//dashScale: 100, // ???? Need this? What is it?
Expand Down

0 comments on commit d881e57

Please sign in to comment.