Skip to content

Commit

Permalink
fix(human-pose-viewer): move to ionic components
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitMY committed Oct 18, 2023
1 parent 218a078 commit 5a2eed1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<ng-container *transloco="let t; read: 'translate.spoken-to-signed.progress-bars.human-pose-viewer'">
<mat-progress-bar
<ion-progress-bar
*ngIf="modelReady && !ready"
mode="determinate"
[value]="progress()"
[attr.aria-label]="t('generating')"></mat-progress-bar>
[value]="progress"
[attr.aria-label]="t('generating')"></ion-progress-bar>

<pose-viewer
#poseViewer
Expand All @@ -15,7 +14,7 @@
width="256px"
height="256px"></pose-viewer>

<mat-spinner *ngIf="!modelReady" [attr.aria-label]="t('loading')"></mat-spinner>
<ion-spinner *ngIf="!modelReady" [attr.aria-label]="t('loading')" color="primary"></ion-spinner>

<canvas #canvas width="768" height="768"></canvas>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ canvas {
align-self: center;
}

mat-progress-bar {
ion-progress-bar {
position: absolute;
}

mat-spinner {
ion-spinner {
position: absolute;
top: 50%;
left: 50%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {NgxsModule} from '@ngxs/store';
import {SettingsState} from '../../../../modules/settings/settings.state';
import {ngxsConfig} from '../../../../core/modules/ngxs/ngxs.module';
import {AppTranslocoTestingModule} from '../../../../core/modules/transloco/transloco-testing.module';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {IonicModule} from '@ionic/angular';

describe('HumanPoseViewerComponent', () => {
let component: HumanPoseViewerComponent;
Expand All @@ -19,7 +19,7 @@ describe('HumanPoseViewerComponent', () => {
declarations: [HumanPoseViewerComponent],
imports: [
Pix2PixModule,
MatProgressSpinnerModule,
IonicModule.forRoot(),
NgxsModule.forRoot([SettingsState], ngxsConfig),
AppTranslocoTestingModule,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class HumanPoseViewerComponent extends BasePoseViewerComponent implements
.subscribe();
}

progress(): number {
get progress(): number {
if (!this.poseEl) {
return 0;
}
Expand All @@ -145,6 +145,6 @@ export class HumanPoseViewerComponent extends BasePoseViewerComponent implements
return 0;
}

return (100 * this.frameIndex) / this.totalFrames;
return this.frameIndex / this.totalFrames;
}
}
3 changes: 1 addition & 2 deletions src/app/pages/translate/pose-viewers/pose-viewers.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {SkeletonPoseViewerComponent} from './skeleton-pose-viewer/skeleton-pose-
import {HumanPoseViewerComponent} from './human-pose-viewer/human-pose-viewer.component';
import {AnimationModule} from '../../../components/animation/animation.module';
import {AppSharedModule} from '../../../core/modules/shared.module';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatTooltipModule} from '@angular/material/tooltip';

const components = [
Expand All @@ -18,7 +17,7 @@ const components = [
];

@NgModule({
imports: [AppSharedModule, IonicModule, AnimationModule, MatProgressBarModule, MatTooltipModule],
imports: [AppSharedModule, IonicModule, AnimationModule, MatTooltipModule],
declarations: components,
exports: components,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {ComponentFixture, TestBed} from '@angular/core/testing';
import {axe, toHaveNoViolations} from 'jasmine-axe';

import {SkeletonPoseViewerComponent} from './skeleton-pose-viewer.component';
import {Pix2PixModule} from '../../../../modules/pix2pix/pix2pix.module';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import {NgxsModule} from '@ngxs/store';
import {SettingsState} from '../../../../modules/settings/settings.state';
Expand All @@ -16,7 +14,7 @@ describe('SkeletonPoseViewerComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SkeletonPoseViewerComponent],
imports: [Pix2PixModule, MatProgressBarModule, NgxsModule.forRoot([SettingsState], ngxsConfig)],
imports: [NgxsModule.forRoot([SettingsState], ngxsConfig)],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents();
});
Expand Down

0 comments on commit 5a2eed1

Please sign in to comment.