Skip to content

Commit

Permalink
fix(app): make ngOnInit async and await geom load
Browse files Browse the repository at this point in the history
Fixes HSF#187
  • Loading branch information
EdwardMoyse committed Dec 5, 2020
1 parent 9b765c5 commit 298c075
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class AtlasComponent implements OnInit {

constructor(private eventDisplay: EventDisplayService) { }

ngOnInit() {
async ngOnInit() {
let defaultEvent: { eventFile: string, eventType: string };
// Get default event from configuration
if (environment?.singleEvent) {
Expand Down Expand Up @@ -50,21 +50,21 @@ export class AtlasComponent implements OnInit {
this.eventDisplay.init(configuration);

// Load detector geometries
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/toroids.obj', 'Toroids', 0x8c8c8c, undefined, false, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/TRT.obj', 'TRT', 0x356aa5, undefined, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/SCT.obj', 'SCT', 0xfff400, undefined, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/pixel.obj', 'Pixel', 0x356aa5, undefined, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/LAR_Bar.obj', 'LAr Barrel', 0x19CCD2, undefined, true, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/LAR_EC1.obj', 'LAr EC1', 0x19CCD2, undefined, true, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/LAR_EC2.obj', 'LAr EC2', 0x19CCD2, undefined, true, false);
this.eventDisplay
await this.eventDisplay
.loadOBJGeometry('assets/geometry/ATLAS/TileCal.obj', 'Tile Cal', 0xc14343, undefined, true, false);

this.eventDisplay.getLoadingManager().addLoadListenerWithCheck(() => {
Expand Down
Loading

0 comments on commit 298c075

Please sign in to comment.