Fixed monster spawn & extra cargo settings being impossible to select due to the menus being outside of their parent GUIComponent
This commit is contained in:
@@ -132,7 +132,7 @@ namespace Barotrauma
|
||||
|
||||
protected Rectangle ClampRect(Rectangle r)
|
||||
{
|
||||
if (parent == null) return r;
|
||||
if (parent == null || !ClampMouseRectToParent) return r;
|
||||
Rectangle parentRect = parent.ClampRect(parent.rect);
|
||||
if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
|
||||
if (parentRect.X > r.X)
|
||||
@@ -190,10 +190,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool ClampMouseRectToParent = true;
|
||||
public virtual Rectangle MouseRect
|
||||
{
|
||||
get { return CanBeFocused ? ClampRect(rect) : Rectangle.Empty; }
|
||||
get
|
||||
{
|
||||
if (!CanBeFocused) return Rectangle.Empty;
|
||||
return ClampMouseRectToParent ? ClampRect(rect) : rect;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<ComponentState, List<UISprite>> sprites;
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
return ClampRect(rect);
|
||||
return ClampMouseRectToParent ? ClampRect(rect) : rect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Barotrauma
|
||||
|
||||
public override Rectangle MouseRect
|
||||
{
|
||||
get { return ClampRect(box.Rect); }
|
||||
get { return ClampMouseRectToParent ? ClampRect(box.Rect) : box.Rect; }
|
||||
}
|
||||
|
||||
public override ScalableFont Font
|
||||
|
||||
@@ -187,6 +187,7 @@ namespace Barotrauma.Networking
|
||||
monsterButton.Enabled = !GameStarted;
|
||||
var monsterFrame = new GUIListBox(new Rectangle(-290, 60, 280, 250), "", settingsTabs[0]);
|
||||
monsterFrame.Visible = false;
|
||||
monsterFrame.ClampMouseRectToParent = false;
|
||||
monsterButton.UserData = monsterFrame;
|
||||
monsterButton.OnClicked = (button, obj) =>
|
||||
{
|
||||
@@ -231,6 +232,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
var cargoFrame = new GUIListBox(new Rectangle(300, 60, 280, 250), "", settingsTabs[0]);
|
||||
cargoFrame.Visible = false;
|
||||
cargoFrame.ClampMouseRectToParent = false;
|
||||
cargoButton.UserData = cargoFrame;
|
||||
cargoButton.OnClicked = (button, obj) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user