Skip to content

Commit

Permalink
Add back right-click-for-new-combo and right-click-delete when in com…
Browse files Browse the repository at this point in the history
…pose mode

Requested too many times to count.

I'm not sure what to do about the code quality of this. It's a bit weird
that there's no way to check the current composition tool from a higher
level.

Also it was discussed IRL that there should be some kind of hinting that
existing notes will be deleted when they are hovered, but I'm not sure
how well this will work in normal mapping flows, since it will display
even in cases that users aren't intending to delete an object. Still
willing to explore this direction though (it's just non-trivial to
implement so I haven't yet).
  • Loading branch information
peppy committed Feb 26, 2025
1 parent b3965f0 commit 270e278
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using osu.Game.Screens.Edit.Components.TernaryButtons;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
using osuTK.Input;

namespace osu.Game.Rulesets.Osu.Edit
{
Expand Down Expand Up @@ -351,6 +352,19 @@ private void updateDistanceSnapGrid()
}
}

protected override bool OnMouseDown(MouseDownEvent e)
{
if (e.Button == MouseButton.Right)
{
var osuSelectionHandler = (OsuSelectionHandler)BlueprintContainer.SelectionHandler;

osuSelectionHandler.SelectionNewComboState.Value =
osuSelectionHandler.SelectionNewComboState.Value == TernaryState.False ? TernaryState.True : TernaryState.False;
}

return base.OnMouseDown(e);
}

protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Repeat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ public CompositionTool CurrentTool

currentTool = value;

// Maybe this should go in EditorState or somewhere else? Feels a bit haphazard.
SelectionHandler.IsInSelectionMode = currentTool is SelectTool;

// As per stable editor, when changing tools, we should forcefully commit any pending placement.
CommitIfPlacementActive();
}
Expand Down
4 changes: 3 additions & 1 deletion osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
public abstract partial class SelectionHandler<T> : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IKeyBindingHandler<GlobalAction>, IHasContextMenu
{
public bool IsInSelectionMode { get; set; }

/// <summary>
/// How much padding around the selection area is added.
/// </summary>
Expand Down Expand Up @@ -271,7 +273,7 @@ internal virtual void HandleDeselected(SelectionBlueprint<T> blueprint)
/// <returns>Whether a selection was performed.</returns>
internal virtual bool MouseDownSelectionRequested(SelectionBlueprint<T> blueprint, MouseButtonEvent e)
{
if (e.Button == MouseButton.Middle || (e.ShiftPressed && e.Button == MouseButton.Right))
if (e.Button == MouseButton.Middle || (!IsInSelectionMode || (e.ShiftPressed && e.Button == MouseButton.Right)))
{
handleQuickDeletion(blueprint);
return true;
Expand Down

0 comments on commit 270e278

Please sign in to comment.