mirror of
https://github.com/4sval/FModel.git
synced 2026-12-04 23:02:22 -06:00
Keyboard navigation fixes
This commit is contained in:
@@ -4,7 +4,7 @@ namespace FModel.Extensions;
|
||||
|
||||
public static class ListBoxExtensions
|
||||
{
|
||||
public static ListBoxItem RevealItem(this ListBox list, object item, bool alignToTop = false)
|
||||
public static ListBoxItem RevealItem(this ListBox list, object item)
|
||||
{
|
||||
var index = list.Items.IndexOf(item);
|
||||
if (index < 0)
|
||||
@@ -12,12 +12,6 @@ public static class ListBoxExtensions
|
||||
|
||||
list.ApplyTemplate();
|
||||
list.UpdateLayout();
|
||||
if (alignToTop && list.FindVisualChild<ScrollViewer>() is { } scroll)
|
||||
{
|
||||
scroll.ScrollToVerticalOffset(index);
|
||||
list.UpdateLayout();
|
||||
}
|
||||
|
||||
if (list.FindVisualChild<VirtualizingPanel>() is { } panel)
|
||||
{
|
||||
panel.BringIndexIntoViewPublic(index);
|
||||
|
||||
@@ -382,6 +382,7 @@
|
||||
<Separator Grid.Row="1" Style="{StaticResource CustomSeparator}" Margin="0" />
|
||||
<controls:FolderTree Grid.Row="2" x:Name="AssetsFolderName"
|
||||
Style="{StaticResource AssetsFolderListBox}"
|
||||
IsTextSearchEnabled="False"
|
||||
Folders="{Binding CUE4Parse.AssetsFolder}"
|
||||
ItemsSource="{Binding CUE4Parse.AssetsFolder.VisibleFolders}"
|
||||
SelectedItem="{Binding CUE4Parse.AssetsFolder.SelectedFolder, Mode=TwoWay}"
|
||||
|
||||
@@ -165,7 +165,7 @@ public partial class MainWindow
|
||||
_applicationView.CUE4Parse.TabControl.SelectedTab.GoNextImage();
|
||||
else if (_applicationView.Status.IsReady && _applicationView.IsAssetsExplorerVisible && Keyboard.Modifiers.HasFlag(ModifierKeys.Alt))
|
||||
{
|
||||
CategoriesSelector.SelectedIndex = e.SystemKey switch
|
||||
var categoryIndex = e.SystemKey switch
|
||||
{
|
||||
Key.D0 or Key.NumPad0 => 0,
|
||||
Key.D1 or Key.NumPad1 => 1,
|
||||
@@ -177,8 +177,13 @@ public partial class MainWindow
|
||||
Key.D7 or Key.NumPad7 => 7,
|
||||
Key.D8 or Key.NumPad8 => 8,
|
||||
Key.D9 or Key.NumPad9 => 9,
|
||||
_ => CategoriesSelector.SelectedIndex
|
||||
_ => -1
|
||||
};
|
||||
|
||||
if (categoryIndex < 0)
|
||||
return;
|
||||
|
||||
CategoriesSelector.SelectedIndex = categoryIndex;
|
||||
}
|
||||
else if (_applicationView.Status.IsReady && UserSettings.Default.ExportData.IsTriggered(e.Key))
|
||||
OnExportHotkey("Save_Data");
|
||||
@@ -210,6 +215,10 @@ public partial class MainWindow
|
||||
_applicationView.SelectedLeftTabIndex--;
|
||||
else if (UserSettings.Default.DirRightTab.IsTriggered(e.Key) && _applicationView.SelectedLeftTabIndex < LeftTabControl.Items.Count - 1)
|
||||
_applicationView.SelectedLeftTabIndex++;
|
||||
else
|
||||
return;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnSearchViewClick(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -55,6 +55,7 @@ public partial class AudioPlayer
|
||||
|
||||
if (UserSettings.Default.AddAudio.IsTriggered(e.Key))
|
||||
{
|
||||
e.Handled = true;
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Title = "Select an audio file",
|
||||
@@ -77,6 +78,10 @@ public partial class AudioPlayer
|
||||
_applicationView.AudioPlayer.Next();
|
||||
else if (UserSettings.Default.RemoveAudio.IsTriggered(e.Key))
|
||||
_applicationView.AudioPlayer.Remove();
|
||||
else
|
||||
return;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnAudioFileMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
|
||||
@@ -23,17 +23,6 @@ public sealed class FolderTree : ListBox
|
||||
|
||||
public event EventHandler OpenAssets;
|
||||
|
||||
public FolderTree()
|
||||
{
|
||||
IsVisibleChanged += (_, e) =>
|
||||
{
|
||||
if (e.NewValue is true)
|
||||
{
|
||||
RevealSelection();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void SelectFolder(TreeItem folder)
|
||||
{
|
||||
Folders.Reveal(folder);
|
||||
@@ -53,14 +42,6 @@ public sealed class FolderTree : ListBox
|
||||
}
|
||||
}
|
||||
|
||||
public void RevealSelection()
|
||||
{
|
||||
if (SelectedItem is TreeItem folder)
|
||||
{
|
||||
this.RevealItem(folder, alignToTop: true);
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleFolder(TreeItem folder)
|
||||
{
|
||||
if (Folders == null)
|
||||
|
||||
Reference in New Issue
Block a user