1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 15:12:54 +08:00

Merge pull request #29211 from peppy/always-show-control-points-timing

Always show timing points in timeline when at the timing screen
This commit is contained in:
Bartłomiej Dach 2024-07-31 16:46:55 +02:00 committed by GitHub
commit cd28fa7325
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 54 additions and 26 deletions

View File

@ -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;
@ -30,11 +28,26 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly Drawable userContent;
[Resolved]
private EditorClock editorClock { get; set; }
private bool alwaysShowControlPoints;
public bool AlwaysShowControlPoints
{
get => alwaysShowControlPoints;
set
{
if (value == alwaysShowControlPoints)
return;
alwaysShowControlPoints = value;
controlPointsVisible.TriggerChange();
}
}
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
private EditorClock editorClock { get; set; } = null!;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; } = null!;
/// <summary>
/// The timeline's scroll position in the last frame.
@ -61,6 +74,22 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
/// </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;
@ -73,22 +102,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
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)
{
@ -178,7 +191,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
controlPointsVisible.BindValueChanged(visible =>
{
if (visible.NewValue)
if (visible.NewValue || alwaysShowControlPoints)
{
this.ResizeHeightTo(timeline_expanded_height, 200, Easing.OutQuint);
mainContent.MoveToY(15, 200, Easing.OutQuint);
@ -318,7 +331,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; }
private IBeatSnapProvider beatSnapProvider { get; set; } = null!;
/// <summary>
/// The total amount of time visible on the timeline.

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
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
@ -26,7 +25,7 @@ namespace osu.Game.Screens.Edit
}
[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.
@ -107,10 +106,18 @@ namespace osu.Game.Screens.Edit
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();

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
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
{
@ -53,5 +54,12 @@ namespace osu.Game.Screens.Edit.Timing
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
}
}
protected override void ConfigureTimeline(TimelineArea timelineArea)
{
base.ConfigureTimeline(timelineArea);
timelineArea.Timeline.AlwaysShowControlPoints = true;
}
}
}