Move select tool to an actual tool implementation

Also tidies up radio button action firing so calling Select actually fires the associated action in all cases.
This commit is contained in:
Dean Herbert
2020-01-28 15:00:45 +09:00
parent 01cf417569
commit e81d3c51ed
5 changed files with 44 additions and 37 deletions

View File

@ -137,12 +137,12 @@ namespace osu.Game.Rulesets.Edit
}
};
toolboxCollection.Items =
CompositionTools.Select(t => new RadioButton(t.Name, () => selectTool(t)))
.Prepend(new RadioButton("Select", () => selectTool(null)))
.ToList();
toolboxCollection.Items = CompositionTools
.Prepend(new SelectTool())
.Select(t => new RadioButton(t.Name, () => toolSelected(t)))
.ToList();
toolboxCollection.Items[0].Select();
toolboxCollection.Items.First().Select();
blueprintContainer.SelectionChanged += selectionChanged;
}
@ -187,11 +187,11 @@ namespace osu.Game.Rulesets.Edit
showGridFor(hitObjects);
}
private void selectTool(HitObjectCompositionTool tool)
private void toolSelected(HitObjectCompositionTool tool)
{
blueprintContainer.CurrentTool = tool;
if (tool == null)
if (tool is SelectTool)
distanceSnapGridContainer.Hide();
else
showGridFor(Enumerable.Empty<HitObject>());

View File

@ -13,5 +13,7 @@ namespace osu.Game.Rulesets.Edit.Tools
}
public abstract PlacementBlueprint CreatePlacementBlueprint();
public override string ToString() => Name;
}
}

View File

@ -0,0 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Rulesets.Edit.Tools
{
public class SelectTool : HitObjectCompositionTool
{
public SelectTool()
: base("Select")
{
}
public override PlacementBlueprint CreatePlacementBlueprint() => null;
}
}