mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 06:22:56 +08:00
Add back right-click-for-new-combo and right-click-delete when in compose 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).
This commit is contained in:
parent
d72a0b04b8
commit
ad74b8346a
@ -28,6 +28,7 @@ using osu.Game.Rulesets.UI;
|
|||||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
{
|
{
|
||||||
@ -343,6 +344,19 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
{
|
{
|
||||||
if (e.Repeat)
|
if (e.Repeat)
|
||||||
|
@ -440,6 +440,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
currentTool = value;
|
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.
|
// As per stable editor, when changing tools, we should forcefully commit any pending placement.
|
||||||
CommitIfPlacementActive();
|
CommitIfPlacementActive();
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
foreach ((string bankName, var bindable) in SelectionAdditionBankStates)
|
foreach ((string bankName, var bindable) in SelectionAdditionBankStates)
|
||||||
{
|
{
|
||||||
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name != HitSampleInfo.HIT_NORMAL), h => (bankName != HIT_BANK_AUTO && h.Bank == bankName && !h.EditorAutoBank) || (bankName == HIT_BANK_AUTO && h.EditorAutoBank));
|
bindable.Value = GetStateFromSelection(samplesInSelection.SelectMany(s => s).Where(o => o.Name != HitSampleInfo.HIT_NORMAL),
|
||||||
|
h => (bankName != HIT_BANK_AUTO && h.Bank == bankName && !h.EditorAutoBank) || (bankName == HIT_BANK_AUTO && h.EditorAutoBank));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,14 +381,21 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
string normalBank = h.Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank ?? HitSampleInfo.BANK_SOFT;
|
string normalBank = h.Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank ?? HitSampleInfo.BANK_SOFT;
|
||||||
h.Samples = h.Samples.Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? bankName == HIT_BANK_AUTO ? s.With(newBank: normalBank, newEditorAutoBank: true) : s.With(newBank: bankName, newEditorAutoBank: false) : s).ToList();
|
h.Samples = h.Samples.Select(s =>
|
||||||
|
s.Name != HitSampleInfo.HIT_NORMAL
|
||||||
|
? bankName == HIT_BANK_AUTO ? s.With(newBank: normalBank, newEditorAutoBank: true) : s.With(newBank: bankName, newEditorAutoBank: false)
|
||||||
|
: s)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (h is IHasRepeats hasRepeats)
|
if (h is IHasRepeats hasRepeats)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < hasRepeats.NodeSamples.Count; ++i)
|
for (int i = 0; i < hasRepeats.NodeSamples.Count; ++i)
|
||||||
{
|
{
|
||||||
normalBank = hasRepeats.NodeSamples[i].FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank ?? HitSampleInfo.BANK_SOFT;
|
normalBank = hasRepeats.NodeSamples[i].FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank ?? HitSampleInfo.BANK_SOFT;
|
||||||
hasRepeats.NodeSamples[i] = hasRepeats.NodeSamples[i].Select(s => s.Name != HitSampleInfo.HIT_NORMAL ? bankName == HIT_BANK_AUTO ? s.With(newBank: normalBank, newEditorAutoBank: true) : s.With(newBank: bankName, newEditorAutoBank: false) : s).ToList();
|
hasRepeats.NodeSamples[i] = hasRepeats.NodeSamples[i].Select(s =>
|
||||||
|
s.Name != HitSampleInfo.HIT_NORMAL
|
||||||
|
? bankName == HIT_BANK_AUTO ? s.With(newBank: normalBank, newEditorAutoBank: true) : s.With(newBank: bankName, newEditorAutoBank: false)
|
||||||
|
: s).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract partial class SelectionHandler<T> : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IKeyBindingHandler<GlobalAction>, IHasContextMenu
|
public abstract partial class SelectionHandler<T> : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IKeyBindingHandler<GlobalAction>, IHasContextMenu
|
||||||
{
|
{
|
||||||
|
public bool IsInSelectionMode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How much padding around the selection area is added.
|
/// How much padding around the selection area is added.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -271,7 +273,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// <returns>Whether a selection was performed.</returns>
|
/// <returns>Whether a selection was performed.</returns>
|
||||||
internal virtual bool MouseDownSelectionRequested(SelectionBlueprint<T> blueprint, MouseButtonEvent e)
|
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);
|
handleQuickDeletion(blueprint);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user