1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Add back incorrectly removed control point display toggle

This commit is contained in:
Dean Herbert 2024-08-22 01:05:47 +09:00
parent fef56cc29e
commit 843b10ef34
No known key found for this signature in database
3 changed files with 45 additions and 2 deletions

View File

@ -28,6 +28,21 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
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; } = null!;
@ -63,7 +78,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private TimelineTickDisplay ticks = null!;
private TimelineTimingChangeDisplay controlPoints = null!;
private Bindable<float> waveformOpacity = null!;
private Bindable<bool> controlPointsVisible = null!;
private Bindable<bool> ticksVisible = null!;
private double trackLengthForZoom;
@ -93,7 +111,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
AddRange(new Drawable[]
{
ticks = new TimelineTickDisplay(),
new TimelineTimingChangeDisplay
controlPoints = new TimelineTimingChangeDisplay
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
@ -129,6 +147,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
});
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
controlPointsVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
track.BindTo(editorClock.Track);
@ -162,6 +181,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
ticksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
controlPointsVisible.BindValueChanged(visible =>
{
if (visible.NewValue || alwaysShowControlPoints)
controlPoints.FadeIn(400, Easing.OutQuint);
else
controlPoints.FadeOut(200, Easing.OutQuint);
}, true);
}
private void updateWaveformOpacity() =>

View File

@ -106,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;
}
}
}