mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
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:
@ -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>());
|
||||
|
@ -13,5 +13,7 @@ namespace osu.Game.Rulesets.Edit.Tools
|
||||
}
|
||||
|
||||
public abstract PlacementBlueprint CreatePlacementBlueprint();
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
}
|
||||
|
15
osu.Game/Rulesets/Edit/Tools/SelectTool.cs
Normal file
15
osu.Game/Rulesets/Edit/Tools/SelectTool.cs
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user