1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 14:47:25 +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,63 +35,77 @@ 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, },
},
new FillFlowContainer
controls = new Container
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(margins),
Spacing = new Vector2(5),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Children = new Drawable[]
{
new RoundedButton
new Box
{
Text = "Select closest to current time",
Action = goToCurrentGroup,
Size = new Vector2(220, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
},
}
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding(margins),
Spacing = new Vector2(5),
Children = new Drawable[]
{
deleteButton = new RoundedButton
new FillFlowContainer
{
Text = "-",
Size = new Vector2(30, 30),
Action = delete,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
BackgroundColour = colours.Red3,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Padding = new MarginPadding { Left = margins, Vertical = margins, },
Children = new Drawable[]
{
new RoundedButton
{
Text = "Select closest to current time",
Action = goToCurrentGroup,
Size = new Vector2(220, 30),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
}
},
addButton = new RoundedButton
new FillFlowContainer
{
Action = addNew,
Size = new Vector2(160, 30),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Spacing = new Vector2(5),
Padding = new MarginPadding { Right = margins, Vertical = margins, },
Children = new Drawable[]
{
deleteButton = new RoundedButton
{
Text = "-",
Size = new Vector2(30, 30),
Action = delete,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
BackgroundColour = colours.Red3,
},
addButton = new RoundedButton
{
Action = addNew,
Size = new Vector2(160, 30),
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?>();