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 @@ public override void EndPlacement(bool commit)
// 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 @@ public abstract partial class HitObjectComposer<TObject> : HitObjectComposer, IP
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 @@ private void load(OsuConfigManager config, [CanBeNull] Editor editor)
},
};
toolboxCollection.Items = CompositionTools
.Prepend(new SelectTool())
toolboxCollection.Items = (CompositionTools.Prepend(new SelectTool()))
.Select(t => new HitObjectCompositionToolButton(t, () => toolSelected(t)))
.ToList();
@ -466,8 +468,12 @@ private void selectionChanged(object sender, NotifyCollectionChangedEventArgs ch
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))