Merge pull request #5617 from tsiegleauq/only-non-stable-slides-in-ap

Show first unstable element in autopilot
This commit is contained in:
Emanuel Schütze 2020-10-07 23:30:19 +02:00 committed by GitHub
commit 58db337a40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(':'); 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 * Set the aspect ratio
*/ */

View File

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