Added convenience function for UI modules that centers the origin relative to the bounds.
This commit is contained in:
parent
66b2fb9c5c
commit
fa8a8f169c
@ -78,10 +78,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// </summary>
|
||||
public void RemoveFromParent()
|
||||
{
|
||||
if (Parent == null)
|
||||
{
|
||||
throw new InvalidOperationException("Parent is null.");
|
||||
}
|
||||
if (Parent == null) throw new InvalidOperationException("Parent is null.");
|
||||
Parent.RemoveModule(this);
|
||||
}
|
||||
|
||||
@ -104,5 +101,14 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the origin to be the center of the bounds.
|
||||
/// </summary>
|
||||
public void CenterOrigin()
|
||||
{
|
||||
origin.X = bounds.Width / 2f;
|
||||
origin.Y = bounds.Height / 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user