Modules made more useable by improving or fixing some of the drawing position logic. Variable names refactored as well.

This commit is contained in:
2019-03-09 00:57:29 -06:00
parent 782ca31f15
commit ed11d31100
6 changed files with 54 additions and 50 deletions

View File

@@ -16,16 +16,16 @@ namespace RecrownedAthenaeum.UI.Modular
/// <summary>
/// The bounds before factoring in the origin.
/// </summary>
public Rectangle bounds;
public Rectangle situation;
/// <summary>
/// Bounds of this module (after factoring in the origin).
/// </summary>
public Rectangle FinalBounds
public Rectangle Boundaries
{
get
{
return new Rectangle((int)(bounds.X - origin.X), (int)(bounds.Y - origin.Y), bounds.Width, bounds.Height);
return new Rectangle((int)(situation.X - origin.X), (int)(situation.Y - origin.Y), situation.Width, situation.Height);
}
}
@@ -120,8 +120,8 @@ namespace RecrownedAthenaeum.UI.Modular
/// </summary>
public void CenterOrigin()
{
origin.X = bounds.Width / 2f;
origin.Y = bounds.Height / 2f;
origin.X = situation.Width / 2f;
origin.Y = situation.Height / 2f;
}
/// <summary>
@@ -131,9 +131,9 @@ namespace RecrownedAthenaeum.UI.Modular
/// <returns>True if possible and false if not.</returns>
public bool CenterHorizontally(Rectangle rectangle)
{
if (rectangle.Width >= bounds.Width)
if (rectangle.Width >= Boundaries.Width)
{
bounds.X = rectangle.Width / 2 + rectangle.X;
situation.X = rectangle.Width / 2 + situation.X;
return true;
}
return false;
@@ -146,9 +146,9 @@ namespace RecrownedAthenaeum.UI.Modular
/// <returns>True if possible.</returns>
public bool CenterVertically(Rectangle rectangle)
{
if (rectangle.Height >= bounds.Height)
if (rectangle.Height >= Boundaries.Height)
{
bounds.Y = rectangle.Height / 2 + rectangle.Y;
situation.Y = rectangle.Height / 2 + situation.Y;
return true;
}
return false;