Merge pull request #5055 from tsiegleauq/fix-projector

Fix flickering projector button in lists
This commit is contained in:
Emanuel Schütze 2019-09-24 22:04:30 +02:00 committed by GitHub
commit 7f49ead439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 15 deletions

View File

@ -1,19 +1,19 @@
<ng-container *osPerms="'core.can_manage_projector'">
<button
type="button"
*ngIf="!text && !menuItem"
class="projector-active"
mat-mini-fab
(click)="onClick($event)"
[ngClass]="isProjected ? 'projector-active' : 'projector-inactive'"
*ngIf="!text && !menuItem && checkIsProjected()"
>
<mat-icon>videocam</mat-icon>
</button>
<button
type="button"
*ngIf="text && !menuItem"
mat-button
class="projector-inactive"
mat-mini-fab
(click)="onClick($event)"
[ngClass]="isProjected ? 'projector-active' : 'projector-inactive'"
*ngIf="!text && !menuItem && !checkIsProjected()"
>
<mat-icon>videocam</mat-icon>
{{ text | translate }}
@ -23,7 +23,7 @@
*ngIf="menuItem"
mat-menu-item
(click)="onClick()"
[ngClass]="isProjected ? 'projector-active' : 'projector-inactive'"
[ngClass]="checkIsProjected() ? 'projector-active' : 'projector-inactive'"
>
<mat-icon>videocam</mat-icon>
{{ text || 'Project' | translate }}

View File

@ -38,8 +38,6 @@ export class ProjectorButtonComponent implements OnInit, OnDestroy {
return this._object;
}
public isProjected = false;
@Input()
public set object(obj: Projectable | ProjectorElementBuildDeskriptor) {
if (isProjectable(obj) || isProjectorElementBuildDeskriptor(obj)) {
@ -80,17 +78,11 @@ export class ProjectorButtonComponent implements OnInit, OnDestroy {
* Initialization function
*/
public ngOnInit(): void {
this.isProjected = this.checkIsProjected();
this.projectorRepoSub = this.projectorRepo
.getGeneralViewModelObservable()
.pipe(distinctUntilChanged())
.subscribe(() => {
const isProjected = this.checkIsProjected();
if (this.isProjected !== isProjected) {
this.isProjected = isProjected;
this.changeEvent.next();
}
});
}