Show first unstable element in autopilot

Skips all unstable elements in autopilot
This commit is contained in:
Sean 2020-10-07 17:24:44 +02:00
parent de474e9eae
commit 22a318bde2
2 changed files with 13 additions and 1 deletions

View File

@ -95,6 +95,18 @@ export class Projector extends BaseModel<Projector> {
return [this.aspect_ratio_numerator, this.aspect_ratio_denominator].join(':');
}
public get firstUnstableElement(): ProjectorElement {
let elementIndex = 0;
/**
* while we could use a filter function to remove all stable elements, I expect
* this approach to be the fastest
*/
while (!!this.elements[elementIndex]?.stable) {
elementIndex++;
}
return this.elements[elementIndex] ?? null;
}
/**
* Set the aspect ratio
*/

View File

@ -96,7 +96,7 @@ export class CinemaComponent extends BaseViewComponentDirective implements OnIni
this.subscriptions.push(
this.projectorRepo.getReferenceProjectorObservable().subscribe(refProjector => {
this.projector = refProjector;
this.currentProjectorElement = refProjector?.elements[0] || null;
this.currentProjectorElement = refProjector?.firstUnstableElement || null;
if (this.currentProjectorElement) {
this.projectedViewModel = this.projectorService.getViewModelFromProjectorElement(
this.currentProjectorElement