Add keyboard adjustment support

This commit is contained in:
Dean Herbert
2022-06-15 15:57:09 +09:00
parent 3df9d7c9e1
commit 873806c2ea
2 changed files with 33 additions and 1 deletions

View File

@ -13,6 +13,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Threading;
using osu.Game.Input.Bindings;
using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Overlays.Toolbar
{
@ -78,6 +79,24 @@ namespace osu.Game.Overlays.Toolbar
globalVolume.BindValueChanged(v => volumeBar.ResizeHeightTo((float)v.NewValue, 200, Easing.OutQuint), true);
}
protected override bool OnKeyDown(KeyDownEvent e)
{
switch (e.Key)
{
case Key.Up:
focusForAdjustment();
volume?.Adjust(GlobalAction.IncreaseVolume);
return true;
case Key.Down:
focusForAdjustment();
volume?.Adjust(GlobalAction.IncreaseVolume, -1);
return true;
}
return base.OnKeyDown(e);
}
protected override bool OnScroll(ScrollEvent e)
{
focusForAdjustment();