Fix header potentially overflowing the dialog

This commit is contained in:
smoogipoo
2018-11-23 15:18:40 +09:00
parent 376e76e00d
commit ac73844fe0

View File

@ -7,12 +7,10 @@ using osu.Framework.Extensions.Color4Extensions;
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.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -35,7 +33,7 @@ namespace osu.Game.Overlays.Dialog
private readonly Container ring; private readonly Container ring;
private readonly FillFlowContainer<PopupDialogButton> buttonsContainer; private readonly FillFlowContainer<PopupDialogButton> buttonsContainer;
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
private readonly SpriteText header; private readonly TextFlowContainer header;
private readonly TextFlowContainer body; private readonly TextFlowContainer body;
private bool actionInvoked; private bool actionInvoked;
@ -46,10 +44,19 @@ namespace osu.Game.Overlays.Dialog
set => icon.Icon = value; set => icon.Icon = value;
} }
private string text;
public string HeaderText public string HeaderText
{ {
get => header.Text; get => text;
set => header.Text = value; set
{
if (text == value)
return;
text = value;
header.Text = value;
}
} }
public string BodyText public string BodyText
@ -164,18 +171,20 @@ namespace osu.Game.Overlays.Dialog
}, },
}, },
}, },
header = new OsuSpriteText header = new OsuTextFlowContainer(t => t.TextSize = 25)
{ {
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
TextSize = 25, RelativeSizeAxes = Axes.X,
Shadow = true, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre,
}, },
body = new OsuTextFlowContainer(t => t.TextSize = 18) body = new OsuTextFlowContainer(t => t.TextSize = 18)
{ {
Padding = new MarginPadding(15),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre, TextAnchor = Anchor.TopCentre,
}, },
}, },