1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 12:57:25 +08:00
osu-lazer/osu.Game/GameModes/Menu/FlowContainerWithOrigin.cs
Thomas Müller 68476eafb9 Use DrawSize instead of Size whereever Size was previously read due to framework changes.
Note, that this was just stupid replacement. Many components will likely want to actually read Size and not DrawSize. We may want to do a pass over this at some point, but for now everything is working like this. (Old behavior.)
2016-10-18 18:53:31 +02:00

32 lines
920 B
C#

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.
/// This target should be a direct child of this FlowContainer.
/// </summary>
public Drawable CentreTarget;
public override Anchor Origin => Anchor.Custom;
public override Vector2 OriginPosition
{
get
{
if (CentreTarget == null)
return base.OriginPosition;
return CentreTarget.DrawPosition + CentreTarget.DrawSize / 2;
}
}
}
}