diff --git a/Barotrauma/BarotraumaClient/BarotraumaClient.csproj b/Barotrauma/BarotraumaClient/BarotraumaClient.csproj
index afbfca56d..acb9b2259 100644
--- a/Barotrauma/BarotraumaClient/BarotraumaClient.csproj
+++ b/Barotrauma/BarotraumaClient/BarotraumaClient.csproj
@@ -52,14 +52,20 @@
x86
- false
+ true
+ pdbonly
+ true
..\bin\ReleaseWindows\
+ TRACE;WINDOWS;CLIENT
4
x86
+ true
+ full
false
..\bin\DebugWindows\
+ TRACE;WINDOWS;CLIENT;DEBUG
4
x86
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
index c4ac9c6bd..8d5f89034 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
@@ -129,10 +129,41 @@ namespace Barotrauma
{
get { return new Vector2(rect.Center.X, rect.Center.Y); }
}
-
+
+ protected Rectangle ClampRect(Rectangle r)
+ {
+ if (parent == null) return r;
+ Rectangle parentRect = parent.ClampRect(parent.rect);
+ if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
+ if (parentRect.X > r.X)
+ {
+ int diff = parentRect.X - r.X;
+ r.X = parentRect.X;
+ r.Width -= diff;
+ }
+ if (parentRect.Y > r.Y)
+ {
+ int diff = parentRect.Y - r.Y;
+ r.Y = parentRect.Y;
+ r.Height -= diff;
+ }
+ if (parentRect.X + parentRect.Width < r.X + r.Width)
+ {
+ int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
+ r.Width -= diff;
+ }
+ if (parentRect.Y + parentRect.Height < r.Y + r.Height)
+ {
+ int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
+ r.Height -= diff;
+ }
+ if (r.Width <= 0 || r.Height <= 0) return Rectangle.Empty;
+ return r;
+ }
+
public virtual Rectangle Rect
{
- get { return rect; }
+ get { return rect; }
set
{
int prevX = rect.X, prevY = rect.Y;
@@ -162,7 +193,7 @@ namespace Barotrauma
public virtual Rectangle MouseRect
{
- get { return CanBeFocused ? rect : Rectangle.Empty; }
+ get { return CanBeFocused ? ClampRect(rect) : Rectangle.Empty; }
}
public Dictionary> sprites;
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs
index b1cd60307..363682fef 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs
@@ -283,7 +283,7 @@ namespace Barotrauma
{
get
{
- return rect;
+ return ClampRect(rect);
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs
index 27dea057a..7bdce1606 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs
@@ -63,7 +63,7 @@ namespace Barotrauma
public override Rectangle MouseRect
{
- get { return box.Rect; }
+ get { return ClampRect(box.Rect); }
}
public override ScalableFont Font
diff --git a/Barotrauma/BarotraumaServer/BarotraumaServer.csproj b/Barotrauma/BarotraumaServer/BarotraumaServer.csproj
index f8c7ec01e..2cb7b45a8 100644
--- a/Barotrauma/BarotraumaServer/BarotraumaServer.csproj
+++ b/Barotrauma/BarotraumaServer/BarotraumaServer.csproj
@@ -51,14 +51,20 @@
x86
- false
+ true
+ pdbonly
+ true
bin\x86\ReleaseWindows
+ TRACE;SERVER
4
x86
+ true
+ full
false
bin\x86\DebugWindows
+ TRACE;SERVER;DEBUG
4
x86