Skip to content

Commit

Permalink
Remove expanding behaviour of timeline completely
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Aug 21, 2024
1 parent 7e64901 commit c4b875e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 64 deletions.
50 changes: 3 additions & 47 deletions osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public partial class Timeline : ZoomableScrollContainer, IPositionSnapProvider
{
private const float timeline_height = 80;
private const float timeline_expanded_height = 80;

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!;

Expand Down Expand Up @@ -80,12 +64,7 @@ public bool AlwaysShowControlPoints

private TimelineTickDisplay ticks = null!;

private TimelineTimingChangeDisplay controlPoints = null!;

private Container mainContent = null!;

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

private double trackLengthForZoom;
Expand All @@ -112,18 +91,16 @@ private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OverlayC
// We don't want the centre marker to scroll
AddInternal(centreMarker = new CentreMarker());

ticks = new TimelineTickDisplay();

AddRange(new Drawable[]
{
ticks,
controlPoints = new TimelineTimingChangeDisplay
ticks = new TimelineTickDisplay(),
new TimelineTimingChangeDisplay
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
mainContent = new Container
new Container
{
RelativeSizeAxes = Axes.X,
Height = timeline_height,
Expand Down Expand Up @@ -153,7 +130,6 @@ private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OverlayC
});

waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
controlPointsVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);

track.BindTo(editorClock.Track);
Expand Down Expand Up @@ -187,26 +163,6 @@ protected override void LoadComplete()
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), 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() =>
Expand Down
10 changes: 1 addition & 9 deletions osu.Game/Screens/Edit/EditorScreenWithTimeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,10 @@ protected override void LoadComplete()
MainContent.Add(content);
content.FadeInFromZero(300, Easing.OutQuint);

LoadComponentAsync(TimelineArea = new TimelineArea(CreateTimelineContent()), timeline =>
{
ConfigureTimeline(timeline);
timelineContent.Add(timeline);
});
LoadComponentAsync(TimelineArea = new TimelineArea(CreateTimelineContent()), timelineContent.Add);
});
}

protected virtual void ConfigureTimeline(TimelineArea timelineArea)
{
}

protected abstract Drawable CreateMainContent();

protected virtual Drawable CreateTimelineContent() => new Container();
Expand Down
8 changes: 0 additions & 8 deletions osu.Game/Screens/Edit/Timing/TimingScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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 @@ -54,12 +53,5 @@ 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 c4b875e

Please sign in to comment.