From 949ef1662db52575a8adbf12f56ca0af9f87de77 Mon Sep 17 00:00:00 2001 From: EoralMilk <1322028031@qq.com> Date: Tue, 18 Oct 2022 14:13:09 +0800 Subject: [PATCH] Add mouse scroll to ProductionPaletteWidget --- .../Widgets/ProductionPaletteWidget.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 543c91d478..03dff613e9 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -258,6 +258,22 @@ namespace OpenRA.Mods.Common.Widgets if (mi.Event == MouseInputEvent.Move) TooltipIcon = icon; + if (mi.Event == MouseInputEvent.Scroll) + { + if (mi.Delta.Y < 0 && CanScrollDown) + { + ScrollDown(); + Ui.ResetTooltips(); + Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); + } + else if (mi.Delta.Y > 0 && CanScrollUp) + { + ScrollUp(); + Ui.ResetTooltips(); + Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); + } + } + if (icon == null) return false;