1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-05 04:52:53 +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() public SkinnableComboCounter()
: base(new HUDSkinComponent(HUDSkinComponents.ComboCounter), createDefault) : base(new HUDSkinComponent(HUDSkinComponents.ComboCounter), createDefault)
{ {
CentreComponent = false;
} }
private IComboCounter skinnedCounter; private IComboCounter skinnedCounter;

View File

@ -19,6 +19,12 @@ namespace osu.Game.Skinning
/// </summary> /// </summary>
public Drawable Drawable { get; private set; } 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 public new Axes AutoSizeAxes
{ {
get => base.AutoSizeAxes; get => base.AutoSizeAxes;
@ -84,8 +90,13 @@ namespace osu.Game.Skinning
if (Drawable != null) if (Drawable != null)
{ {
scaling.Invalidate(); scaling.Invalidate();
if (CentreComponent)
{
Drawable.Origin = Anchor.Centre; Drawable.Origin = Anchor.Centre;
Drawable.Anchor = Anchor.Centre; Drawable.Anchor = Anchor.Centre;
}
InternalChild = Drawable; InternalChild = Drawable;
} }
else else