Remove intermediate container to fix tests

This commit is contained in:
Dean Herbert
2021-05-03 17:34:34 +09:00
parent 839ac968a9
commit 3268a75f05
3 changed files with 48 additions and 46 deletions

View File

@ -10,13 +10,11 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Edit;
using osuTK;
@ -43,10 +41,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
private readonly List<SelectionBlueprint<T>> selectedBlueprints;
private Drawable content;
private OsuSpriteText selectionDetailsText;
protected SelectionBox SelectionBox { get; private set; }
[Resolved(CanBeNull = true)]
@ -63,33 +57,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
InternalChild = content = new Container
{
Children = new Drawable[]
{
// todo: should maybe be inside the SelectionBox?
new Container
{
Name = "info text",
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
Colour = colours.YellowDark,
RelativeSizeAxes = Axes.Both,
},
selectionDetailsText = new OsuSpriteText
{
Padding = new MarginPadding(2),
Colour = colours.Gray0,
Font = OsuFont.Default.With(size: 11)
}
}
},
SelectionBox = CreateSelectionBox(),
}
};
InternalChild = SelectionBox = CreateSelectionBox();
SelectedItems.CollectionChanged += (sender, args) =>
{
@ -305,9 +273,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
int count = SelectedItems.Count;
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;
SelectionBox.Text = count > 0 ? count.ToString() : string.Empty;
content.FadeTo(count > 0 ? 1 : 0);
SelectionBox.FadeTo(count > 0 ? 1 : 0);
OnSelectionChanged();
}
@ -334,8 +302,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
selectionRect = selectionRect.Inflate(5f);
content.Position = selectionRect.Location;
content.Size = selectionRect.Size;
SelectionBox.Position = selectionRect.Location;
SelectionBox.Size = selectionRect.Size;
}
#endregion