2016-10-08 11:53:46 +08:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.GameModes.Menu
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A flow container with an origin based on one of its contained drawables.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class FlowContainerWithOrigin : FlowContainer
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A target drawable which this flowcontainer should be centered around.
|
2016-10-12 14:28:28 +08:00
|
|
|
|
/// This target should be a direct child of this FlowContainer.
|
2016-10-08 11:53:46 +08:00
|
|
|
|
/// </summary>
|
2016-10-12 14:28:28 +08:00
|
|
|
|
public Drawable CentreTarget;
|
2016-10-08 11:53:46 +08:00
|
|
|
|
|
|
|
|
|
public override Anchor Origin => Anchor.Custom;
|
|
|
|
|
|
|
|
|
|
public override Vector2 OriginPosition
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (CentreTarget == null)
|
|
|
|
|
return base.OriginPosition;
|
|
|
|
|
|
|
|
|
|
return CentreTarget.Position + CentreTarget.Size / 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|