Fix OsuClickableContainer's local content geting overwritten

This commit is contained in:
Dean Herbert 2017-11-26 04:59:55 +09:00
parent 9c90d9ca45
commit 671b3d01ff
1 changed files with 16 additions and 1 deletions

View File

@ -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<Drawable> 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)
};
}
}
}