mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Apply same fix to osu!catch composer
This commit is contained in:
@ -94,29 +94,36 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
if (e.Repeat)
|
if (e.Repeat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (handleToggleViaKey(e.Key))
|
handleToggleViaKey(e);
|
||||||
return true;
|
|
||||||
|
|
||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnKeyUp(KeyUpEvent e)
|
protected override void OnKeyUp(KeyUpEvent e)
|
||||||
{
|
{
|
||||||
handleToggleViaKey(e.Key);
|
handleToggleViaKey(e);
|
||||||
base.OnKeyUp(e);
|
base.OnKeyUp(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool handleToggleViaKey(Key key)
|
private TernaryState? distanceSnapBeforeMomentary;
|
||||||
{
|
|
||||||
switch (key)
|
|
||||||
{
|
|
||||||
case Key.AltLeft:
|
|
||||||
case Key.AltRight:
|
|
||||||
distanceSnapToggle.Value = distanceSnapToggle.Value == TernaryState.False ? TernaryState.True : TernaryState.False;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
private void handleToggleViaKey(KeyboardEvent key)
|
||||||
|
{
|
||||||
|
if (key.AltPressed)
|
||||||
|
{
|
||||||
|
if (distanceSnapBeforeMomentary == null)
|
||||||
|
{
|
||||||
|
distanceSnapBeforeMomentary = distanceSnapToggle.Value;
|
||||||
|
distanceSnapToggle.Value = distanceSnapToggle.Value == TernaryState.False ? TernaryState.True : TernaryState.False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (distanceSnapBeforeMomentary != null)
|
||||||
|
{
|
||||||
|
distanceSnapToggle.Value = distanceSnapBeforeMomentary.Value;
|
||||||
|
distanceSnapBeforeMomentary = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
|
Reference in New Issue
Block a user