From 671b3d01ff83d9550fcf1b65cfcccdf5d352181d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Nov 2017 04:59:55 +0900 Subject: [PATCH] Fix OsuClickableContainer's local content geting overwritten --- .../Containers/OsuClickableContainer.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs index c9117ed159..8df533ad6e 100644 --- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -11,6 +12,10 @@ public class OsuClickableContainer : ClickableContainer { private readonly HoverSampleSet sampleSet; + private readonly Container content = new Container { RelativeSizeAxes = Axes.Both }; + + protected override Container Content => content; + public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal) { this.sampleSet = sampleSet; @@ -19,7 +24,17 @@ public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal) [BackgroundDependencyLoader] private void load() { - AddInternal(new HoverClickSounds(sampleSet)); + if (AutoSizeAxes != Axes.None) + { + content.RelativeSizeAxes = RelativeSizeAxes; + content.AutoSizeAxes = AutoSizeAxes; + } + + InternalChildren = new Drawable[] + { + content, + new HoverClickSounds(sampleSet) + }; } } }