change detector is stupid

This commit is contained in:
Dan Percic 2022-03-07 11:56:32 +02:00
parent 5129c0628a
commit 3382f4fa09
3 changed files with 9 additions and 6 deletions

View File

@ -12,7 +12,7 @@
<div *ngIf="activeSelection" class="dot"></div> <div *ngIf="activeSelection" class="dot"></div>
<div *ngIf="isRotated$ | async" class="rotated"> <div *ngIf="isRotated" class="rotated">
<mat-icon svgIcon="red:rotation"></mat-icon> <mat-icon svgIcon="red:rotation"></mat-icon>
</div> </div>
</div> </div>

View File

@ -15,7 +15,7 @@ import { ViewedPagesService } from '@services/entity-services/viewed-pages.servi
import { IViewedPage } from '@red/domain'; import { IViewedPage } from '@red/domain';
import { AutoUnsubscribe } from '@iqser/common-ui'; import { AutoUnsubscribe } from '@iqser/common-ui';
import { FilePreviewStateService } from '../../services/file-preview-state.service'; import { FilePreviewStateService } from '../../services/file-preview-state.service';
import { firstValueFrom, Observable } from 'rxjs'; import { firstValueFrom } from 'rxjs';
import { PageRotationService } from '../../services/page-rotation.service'; import { PageRotationService } from '../../services/page-rotation.service';
@Component({ @Component({
@ -35,7 +35,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
pageReadTimeout: number = null; pageReadTimeout: number = null;
read = false; read = false;
isRotated$: Observable<boolean>; isRotated = false;
constructor( constructor(
private readonly _viewedPagesService: ViewedPagesService, private readonly _viewedPagesService: ViewedPagesService,
@ -43,7 +43,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _permissionService: PermissionsService, private readonly _permissionService: PermissionsService,
private readonly _stateService: FilePreviewStateService, private readonly _stateService: FilePreviewStateService,
private readonly _pageRotationService: PageRotationService, readonly pageRotationService: PageRotationService,
) { ) {
super(); super();
} }
@ -61,7 +61,10 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
} }
ngOnInit() { ngOnInit() {
this.isRotated$ = this._pageRotationService.isRotated(this.number); this.addSubscription = this.pageRotationService.isRotated(this.number).subscribe(value => {
this.isRotated = value;
this._changeDetectorRef.detectChanges();
});
} }
ngOnChanges() { ngOnChanges() {

@ -1 +1 @@
Subproject commit f7f0bb86a6ccf3b6e1970c8749b83e828578e673 Subproject commit 2bae4da2b991ad300b893f6b73797b6c1b90448c