mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Don't skip beats when scrolling in the direction of the closest beat
This commit is contained in:
@ -148,10 +148,16 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
double beatLength = timingPoint.BeatLength / beat_snap_divisor;
|
double beatLength = timingPoint.BeatLength / beat_snap_divisor;
|
||||||
int direction = state.Mouse.WheelDelta > 0 ? 1 : -1;
|
int direction = state.Mouse.WheelDelta > 0 ? 1 : -1;
|
||||||
|
|
||||||
double unsnappedTime = adjustableClock.CurrentTime + beatLength * direction;
|
// The direction is added to prevent rounding issues by enforcing that abs(unsnappedTime - currentTime) > beatLength
|
||||||
|
double unsnappedTime = adjustableClock.CurrentTime + beatLength * direction + direction;
|
||||||
|
|
||||||
// Unsnapped time may be between two beats, so we need to snap it to the closest beat
|
// Unsnapped time may be between two beats, so we need to snap it to the closest beat
|
||||||
int closestBeat = (int)Math.Round(unsnappedTime / beatLength);
|
int closestBeat;
|
||||||
|
if (direction > 0)
|
||||||
|
closestBeat = (int)Math.Floor(unsnappedTime / beatLength);
|
||||||
|
else
|
||||||
|
closestBeat = (int)Math.Ceiling(unsnappedTime / beatLength);
|
||||||
|
|
||||||
double snappedTime = closestBeat * beatLength;
|
double snappedTime = closestBeat * beatLength;
|
||||||
|
|
||||||
adjustableClock.Seek(snappedTime);
|
adjustableClock.Seek(snappedTime);
|
||||||
|
Reference in New Issue
Block a user