From 3fb60740beabe98f8694c525944e845395625f2c Mon Sep 17 00:00:00 2001 From: Ivaylo Draganov Date: Fri, 7 Jun 2019 00:27:38 +0300 Subject: [PATCH] Add support for opening DropDownButtonWidget upwards if clipped by the viewport --- OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs b/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs index 676cbd9912..fc8f70948c 100644 --- a/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/DropDownButtonWidget.cs @@ -101,9 +101,13 @@ namespace OpenRA.Mods.Common.Widgets panelRoot.AddChild(fullscreenMask); var oldBounds = panel.Bounds; + var panelY = RenderOrigin.Y + Bounds.Height - panelRoot.RenderOrigin.Y; + if (panelY + oldBounds.Height > Game.Renderer.Resolution.Height) + panelY -= (Bounds.Height + oldBounds.Height); + panel.Bounds = new Rectangle( RenderOrigin.X - panelRoot.RenderOrigin.X, - RenderOrigin.Y + Bounds.Height - panelRoot.RenderOrigin.Y, + panelY, oldBounds.Width, oldBounds.Height); panelRoot.AddChild(panel);