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:
Joonas Rikkonen
2018-01-10 14:21:37 +02:00
parent 37217db7cb
commit f9500fa6e1
4 changed files with 12 additions and 5 deletions
@@ -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