(090f1227e) Fixed crew list occasionally not scrolling with the arrow buttons

This commit is contained in:
Joonas Rikkonen
2019-04-05 16:11:00 +03:00
parent 95698f5eb5
commit b5b5177bc5
@@ -590,8 +590,14 @@ namespace Barotrauma
float step =
(characterListBox.Content.Children.First().Rect.Height + characterListBox.Spacing) /
(characterListBox.TotalSize - characterListBox.Rect.Height);
characterListBox.BarScroll -= characterListBox.BarScroll % step;
characterListBox.BarScroll += dir * step;
//round the scroll so that we're not displaying partial character frames
float roundedPos = MathUtils.RoundTowardsClosest(characterListBox.BarScroll, step);
if (Math.Abs(roundedPos - characterListBox.BarScroll) < step / 2)
{
characterListBox.BarScroll = roundedPos;
}
return false;
}