Merge pull request #5055 from tsiegleauq/fix-projector
Fix flickering projector button in lists
This commit is contained in:
commit
7f49ead439
@ -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 }}
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user