Move some sizes as consts.

This commit is contained in:
Huo Yaoyuan 2017-06-15 16:57:34 +08:00
parent 1e0653eff9
commit 74f503874f
1 changed files with 8 additions and 6 deletions

View File

@ -26,12 +26,14 @@ public class RankChart : Container
private int[] ranks, performances;
private int rank, performance, countryRank;
private const float primary_textsize = 25, secondary_textsize = 13, padding = 10;
private readonly User user;
public RankChart(User user)
{
this.user = user;
Padding = new MarginPadding { Vertical = 10 };
Padding = new MarginPadding { Vertical = padding };
Children = new Drawable[]
{
rankText = new OsuSpriteText
@ -39,7 +41,7 @@ public RankChart(User user)
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Font = @"Exo2.0-RegularItalic",
TextSize = 25
TextSize = primary_textsize
},
relativeText = new OsuSpriteText
{
@ -47,21 +49,21 @@ public RankChart(User user)
Origin = Anchor.TopCentre,
Font = @"Exo2.0-RegularItalic",
Y = 25,
TextSize = 13
TextSize = secondary_textsize
},
performanceText = new OsuSpriteText
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Font = @"Exo2.0-RegularItalic",
TextSize = 13
TextSize = secondary_textsize
},
graph = new RankChartLineGraph
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Y = -13,
Y = -secondary_textsize,
DefaultValueCount = 90,
BallRelease = updateRankTexts,
BallMove = showHistoryRankTexts
@ -108,7 +110,7 @@ public override bool Invalidate(Invalidation invalidation = Invalidation.All, Dr
{
if ((invalidation & Invalidation.DrawSize) != 0)
{
graph.Height = DrawHeight - 71;
graph.Height = DrawHeight - padding * 2 - primary_textsize - secondary_textsize * 2;
}
return base.Invalidate(invalidation, source, shallPropagate);