Fix bottom square being clipped

This commit is contained in:
DrabWeb 2017-03-23 08:13:03 -03:00
parent 938f5eaf58
commit bbca6cf602
3 changed files with 21 additions and 17 deletions

View File

@ -39,7 +39,7 @@ namespace osu.Desktop.VisualTests.Tests
List<int> newValues = new List<int>(); List<int> newValues = new List<int>();
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {
newValues.Add(RNG.Next(0, 11)); newValues.Add(RNG.Next(0, 6));
} }
progress.Values = newValues.ToArray(); progress.Values = newValues.ToArray();

View File

@ -14,7 +14,6 @@ namespace osu.Game.Screens.Play
public class SongProgress : OverlayContainer public class SongProgress : OverlayContainer
{ {
private const int bar_height = 5; private const int bar_height = 5;
private const int graph_height = 34;
private readonly Vector2 handleSize = new Vector2(14, 25); private readonly Vector2 handleSize = new Vector2(14, 25);
private readonly Color4 fillColour = new Color4(221, 255, 255, 255); private readonly Color4 fillColour = new Color4(221, 255, 255, 255);
private const float transition_duration = 200; private const float transition_duration = 200;
@ -55,30 +54,30 @@ namespace osu.Game.Screens.Play
public SongProgress() public SongProgress()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = bar_height + graph_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; Height = bar_height + SongProgressGraph.Column.HEIGHT + handleSize.Y;
Children = new Drawable[] Children = new Drawable[]
{ {
graph = new SongProgressGraph graph = new SongProgressGraph
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomLeft,
Height = graph_height, Height = SongProgressGraph.Column.HEIGHT,
Margin = new MarginPadding Margin = new MarginPadding
{ {
Bottom = bar_height Bottom = bar_height,
}
}, },
bar = new SongProgressBar(bar_height, graph_height, handleSize, fillColour) },
bar = new SongProgressBar(bar_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour)
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomLeft,
SeekRequested = delegate (float position) SeekRequested = delegate (float position)
{ {
OnSeek?.Invoke(Length * position); OnSeek?.Invoke(Length * position);
} },
} },
}; };
} }

View File

@ -5,10 +5,12 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework; using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
@ -124,6 +126,8 @@ namespace osu.Game.Screens.Play
{ {
newColumns.Add(new Column newColumns.Add(new Column
{ {
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Position = new Vector2(x, 0), Position = new Vector2(x, 0),
State = ColumnState.Dimmed, State = ColumnState.Dimmed,
}); });
@ -180,14 +184,15 @@ namespace osu.Game.Screens.Play
public Column() public Column()
{ {
Size = new Vector2(WIDTH, HEIGHT); Size = new Vector2(WIDTH, HEIGHT);
Margin = new MarginPadding { Bottom = 1 }; //todo: probably find a better fix, not quite sure why this works
for (int r = 0; r<cube_count; r++) for (int r = 0; r < cube_count; r++)
{ {
drawableRows.Add(new Box drawableRows.Add(new Box
{ {
EdgeSmoothness = new Vector2(padding / 4), EdgeSmoothness = new Vector2(padding / 4),
Size = new Vector2(cube_size), Size = new Vector2(cube_size),
Position = new Vector2(0, r* WIDTH + padding) Position = new Vector2(0, r * WIDTH),
}); });
Add(drawableRows[drawableRows.Count - 1]); Add(drawableRows[drawableRows.Count - 1]);