Skip to content

Commit

Permalink
Merge pull request #29211 from peppy/always-show-control-points-timing
Browse files Browse the repository at this point in the history
Always show timing points in timeline when at the timing screen
  • Loading branch information
bdach authored Jul 31, 2024
2 parents c180e2e + 2d52bab commit cd28fa7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 25 deletions.
57 changes: 35 additions & 22 deletions osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using System;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
Expand Down Expand Up @@ -30,11 +28,26 @@ public partial class Timeline : ZoomableScrollContainer, IPositionSnapProvider

private readonly Drawable userContent;

private bool alwaysShowControlPoints;

public bool AlwaysShowControlPoints
{
get => alwaysShowControlPoints;
set
{
if (value == alwaysShowControlPoints)
return;

alwaysShowControlPoints = value;
controlPointsVisible.TriggerChange();
}
}

[Resolved]
private EditorClock editorClock { get; set; }
private EditorClock editorClock { get; set; } = null!;

[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
private EditorBeatmap editorBeatmap { get; set; } = null!;

/// <summary>
/// The timeline's scroll position in the last frame.
Expand All @@ -61,6 +74,22 @@ public partial class Timeline : ZoomableScrollContainer, IPositionSnapProvider
/// </summary>
private float defaultTimelineZoom;

private WaveformGraph waveform = null!;

private TimelineTickDisplay ticks = null!;

private TimelineControlPointDisplay controlPoints = null!;

private Container mainContent = null!;

private Bindable<float> waveformOpacity = null!;
private Bindable<bool> controlPointsVisible = null!;
private Bindable<bool> ticksVisible = null!;

private double trackLengthForZoom;

private readonly IBindable<Track> track = new Bindable<Track>();

public Timeline(Drawable userContent)
{
this.userContent = userContent;
Expand All @@ -73,22 +102,6 @@ public Timeline(Drawable userContent)
ScrollbarVisible = false;
}

private WaveformGraph waveform;

private TimelineTickDisplay ticks;

private TimelineControlPointDisplay controlPoints;

private Container mainContent;

private Bindable<float> waveformOpacity;
private Bindable<bool> controlPointsVisible;
private Bindable<bool> ticksVisible;

private double trackLengthForZoom;

private readonly IBindable<Track> track = new Bindable<Track>();

[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OsuConfigManager config)
{
Expand Down Expand Up @@ -178,7 +191,7 @@ protected override void LoadComplete()

controlPointsVisible.BindValueChanged(visible =>
{
if (visible.NewValue)
if (visible.NewValue || alwaysShowControlPoints)
{
this.ResizeHeightTo(timeline_expanded_height, 200, Easing.OutQuint);
mainContent.MoveToY(15, 200, Easing.OutQuint);
Expand Down Expand Up @@ -318,7 +331,7 @@ private void endUserDrag()
}

[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; }
private IBeatSnapProvider beatSnapProvider { get; set; } = null!;

/// <summary>
/// The total amount of time visible on the timeline.
Expand Down
13 changes: 10 additions & 3 deletions osu.Game/Screens/Edit/EditorScreenWithTimeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Compose.Components.Timeline;

namespace osu.Game.Screens.Edit
Expand All @@ -26,7 +25,7 @@ protected EditorScreenWithTimeline(EditorScreenMode type)
}

[BackgroundDependencyLoader(true)]
private void load(OverlayColourProvider colourProvider)
private void load()
{
// Grid with only two rows.
// First is the timeline area, which should be allowed to expand as required.
Expand Down Expand Up @@ -107,10 +106,18 @@ protected override void LoadComplete()
MainContent.Add(content);
content.FadeInFromZero(300, Easing.OutQuint);
LoadComponentAsync(TimelineArea = new TimelineArea(CreateTimelineContent()), timelineContent.Add);
LoadComponentAsync(TimelineArea = new TimelineArea(CreateTimelineContent()), timeline =>
{
ConfigureTimeline(timeline);
timelineContent.Add(timeline);
});
});
}

protected virtual void ConfigureTimeline(TimelineArea timelineArea)
{
}

protected abstract Drawable CreateMainContent();

protected virtual Drawable CreateTimelineContent() => new Container();
Expand Down
8 changes: 8 additions & 0 deletions osu.Game/Screens/Edit/Timing/TimingScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Screens.Edit.Compose.Components.Timeline;

namespace osu.Game.Screens.Edit.Timing
{
Expand Down Expand Up @@ -53,5 +54,12 @@ protected override void LoadComplete()
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
}
}

protected override void ConfigureTimeline(TimelineArea timelineArea)
{
base.ConfigureTimeline(timelineArea);

timelineArea.Timeline.AlwaysShowControlPoints = true;
}
}
}

0 comments on commit cd28fa7

Please sign in to comment.