mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Prevent user from scrolling outside the timeline in the editor
This commit is contained in:
parent
420e50b6da
commit
dd9b9a18ac
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
// TODO: should probably be done at a RulesetContainer level to share logic with Player.
|
// TODO: should probably be done at a RulesetContainer level to share logic with Player.
|
||||||
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||||
clock = new EditorClock(Beatmap.Value.Beatmap.ControlPointInfo, beatDivisor) { IsCoupled = false };
|
clock = new EditorClock(Beatmap, beatDivisor) { IsCoupled = false };
|
||||||
clock.ChangeSource(sourceClock);
|
clock.ChangeSource(sourceClock);
|
||||||
|
|
||||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
|
|
||||||
@ -15,10 +17,20 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EditorClock : DecoupleableInterpolatingFramedClock
|
public class EditorClock : DecoupleableInterpolatingFramedClock
|
||||||
{
|
{
|
||||||
|
public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public ControlPointInfo ControlPointInfo;
|
public ControlPointInfo ControlPointInfo;
|
||||||
|
|
||||||
private readonly BindableBeatDivisor beatDivisor;
|
private readonly BindableBeatDivisor beatDivisor;
|
||||||
|
|
||||||
|
public EditorClock(Bindable<WorkingBeatmap> beatmap, BindableBeatDivisor beatDivisor)
|
||||||
|
{
|
||||||
|
this.beatDivisor = beatDivisor;
|
||||||
|
|
||||||
|
Beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
|
ControlPointInfo = Beatmap.Value.Beatmap.ControlPointInfo;
|
||||||
|
}
|
||||||
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
|
public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor)
|
||||||
{
|
{
|
||||||
this.beatDivisor = beatDivisor;
|
this.beatDivisor = beatDivisor;
|
||||||
@ -111,6 +123,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
if (seekTime > nextTimingPoint?.Time)
|
if (seekTime > nextTimingPoint?.Time)
|
||||||
seekTime = nextTimingPoint.Time;
|
seekTime = nextTimingPoint.Time;
|
||||||
|
|
||||||
|
seekTime = Math.Min(Math.Max(0, seekTime), Beatmap.Value.Track.Length); // Ensure the sought point is within the song's length
|
||||||
Seek(seekTime);
|
Seek(seekTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user