| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using Avalonia.Svg.Skia;
- using CommunityToolkit.Mvvm.ComponentModel;
- using Ryujinx.Ava.UI.Models.Input;
- namespace Ryujinx.Ava.UI.ViewModels.Input
- {
- public partial class KeyboardInputViewModel : BaseModel
- {
- [ObservableProperty] private KeyboardInputConfig _config;
- private bool _isLeft;
- public bool IsLeft
- {
- get => _isLeft;
- set
- {
- _isLeft = value;
- OnPropertyChanged();
- OnPropertyChanged(nameof(HasSides));
- }
- }
- private bool _isRight;
- public bool IsRight
- {
- get => _isRight;
- set
- {
- _isRight = value;
- OnPropertyChanged();
- OnPropertyChanged(nameof(HasSides));
- }
- }
- public bool HasSides => IsLeft ^ IsRight;
- [ObservableProperty] private SvgImage _image;
- public readonly InputViewModel ParentModel;
- public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config)
- {
- ParentModel = model;
- model.NotifyChangesEvent += OnParentModelChanged;
- OnParentModelChanged();
- Config = config;
- }
- public void OnParentModelChanged()
- {
- IsLeft = ParentModel.IsLeft;
- IsRight = ParentModel.IsRight;
- Image = ParentModel.Image;
- }
- }
- }
|