Merge pull request #38 from kaiiiz/patch-dup-reqs
Fix duplicate requests in picsur-img.component
This commit is contained in:
commit
c65b7ca066
|
@ -16,5 +16,5 @@
|
|||
<mat-spinner
|
||||
(nguiInview)="onInview($event)"
|
||||
(nguiOutview)="onOutview($event)"
|
||||
*ngIf="state === 'loading'"
|
||||
*ngIf="state === 'init' || state === 'loading'"
|
||||
></mat-spinner>
|
||||
|
|
|
@ -17,6 +17,7 @@ import { Logger } from 'src/app/services/logger/logger.service';
|
|||
import { QoiWorkerService } from 'src/app/workers/qoi-worker.service';
|
||||
|
||||
enum PicsurImgState {
|
||||
Init = 'init',
|
||||
Loading = 'loading',
|
||||
Canvas = 'canvas',
|
||||
Image = 'image',
|
||||
|
@ -39,7 +40,7 @@ export class PicsurImgComponent implements OnChanges {
|
|||
|
||||
@Input('src') imageURL: string | undefined;
|
||||
|
||||
public state: PicsurImgState = PicsurImgState.Loading;
|
||||
public state: PicsurImgState = PicsurImgState.Init;
|
||||
|
||||
constructor(
|
||||
private readonly qoiWorker: QoiWorkerService,
|
||||
|
@ -113,7 +114,8 @@ export class PicsurImgComponent implements OnChanges {
|
|||
onInview(e: any) {
|
||||
this.isInView = true;
|
||||
|
||||
if (this.state === PicsurImgState.Loading) {
|
||||
if (this.state === PicsurImgState.Init) {
|
||||
this.state = PicsurImgState.Loading;
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue