mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Switch timeline to use track directly from beatmap again
This commit is contained in:
@ -30,6 +30,28 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private MusicController musicController { get; set; }
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The timeline's scroll position in the last frame.
|
||||||
|
/// </summary>
|
||||||
|
private float lastScrollPosition;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The track time in the last frame.
|
||||||
|
/// </summary>
|
||||||
|
private double lastTrackTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the user is currently dragging the timeline.
|
||||||
|
/// </summary>
|
||||||
|
private bool handlingDragInput;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the track was playing before a user drag event.
|
||||||
|
/// </summary>
|
||||||
|
private bool trackWasPlaying;
|
||||||
|
|
||||||
|
private ITrack track;
|
||||||
|
|
||||||
public Timeline()
|
public Timeline()
|
||||||
{
|
{
|
||||||
ZoomDuration = 200;
|
ZoomDuration = 200;
|
||||||
@ -61,9 +83,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Beatmap.BindValueChanged(b =>
|
Beatmap.BindValueChanged(b =>
|
||||||
{
|
{
|
||||||
waveform.Waveform = b.NewValue.Waveform;
|
waveform.Waveform = b.NewValue.Waveform;
|
||||||
track = musicController.CurrentTrack;
|
track = b.NewValue.Track;
|
||||||
|
|
||||||
if (track.Length > 0)
|
// todo: i don't think this is safe, the track may not be loaded yet.
|
||||||
|
if (b.NewValue.Track.Length > 0)
|
||||||
{
|
{
|
||||||
MaxZoom = getZoomLevelForVisibleMilliseconds(500);
|
MaxZoom = getZoomLevelForVisibleMilliseconds(500);
|
||||||
MinZoom = getZoomLevelForVisibleMilliseconds(10000);
|
MinZoom = getZoomLevelForVisibleMilliseconds(10000);
|
||||||
@ -74,28 +97,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => (float)(track.Length / milliseconds);
|
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => (float)(track.Length / milliseconds);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The timeline's scroll position in the last frame.
|
|
||||||
/// </summary>
|
|
||||||
private float lastScrollPosition;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The track time in the last frame.
|
|
||||||
/// </summary>
|
|
||||||
private double lastTrackTime;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the user is currently dragging the timeline.
|
|
||||||
/// </summary>
|
|
||||||
private bool handlingDragInput;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the track was playing before a user drag event.
|
|
||||||
/// </summary>
|
|
||||||
private bool trackWasPlaying;
|
|
||||||
|
|
||||||
private ITrack track;
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
Reference in New Issue
Block a user