mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 23:42:55 +08:00
add direction to graphs
This commit is contained in:
parent
8e689a06d8
commit
58f8dc8254
@ -14,6 +14,22 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class BarGraph : FillFlowContainer<Bar>
|
public class BarGraph : FillFlowContainer<Bar>
|
||||||
{
|
{
|
||||||
|
private BarDirection direction = BarDirection.BottomToTop;
|
||||||
|
public new BarDirection Direction
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
direction = value;
|
||||||
|
foreach (var bar in Children)
|
||||||
|
bar.Direction = direction;
|
||||||
|
base.Direction = direction == BarDirection.LeftToRight || direction == BarDirection.RightToLeft ? FillDirection.Vertical : FillDirection.Horizontal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<float> Values
|
public IEnumerable<float> Values
|
||||||
{
|
{
|
||||||
@ -33,13 +49,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Width = 1.0f / values.Count,
|
Width = 1.0f / values.Count,
|
||||||
Length = values[i] / values.Max(),
|
Length = values[i] / values.Max(),
|
||||||
Direction = BarDirection.BottomToTop,
|
Direction = Direction,
|
||||||
BackgroundColour = new Color4(0, 0, 0, 0),
|
BackgroundColour = new Color4(0, 0, 0, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Bar : Container
|
public class Bar : Container
|
||||||
|
@ -305,7 +305,6 @@ namespace osu.Game.Screens.Select
|
|||||||
ratingsGraph = new BarGraph
|
ratingsGraph = new BarGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Height = 50,
|
Height = 50,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user