1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 08:22:56 +08:00

Fix some margin/padding issues

This commit is contained in:
Andrei Zavatski 2019-10-22 01:45:04 +03:00
parent a3ab6d33c1
commit bb7af1e39c
2 changed files with 40 additions and 34 deletions

View File

@ -129,7 +129,8 @@ namespace osu.Game.Online.Chat
Colour = Color4.White, Colour = Color4.White,
TextSize = 14, TextSize = 14,
LineHeight = 1, LineHeight = 1,
Margin = new MarginPadding { Horizontal = 10 } Padding = new MarginPadding { Horizontal = 10 },
Margin = new MarginPadding { Vertical = 5 },
}; };
public StandAloneDrawableChannel(Channel channel) public StandAloneDrawableChannel(Channel channel)

View File

@ -84,7 +84,8 @@ namespace osu.Game.Overlays.Chat
protected virtual DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time) protected virtual DaySeparator CreateDaySeparator(DateTimeOffset time) => new DaySeparator(time)
{ {
Colour = colours.ChatBlue.Lighten(0.7f) Margin = new MarginPadding { Vertical = 10 },
Colour = colours.ChatBlue.Lighten(0.7f),
}; };
private void newMessagesArrived(IEnumerable<Message> newMessages) private void newMessagesArrived(IEnumerable<Message> newMessages)
@ -158,7 +159,7 @@ namespace osu.Game.Overlays.Chat
} }
} }
protected class DaySeparator : GridContainer protected class DaySeparator : Container
{ {
public float TextSize public float TextSize
{ {
@ -180,42 +181,46 @@ namespace osu.Game.Overlays.Chat
public DaySeparator(DateTimeOffset time) public DaySeparator(DateTimeOffset time)
{ {
Margin = new MarginPadding { Vertical = 10 };
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
ColumnDimensions = new[] Child = new GridContainer
{ {
new Dimension(), RelativeSizeAxes = Axes.X,
new Dimension(GridSizeMode.AutoSize), AutoSizeAxes = Axes.Y,
new Dimension(), ColumnDimensions = new[]
};
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
};
Content = new[]
{
new Drawable[]
{ {
leftBox = new Box new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{ {
Anchor = Anchor.Centre, leftBox = new Box
Origin = Anchor.Centre, {
RelativeSizeAxes = Axes.X, Anchor = Anchor.Centre,
Height = lineHeight, Origin = Anchor.Centre,
}, RelativeSizeAxes = Axes.X,
text = new SpriteText Height = lineHeight,
{ },
Margin = new MarginPadding { Horizontal = 10 }, text = new SpriteText
Text = time.ToLocalTime().ToString("dd MMM yyyy"), {
}, Margin = new MarginPadding { Horizontal = 10 },
rightBox = new Box Text = time.ToLocalTime().ToString("dd MMM yyyy"),
{ },
Anchor = Anchor.Centre, rightBox = new Box
Origin = Anchor.Centre, {
RelativeSizeAxes = Axes.X, Anchor = Anchor.Centre,
Height = lineHeight, Origin = Anchor.Centre,
}, RelativeSizeAxes = Axes.X,
Height = lineHeight,
},
}
} }
}; };
} }