mirror of
https://github.com/osukey/osukey.git
synced 2025-06-29 07:07:55 +09:00
Correctly block scroll events when hovering controls
This commit is contained in:
parent
2cc7953421
commit
2a18625b2c
@ -177,12 +177,13 @@ namespace osu.Game.Overlays.Volume
|
|||||||
{
|
{
|
||||||
float amount = adjust_step * direction;
|
float amount = adjust_step * direction;
|
||||||
|
|
||||||
var mouse = GetContainingInputManager().CurrentState.Mouse;
|
// handle the case where the OnPressed action was actually a mouse wheel.
|
||||||
if (mouse.HasPreciseScroll)
|
// this allows for precise wheel handling.
|
||||||
|
var state = GetContainingInputManager().CurrentState;
|
||||||
|
if (state.Mouse?.ScrollDelta.Y != 0)
|
||||||
{
|
{
|
||||||
float scrollDelta = mouse.ScrollDelta.Y;
|
OnScroll(state);
|
||||||
if (scrollDelta != 0)
|
return;
|
||||||
amount *= Math.Abs(scrollDelta / 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Volume += amount;
|
Volume += amount;
|
||||||
@ -205,6 +206,14 @@ namespace osu.Game.Overlays.Volume
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnScroll(InputState state)
|
||||||
|
{
|
||||||
|
double amount = adjust_step * state.Mouse.ScrollDelta.Y * (state.Mouse.HasPreciseScroll ? 0.5f : 1);
|
||||||
|
|
||||||
|
Volume += Math.Sign(amount) * Math.Max(0.01, Math.Abs(amount));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public bool OnReleased(GlobalAction action) => false;
|
||||||
|
|
||||||
private const float transition_length = 500;
|
private const float transition_length = 500;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user