Skip to content

Commit

Permalink
Merge pull request #29766 from SchiavoAnto/29761-fix-blocked-info
Browse files Browse the repository at this point in the history
Fix timing points being blocked by buttons in the editor
  • Loading branch information
bdach authored Sep 8, 2024
2 parents e836062 + 7ec2e0e commit f0e2b80
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 39 deletions.
97 changes: 58 additions & 39 deletions osu.Game/Screens/Edit/Timing/ControlPointList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
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!;

Expand All @@ -31,63 +35,77 @@ public partial class ControlPointList : CompositeDrawable
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,
},
}
},
}
},
Expand Down Expand Up @@ -119,6 +137,7 @@ protected override void Update()
base.Update();

addButton.Enabled.Value = clock.CurrentTimeAccurate != selectedGroup.Value?.Time;
table.Padding = new MarginPadding { Bottom = controls.DrawHeight };
}

private void goToCurrentGroup()
Expand Down
6 changes: 6 additions & 0 deletions osu.Game/Screens/Edit/Timing/ControlPointTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public partial class ControlPointTable : CompositeDrawable
{
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?>();

Expand Down

0 comments on commit f0e2b80

Please sign in to comment.