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

Merge pull request #29766 from SchiavoAnto/29761-fix-blocked-info

Fix timing points being blocked by buttons in the editor
This commit is contained in:
Bartłomiej Dach 2024-09-08 18:37:59 +02:00 committed by GitHub
commit f0e2b803de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 64 additions and 39 deletions

View File

@ -7,17 +7,21 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
public partial class ControlPointList : CompositeDrawable
{
private ControlPointTable table = null!;
private Container controls = null!;
private OsuButton deleteButton = null!;
private RoundedButton addButton = null!;
@ -31,26 +35,38 @@ namespace osu.Game.Screens.Edit.Timing
private Bindable<ControlPointGroup?> selectedGroup { get; set; } = null!;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
RelativeSizeAxes = Axes.Both;
const float margins = 10;
InternalChildren = new Drawable[]
{
new ControlPointTable
table = new ControlPointTable
{
RelativeSizeAxes = Axes.Both,
Groups = { BindTarget = Beatmap.ControlPointInfo.Groups, },
},
controls = new Container
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(margins),
Spacing = new Vector2(5),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Padding = new MarginPadding { Left = margins, Vertical = margins, },
Children = new Drawable[]
{
new RoundedButton
@ -58,19 +74,19 @@ namespace osu.Game.Screens.Edit.Timing
Text = "Select closest to current time",
Action = goToCurrentGroup,
Size = new Vector2(220, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
}
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(margins),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Spacing = new Vector2(5),
Padding = new MarginPadding { Right = margins, Vertical = margins, },
Children = new Drawable[]
{
deleteButton = new RoundedButton
@ -78,16 +94,18 @@ namespace osu.Game.Screens.Edit.Timing
Text = "-",
Size = new Vector2(30, 30),
Action = delete,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
BackgroundColour = colours.Red3,
},
addButton = new RoundedButton
{
Action = addNew,
Size = new Vector2(160, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
}
},
}
},
@ -119,6 +137,7 @@ namespace osu.Game.Screens.Edit.Timing
base.Update();
addButton.Enabled.Value = clock.CurrentTimeAccurate != selectedGroup.Value?.Time;
table.Padding = new MarginPadding { Bottom = controls.DrawHeight };
}
private void goToCurrentGroup()

View File

@ -28,6 +28,12 @@ namespace osu.Game.Screens.Edit.Timing
{
public BindableList<ControlPointGroup> Groups { get; } = new BindableList<ControlPointGroup>();
public new MarginPadding Padding
{
get => base.Padding;
set => base.Padding = value;
}
[Cached]
private Bindable<TimingControlPoint?> activeTimingPoint { get; } = new Bindable<TimingControlPoint?>();