Fix orphaned DropDown panels (eg when exiting menus using a hotkey)
This commit is contained in:
@@ -52,11 +52,19 @@ namespace OpenRA.Widgets
|
|||||||
// This is crap
|
// This is crap
|
||||||
public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */
|
public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */
|
||||||
|
|
||||||
|
public override void Removed()
|
||||||
|
{
|
||||||
|
base.Removed();
|
||||||
|
RemovePanel();
|
||||||
|
}
|
||||||
|
|
||||||
public void RemovePanel()
|
public void RemovePanel()
|
||||||
{
|
{
|
||||||
|
if (panel == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Widget.RootWidget.RemoveChild(fullscreenMask);
|
Widget.RootWidget.RemoveChild(fullscreenMask);
|
||||||
Widget.RootWidget.RemoveChild(panel);
|
Widget.RootWidget.RemoveChild(panel);
|
||||||
Game.BeforeGameStart -= RemovePanel;
|
|
||||||
panel = fullscreenMask = null;
|
panel = fullscreenMask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +78,6 @@ namespace OpenRA.Widgets
|
|||||||
fullscreenMask = new ContainerWidget();
|
fullscreenMask = new ContainerWidget();
|
||||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height);
|
fullscreenMask.Bounds = new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height);
|
||||||
Widget.RootWidget.AddChild(fullscreenMask);
|
Widget.RootWidget.AddChild(fullscreenMask);
|
||||||
Game.BeforeGameStart += RemovePanel;
|
|
||||||
|
|
||||||
fullscreenMask.OnMouseDown = mi =>
|
fullscreenMask.OnMouseDown = mi =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user