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

View File

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