chore: gpu 选项禁用滚轮切换

fix #12210
This commit is contained in:
uye
2025-03-31 00:51:03 +08:00
parent acd8afd3b5
commit 443c9a74ff
6 changed files with 16 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ namespace MaaWpfGui.Helper
{
public static class MouseWheelHelper
{
public static void HandlePreviewMouseWheel(object sender, MouseWheelEventArgs e)
public static void RouteMouseWheelToParent(object sender, MouseWheelEventArgs e)
{
if (e.Handled)
{
@@ -21,5 +21,13 @@ namespace MaaWpfGui.Helper
var parent = ((Control)sender).Parent as UIElement;
parent?.RaiseEvent(eventArg);
}
public static void DisableComboBoxScrollWhenClosed(object sender, MouseWheelEventArgs e)
{
if (sender is ComboBox { IsDropDownOpen: false })
{
e.Handled = true; // 阻止滚动
}
}
}
}

View File

@@ -72,7 +72,7 @@
d:Markdown="#Test
This is a test text.

~~This is a test text~~

*This is a test text*

**This is a test text**"
ClickAction="SafetyOpenBrowser"
Markdown="{Binding SelectedAnnouncementSection.Content}"
PreviewMouseWheel="{s:Action HandlePreviewMouseWheel,
PreviewMouseWheel="{s:Action RouteMouseWheelToParent,
Target={x:Type helper:MouseWheelHelper}}">
<mdxam:MarkdownScrollViewer.MarkdownStyle>
<StaticResource ResourceKey="MdXamlStyle" />

View File

@@ -222,7 +222,7 @@
HeadersVisibility="None"
IsReadOnly="True"
ItemsSource="{Binding OperBoxNotHaveList}"
PreviewMouseWheel="{s:Action HandlePreviewMouseWheel,
PreviewMouseWheel="{s:Action RouteMouseWheelToParent,
Target={x:Type helper:MouseWheelHelper}}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
@@ -253,7 +253,7 @@
HeadersVisibility="None"
IsReadOnly="True"
ItemsSource="{Binding OperBoxHaveList}"
PreviewMouseWheel="{s:Action HandlePreviewMouseWheel,
PreviewMouseWheel="{s:Action RouteMouseWheelToParent,
Target={x:Type helper:MouseWheelHelper}}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"

View File

@@ -52,7 +52,7 @@
Margin="10,10,10,0"
ClickAction="SafetyOpenBrowser"
Markdown="{Binding UpdateInfo}"
PreviewMouseWheel="{s:Action HandlePreviewMouseWheel,
PreviewMouseWheel="{s:Action RouteMouseWheelToParent,
Target={x:Type helper:MouseWheelHelper}}">
<mdxam:MarkdownScrollViewer.MarkdownStyle>
<StaticResource ResourceKey="MdXamlStyle" />

View File

@@ -34,6 +34,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
ItemsSource="{Binding GpuOptions}"
PreviewMouseWheel="{s:Action DisableComboBoxScrollWhenClosed,
Target={x:Type helper:MouseWheelHelper}}"
SelectedValue="{Binding ActiveGpuOption}">
<hc:ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource ComboBoxItemBaseStyle}" TargetType="ComboBoxItem">

View File

@@ -125,7 +125,7 @@
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
ItemsSource="{Binding Path=InfrastItemViewModels}"
PreviewMouseWheel="{s:Action HandlePreviewMouseWheel,
PreviewMouseWheel="{s:Action RouteMouseWheelToParent,
Target={x:Type helper:MouseWheelHelper}}"
ToolTip="{DynamicResource LabelSequenceTip}">
<ListBox.ItemTemplate>