added keyboard navigation for selected images -> TOOD: allow visual keyboardnavigation when photo is not maximized

This commit is contained in:
Ano-sys
2026-04-03 01:26:51 +02:00
parent 70f22af18c
commit 162df64596
3 changed files with 90 additions and 7 deletions
+20 -1
View File
@@ -91,10 +91,29 @@ public partial class MainWindowViewModel : ViewModelBase
await SelectedPhoto.LoadFullImage();
}
public void SelectedPhotoClicked()
public void ResetSelectedPhoto()
{
if (SelectedPhoto is null) return;
SelectedPhoto.FullImage = null;
SelectedPhoto = null;
}
public async Task TryFocusImage(int index)
{
if (index < 0 || index >= Photos.Count ) return;
// if(SelectedPhoto != null) ResetSelectedPhoto();
SelectedPhoto = Photos[index];
await SelectedPhoto.LoadFullImage();
}
public void UnfocusPhoto() => ResetSelectedPhoto();
public bool IsPhotoFocused() => SelectedPhoto != null;
public int GetImageIndex(Image i)
{
var p = Photos.FirstOrDefault(x => x.PreviewImage == i.Source);
if (p is null) return -1;
return Photos.IndexOf(p);
}
}