1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Allow bypassing origin/anchor setting of skinnable components

It makes little sense to set these when using RelativeSizeAxes.Both
This commit is contained in:
Dean Herbert 2020-10-14 17:20:10 +09:00
parent 899bac6ca5
commit 6a6718ebab
2 changed files with 14 additions and 2 deletions

View File

@ -14,6 +14,7 @@ namespace osu.Game.Screens.Play.HUD
public SkinnableComboCounter()
: base(new HUDSkinComponent(HUDSkinComponents.ComboCounter), createDefault)
{
CentreComponent = false;
}
private IComboCounter skinnedCounter;

View File

@ -19,6 +19,12 @@ namespace osu.Game.Skinning
/// </summary>
public Drawable Drawable { get; private set; }
/// <summary>
/// Whether the drawable component should be centered in available space.
/// Defaults to true.
/// </summary>
public bool CentreComponent { get; set; } = true;
public new Axes AutoSizeAxes
{
get => base.AutoSizeAxes;
@ -84,8 +90,13 @@ namespace osu.Game.Skinning
if (Drawable != null)
{
scaling.Invalidate();
Drawable.Origin = Anchor.Centre;
Drawable.Anchor = Anchor.Centre;
if (CentreComponent)
{
Drawable.Origin = Anchor.Centre;
Drawable.Anchor = Anchor.Centre;
}
InternalChild = Drawable;
}
else