mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 17:17:24 +08:00
Rename to seekAmount
This commit is contained in:
parent
6c148930b5
commit
e580819621
@ -145,20 +145,20 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
var timingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(adjustableClock.CurrentTime);
|
var timingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(adjustableClock.CurrentTime);
|
||||||
|
|
||||||
const int beat_snap_divisor = 4; // Todo: This should not be a constant
|
const int beat_snap_divisor = 4; // Todo: This should not be a constant
|
||||||
double beatLength = timingPoint.BeatLength / beat_snap_divisor;
|
double seekAmount = timingPoint.BeatLength / beat_snap_divisor;
|
||||||
int direction = state.Mouse.WheelDelta > 0 ? 1 : -1;
|
int direction = state.Mouse.WheelDelta > 0 ? 1 : -1;
|
||||||
|
|
||||||
// The direction is added to prevent rounding issues by enforcing that abs(unsnappedTime - currentTime) > beatLength
|
// The direction is added to prevent rounding issues by enforcing that abs(unsnappedTime - currentTime) > beatLength
|
||||||
double unsnappedTime = adjustableClock.CurrentTime + beatLength * direction + direction;
|
double unsnappedTime = adjustableClock.CurrentTime + seekAmount * 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 closestBeat;
|
||||||
if (direction > 0)
|
if (direction > 0)
|
||||||
closestBeat = (int)Math.Floor(unsnappedTime / beatLength);
|
closestBeat = (int)Math.Floor(unsnappedTime / seekAmount);
|
||||||
else
|
else
|
||||||
closestBeat = (int)Math.Ceiling(unsnappedTime / beatLength);
|
closestBeat = (int)Math.Ceiling(unsnappedTime / seekAmount);
|
||||||
|
|
||||||
double snappedTime = closestBeat * beatLength;
|
double snappedTime = closestBeat * seekAmount;
|
||||||
|
|
||||||
adjustableClock.Seek(snappedTime);
|
adjustableClock.Seek(snappedTime);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user