mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:52:54 +08:00
Merge pull request #25386 from EVAST9919/bar-graph-smooth
Ensure `BarGraph`'s draw quad is thick enough
This commit is contained in:
commit
626cfae3fe
@ -17,18 +17,16 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
BarGraph graph;
|
||||
|
||||
Children = new[]
|
||||
Child = graph = new BarGraph
|
||||
{
|
||||
graph = new BarGraph
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(0.5f),
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(0.5f),
|
||||
};
|
||||
|
||||
AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Select(i => (float)i));
|
||||
AddStep("small values", () => graph.Values = Enumerable.Range(1, 10).Select(i => i * 0.01f).Concat(new[] { 100f }));
|
||||
AddStep("values from 1-100", () => graph.Values = Enumerable.Range(1, 100).Select(i => (float)i));
|
||||
AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i));
|
||||
AddStep("empty values", () => graph.Values = Array.Empty<float>());
|
||||
@ -36,6 +34,14 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom);
|
||||
AddStep("Left to right", () => graph.Direction = BarDirection.LeftToRight);
|
||||
AddStep("Right to left", () => graph.Direction = BarDirection.RightToLeft);
|
||||
|
||||
AddToggleStep("Toggle movement", enabled =>
|
||||
{
|
||||
if (enabled)
|
||||
graph.MoveToY(-10, 1000).Then().MoveToY(10, 1000).Loop();
|
||||
else
|
||||
graph.ClearTransforms();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +145,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
float barHeight = drawSize.Y * ((direction == BarDirection.TopToBottom || direction == BarDirection.BottomToTop) ? lengths[i] : barBreadth);
|
||||
float barWidth = drawSize.X * ((direction == BarDirection.LeftToRight || direction == BarDirection.RightToLeft) ? lengths[i] : barBreadth);
|
||||
|
||||
if (barHeight == 0 || barWidth == 0)
|
||||
continue;
|
||||
|
||||
// Apply minimum sizing to hide the fact that we don't have fractional anti-aliasing.
|
||||
barHeight = Math.Max(barHeight, 1.5f);
|
||||
barWidth = Math.Max(barWidth, 1.5f);
|
||||
|
||||
Vector2 topLeft;
|
||||
|
||||
switch (direction)
|
||||
|
Loading…
Reference in New Issue
Block a user