Use `ExpandingButtonContainer` in editor composer

This commit is contained in:
Dean Herbert 2022-01-06 21:10:45 +09:00
parent 5baaf356aa
commit cea9cab4dc
4 changed files with 23 additions and 15 deletions

View File

@ -94,9 +94,11 @@ protected SettingsToolboxGroup(string title)
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Truncate = true,
Text = title.ToUpperInvariant(),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
Margin = new MarginPadding { Left = 10 },
Padding = new MarginPadding { Left = 10, Right = 30 },
},
button = new IconButton
{

View File

@ -2,13 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Overlays;
namespace osu.Game.Rulesets.Edit
{
public class ToolboxGroup : PlayerSettingsGroup
public class EditorToolboxGroup : SettingsToolboxGroup
{
public ToolboxGroup(string title)
public EditorToolboxGroup(string title)
: base(title)
{
RelativeSizeAxes = Axes.X;

View File

@ -13,6 +13,7 @@
using osu.Framework.Input.Events;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Mods;
@ -98,8 +99,6 @@ private void load()
dependencies.CacheAs(Playfield);
const float toolbar_width = 200;
InternalChildren = new Drawable[]
{
new Container
@ -116,20 +115,15 @@ private void load()
.WithChild(BlueprintContainer = CreateBlueprintContainer())
}
},
new FillFlowContainer
new LeftToolboxFlow
{
Name = "Sidebar",
RelativeSizeAxes = Axes.Y,
Width = toolbar_width,
Padding = new MarginPadding { Right = 10 },
Spacing = new Vector2(10),
Children = new Drawable[]
{
new ToolboxGroup("toolbox (1-9)")
new EditorToolboxGroup("toolbox (1-9)")
{
Child = toolboxCollection = new EditorRadioButtonCollection { RelativeSizeAxes = Axes.X }
},
new ToolboxGroup("toggles (Q~P)")
new EditorToolboxGroup("toggles (Q~P)")
{
Child = togglesCollection = new FillFlowContainer
{
@ -426,6 +420,18 @@ public override float GetSnappedDistanceFromDistance(HitObject referenceObject,
}
#endregion
private class LeftToolboxFlow : ExpandingButtonContainer
{
public LeftToolboxFlow()
: base(80, 200)
{
RelativeSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 10 };
FillFlow.Spacing = new Vector2(10);
}
}
}
/// <summary>

View File

@ -7,7 +7,7 @@
namespace osu.Game.Rulesets.Edit
{
public class ScrollingToolboxGroup : ToolboxGroup
public class ScrollingToolboxGroup : EditorToolboxGroup
{
protected readonly OsuScrollContainer Scroll;