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

Ensure timeline ticks aren't hidden by other pieces

Addresses https://github.com/ppy/osu/issues/28667.
This commit is contained in:
Bartłomiej Dach 2024-07-08 12:33:00 +02:00
parent c100d1ab65
commit 50818da166
No known key found for this signature in database
3 changed files with 33 additions and 8 deletions

View File

@ -150,7 +150,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
new TextFlowContainer(s => s.Font = s.Font.With(size: 14))
{
Padding = new MarginPadding { Horizontal = 15, Vertical = 8 },
Padding = new MarginPadding { Horizontal = 15, Vertical = 2 },
Text = "beat snap",
RelativeSizeAxes = Axes.X,
TextAnchor = Anchor.TopCentre,
@ -159,7 +159,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 30),
new Dimension(GridSizeMode.Absolute, 40),
new Dimension(GridSizeMode.Absolute, 20),
new Dimension(GridSizeMode.Absolute, 15)
}
@ -526,7 +526,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
AlwaysDisplayed = alwaysDisplayed;
Divisor = divisor;
Size = new Vector2(6f, 12) * BindableBeatDivisor.GetSize(divisor);
Size = new Vector2(6f, 18) * BindableBeatDivisor.GetSize(divisor);
Alpha = alwaysDisplayed ? 1 : 0;
InternalChild = new Box { RelativeSizeAxes = Axes.Both };

View File

@ -25,7 +25,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[Cached]
public partial class Timeline : ZoomableScrollContainer, IPositionSnapProvider
{
private const float timeline_height = 72;
private const float timeline_height = 80;
private const float timeline_expanded_height = 94;
private readonly Drawable userContent;
@ -97,6 +97,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// We don't want the centre marker to scroll
AddInternal(centreMarker = new CentreMarker());
ticks = new TimelineTickDisplay
{
Padding = new MarginPadding { Vertical = 2, },
};
AddRange(new Drawable[]
{
controlPoints = new TimelineControlPointDisplay
@ -104,6 +109,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.X,
Height = timeline_expanded_height,
},
ticks,
mainContent = new Container
{
RelativeSizeAxes = Axes.X,
@ -120,7 +126,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
HighColour = colours.BlueDarker,
},
centreMarker.CreateProxy(),
ticks = new TimelineTickDisplay(),
ticks.CreateProxy(),
new Box
{
Name = "zero marker",
@ -175,7 +181,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
if (visible.NewValue)
{
this.ResizeHeightTo(timeline_expanded_height, 200, Easing.OutQuint);
mainContent.MoveToY(20, 200, Easing.OutQuint);
mainContent.MoveToY(15, 200, Easing.OutQuint);
// delay the fade in else masking looks weird.
controlPoints.Delay(180).FadeIn(400, Easing.OutQuint);

View File

@ -9,6 +9,7 @@ using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
@ -41,16 +42,21 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
RelativeSizeAxes = Axes.Both;
}
private readonly BindableBool showTimingChanges = new BindableBool(true);
private readonly Cached tickCache = new Cached();
[BackgroundDependencyLoader]
private void load()
private void load(OsuConfigManager configManager)
{
beatDivisor.BindValueChanged(_ => invalidateTicks());
if (changeHandler != null)
// currently this is the best way to handle any kind of timing changes.
changeHandler.OnStateChange += invalidateTicks;
configManager.BindWith(OsuSetting.EditorTimelineShowTimingChanges, showTimingChanges);
showTimingChanges.BindValueChanged(_ => invalidateTicks());
}
private void invalidateTicks()
@ -142,7 +148,20 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
var line = getNextUsableLine();
line.X = xPos;
line.Width = PointVisualisation.MAX_WIDTH * size.X;
line.Height = 0.9f * size.Y;
if (showTimingChanges.Value)
{
line.Anchor = Anchor.BottomLeft;
line.Origin = Anchor.BottomCentre;
line.Height = 0.7f + size.Y * 0.28f;
}
else
{
line.Anchor = Anchor.CentreLeft;
line.Origin = Anchor.Centre;
line.Height = 0.92f + size.Y * 0.07f;
}
line.Colour = colour;
}