♻️ 优化滚动条动画 :boom:增加触底切换菜单

This commit is contained in:
BookerLiu
2022-08-02 17:28:09 +08:00
parent aa2ca80822
commit 001270e4ad
12 changed files with 561 additions and 114 deletions

View File

@@ -333,7 +333,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
appData.AppConfig.SelectedMenuIcons = null;
RunTimeStatus.SHOW_MENU_PASSWORDBOX = true;
MainWindow.mainWindow.RightCard.PDDialog.Title.Text = "输入密码";
MainWindow.mainWindow.RightCard.PDDialog.type = PasswordType.INPUT;
MainWindow.mainWindow.RightCard.PDDialog.Visibility = Visibility.Visible;
}
else
@@ -426,32 +425,46 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Menu_MouseWheel(object sender, MouseWheelEventArgs e)
{
if (RunTimeStatus.IS_MENU_EDIT) return;
ScrollViewer scrollViewer = ScrollUtil.FindSimpleVisualChild<ScrollViewer>(MenuListBox);
if (e.Delta < 0)
{
int index = MenuListBox.SelectedIndex;
if (index < MenuListBox.Items.Count - 1)
//判断是否到了最底部
if (ScrollUtil.IsBootomScrollView(scrollViewer))
{
index ++;
} else
{
index = 0;
int index = MenuListBox.SelectedIndex;
if (index < MenuListBox.Items.Count - 1)
{
index++;
}
else
{
index = 0;
}
MenuListBox.SelectedIndex = index;
}
MenuListBox.SelectedIndex = index;
} else if (e.Delta > 0)
{
int index = MenuListBox.SelectedIndex;
if (index > 0)
if (ScrollUtil.IsTopScrollView(scrollViewer))
{
index --;
int index = MenuListBox.SelectedIndex;
if (index > 0)
{
index--;
}
else
{
index = MenuListBox.Items.Count - 1;
}
MenuListBox.SelectedIndex = index;
}
else
{
index = MenuListBox.Items.Count - 1;
}
MenuListBox.SelectedIndex = index;
}
//滚动到选中项
MenuListBox.ScrollIntoView(MenuListBox.SelectedItem);
}
private void Menu_PreviewDragLeave(object sender, DragEventArgs e)
{