-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(controllers): add "ignore input" setting
- Loading branch information
1 parent
b9e7201
commit afe6682
Showing
28 changed files
with
197 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...trollers-list/settings-renderers/control-ignore-input/control-ignore-input.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<mat-slide-toggle *ngIf="control" | ||
[formControl]="control"> | ||
{{ 'controller.ignoreInputControlTitle' | transloco }} | ||
</mat-slide-toggle> |
3 changes: 3 additions & 0 deletions
3
...trollers-list/settings-renderers/control-ignore-input/control-ignore-input.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
display: block; | ||
} |
22 changes: 22 additions & 0 deletions
22
...ontrollers-list/settings-renderers/control-ignore-input/control-ignore-input.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { FormControl, ReactiveFormsModule } from '@angular/forms'; | ||
import { MatSlideToggleModule } from '@angular/material/slide-toggle'; | ||
import { NgIf } from '@angular/common'; | ||
import { TranslocoModule } from '@ngneat/transloco'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'app-control-ignore-input', | ||
templateUrl: './control-ignore-input.component.html', | ||
styleUrls: [ './control-ignore-input.component.scss' ], | ||
imports: [ | ||
MatSlideToggleModule, | ||
ReactiveFormsModule, | ||
NgIf, | ||
TranslocoModule | ||
], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ControlIgnoreInputComponent { | ||
@Input() public control?: FormControl<boolean>; | ||
} |
1 change: 1 addition & 0 deletions
1
src/app/controllers/controllers-list/settings-renderers/control-ignore-input/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './control-ignore-input.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...p/controllers/controllers-list/settings-renderers/gamepad/gamepad-settings.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ontrollers/controllers-list/settings-renderers/hub/hub-controller-settings.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<app-control-ignore-input [control]="ignoreInputControl"></app-control-ignore-input> |
3 changes: 3 additions & 0 deletions
3
...ontrollers/controllers-list/settings-renderers/hub/hub-controller-settings.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
display: block; | ||
} |
55 changes: 55 additions & 0 deletions
55
.../controllers/controllers-list/settings-renderers/hub/hub-controller-settings.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { Observable, map } from 'rxjs'; | ||
import { FormBuilder, FormControl } from '@angular/forms'; | ||
import { HubControllerSettingsModel } from '@app/store'; | ||
|
||
import { IControllerSettingsRenderer } from '../i-controller-settings-renderer'; | ||
import { ControlIgnoreInputComponent } from '../control-ignore-input'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'app-hub-controller-settings', | ||
templateUrl: './hub-controller-settings.component.html', | ||
styleUrls: [ './hub-controller-settings.component.scss' ], | ||
imports: [ | ||
ControlIgnoreInputComponent | ||
], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class HubControllerSettingsComponent implements IControllerSettingsRenderer<HubControllerSettingsModel> { | ||
public readonly canSave$: Observable<boolean>; | ||
|
||
public readonly ignoreInputControl: FormControl<boolean>; | ||
|
||
private settings?: HubControllerSettingsModel; | ||
|
||
constructor( | ||
private readonly formBuilder: FormBuilder, | ||
) { | ||
this.ignoreInputControl = this.formBuilder.control( | ||
false, | ||
{ nonNullable: true } | ||
); | ||
this.canSave$ = this.ignoreInputControl.valueChanges.pipe( | ||
map(() => this.ignoreInputControl.dirty) | ||
); | ||
} | ||
|
||
public loadSettings( | ||
settings: HubControllerSettingsModel | ||
): void { | ||
this.settings = settings; | ||
this.ignoreInputControl.setValue(settings.ignoreInput); | ||
} | ||
|
||
public readSettings(): HubControllerSettingsModel | undefined { | ||
if (!this.settings) { | ||
return undefined; | ||
} | ||
return { | ||
...this.settings, | ||
ignoreInput: this.ignoreInputControl.value | ||
}; | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
src/app/controllers/controllers-list/settings-renderers/hub/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './hub-controller-settings.component'; |
19 changes: 11 additions & 8 deletions
19
...ontrollers/controllers-list/settings-renderers/keyboard/keyboards-settings.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
<section *ngIf="formGroup" | ||
class="keyboard-settings-section" | ||
> | ||
<mat-slide-toggle [formControl]="formGroup.controls.captureNonAlphaNumerics"> | ||
{{ 'controllerProfiles.keyboard.captureNonAlphaNumerics' | transloco }} | ||
</mat-slide-toggle> | ||
<span class="capture-non-alpha-numerics-hint"> | ||
<ng-container *ngIf="formGroup"> | ||
<section class="keyboard-settings-section"> | ||
<app-control-ignore-input [control]="formGroup.controls.ignoreInput"></app-control-ignore-input> | ||
</section> | ||
<section class="keyboard-settings-section"> | ||
<mat-slide-toggle [formControl]="formGroup.controls.captureNonAlphaNumerics"> | ||
{{ 'controllerProfiles.keyboard.captureNonAlphaNumerics' | transloco }} | ||
</mat-slide-toggle> | ||
<span class="capture-non-alpha-numerics-hint"> | ||
({{ 'controllerProfiles.keyboard.captureNonAlphaNumericsHint' | transloco }}) | ||
</span> | ||
</section> | ||
</section> | ||
</ng-container> |
1 change: 1 addition & 0 deletions
1
...ontrollers/controllers-list/settings-renderers/keyboard/keyboards-settings.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.