1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 09:39:04 +08:00

Switch back to last tool after using grid tool, rather than always select tool

This commit is contained in:
Dean Herbert 2024-10-08 17:34:51 +09:00
parent 682023e130
commit b1be31cd6a
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints
// You typically only place the grid once, so we switch back to the select tool after placement.
if (commit && hitObjectComposer is OsuHitObjectComposer osuHitObjectComposer)
osuHitObjectComposer.SetSelectTool();
osuHitObjectComposer.SetLastTool();
}
protected override bool OnClick(ClickEvent e)

View File

@ -90,6 +90,9 @@ namespace osu.Game.Rulesets.Edit
private Bindable<bool> autoSeekOnPlacement;
private readonly Bindable<bool> composerFocusMode = new Bindable<bool>();
[CanBeNull]
private RadioButton lastTool;
protected DrawableRuleset<TObject> DrawableRuleset { get; private set; }
protected HitObjectComposer(Ruleset ruleset)
@ -213,8 +216,7 @@ namespace osu.Game.Rulesets.Edit
},
};
toolboxCollection.Items = CompositionTools
.Prepend(new SelectTool())
toolboxCollection.Items = (CompositionTools.Prepend(new SelectTool()))
.Select(t => new HitObjectCompositionToolButton(t, () => toolSelected(t)))
.ToList();
@ -466,8 +468,12 @@ namespace osu.Game.Rulesets.Edit
public void SetSelectTool() => toolboxCollection.Items.First().Select();
public void SetLastTool() => (lastTool ?? toolboxCollection.Items.First()).Select();
private void toolSelected(CompositionTool tool)
{
lastTool = toolboxCollection.Items.OfType<HitObjectCompositionToolButton>().FirstOrDefault(i => i.Tool == BlueprintContainer.CurrentTool);
BlueprintContainer.CurrentTool = tool;
if (!(tool is SelectTool))