Remove expanding behaviour of timeline completely

This commit is contained in:
Dean Herbert 2024-08-21 15:57:52 +09:00
parent 7e6490133d
commit fef56cc29e
No known key found for this signature in database
3 changed files with 4 additions and 65 deletions

View File

@ -16,7 +16,6 @@ using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
using osuTK; using osuTK;
using osuTK.Input; using osuTK.Input;
@ -26,25 +25,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public partial class Timeline : ZoomableScrollContainer, IPositionSnapProvider public partial class Timeline : ZoomableScrollContainer, IPositionSnapProvider
{ {
private const float timeline_height = 80; private const float timeline_height = 80;
private const float timeline_expanded_height = 80;
private readonly Drawable userContent; private readonly Drawable userContent;
private bool alwaysShowControlPoints;
public bool AlwaysShowControlPoints
{
get => alwaysShowControlPoints;
set
{
if (value == alwaysShowControlPoints)
return;
alwaysShowControlPoints = value;
controlPointsVisible.TriggerChange();
}
}
[Resolved] [Resolved]
private EditorClock editorClock { get; set; } = null!; private EditorClock editorClock { get; set; } = null!;
@ -80,12 +63,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private TimelineTickDisplay ticks = null!; private TimelineTickDisplay ticks = null!;
private TimelineTimingChangeDisplay controlPoints = null!;
private Container mainContent = null!;
private Bindable<float> waveformOpacity = null!; private Bindable<float> waveformOpacity = null!;
private Bindable<bool> controlPointsVisible = null!;
private Bindable<bool> ticksVisible = null!; private Bindable<bool> ticksVisible = null!;
private double trackLengthForZoom; private double trackLengthForZoom;
@ -112,18 +90,16 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// We don't want the centre marker to scroll // We don't want the centre marker to scroll
AddInternal(centreMarker = new CentreMarker()); AddInternal(centreMarker = new CentreMarker());
ticks = new TimelineTickDisplay();
AddRange(new Drawable[] AddRange(new Drawable[]
{ {
ticks, ticks = new TimelineTickDisplay(),
controlPoints = new TimelineTimingChangeDisplay new TimelineTimingChangeDisplay
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
}, },
mainContent = new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = timeline_height, Height = timeline_height,
@ -153,7 +129,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}); });
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity); waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
controlPointsVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks); ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
track.BindTo(editorClock.Track); track.BindTo(editorClock.Track);
@ -187,26 +162,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true); waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
ticksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true); ticksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
controlPointsVisible.BindValueChanged(visible =>
{
if (visible.NewValue || alwaysShowControlPoints)
{
this.ResizeHeightTo(timeline_expanded_height, 200, Easing.OutQuint);
mainContent.MoveToY(0, 200, Easing.OutQuint);
// delay the fade in else masking looks weird.
controlPoints.Delay(180).FadeIn(400, Easing.OutQuint);
}
else
{
controlPoints.FadeOut(200, Easing.OutQuint);
// likewise, delay the resize until the fade is complete.
this.Delay(180).ResizeHeightTo(timeline_height, 200, Easing.OutQuint);
mainContent.Delay(180).MoveToY(0, 200, Easing.OutQuint);
}
}, true);
} }
private void updateWaveformOpacity() => private void updateWaveformOpacity() =>

View File

@ -106,18 +106,10 @@ namespace osu.Game.Screens.Edit
MainContent.Add(content); MainContent.Add(content);
content.FadeInFromZero(300, Easing.OutQuint); content.FadeInFromZero(300, Easing.OutQuint);
LoadComponentAsync(TimelineArea = new TimelineArea(CreateTimelineContent()), timeline => LoadComponentAsync(TimelineArea = new TimelineArea(CreateTimelineContent()), timelineContent.Add);
{
ConfigureTimeline(timeline);
timelineContent.Add(timeline);
});
}); });
} }
protected virtual void ConfigureTimeline(TimelineArea timelineArea)
{
}
protected abstract Drawable CreateMainContent(); protected abstract Drawable CreateMainContent();
protected virtual Drawable CreateTimelineContent() => new Container(); protected virtual Drawable CreateTimelineContent() => new Container();

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Screens.Edit.Timing namespace osu.Game.Screens.Edit.Timing
{ {
@ -54,12 +53,5 @@ namespace osu.Game.Screens.Edit.Timing
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time); SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
} }
} }
protected override void ConfigureTimeline(TimelineArea timelineArea)
{
base.ConfigureTimeline(timelineArea);
timelineArea.Timeline.AlwaysShowControlPoints = true;
}
} }
} }