From b5b5177bc5164c774c03070774e9372edbba45b3 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 5 Apr 2019 16:11:00 +0300 Subject: [PATCH] (090f1227e) Fixed crew list occasionally not scrolling with the arrow buttons --- .../BarotraumaClient/Source/GameSession/CrewManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 0762fbd00..a4387b521 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -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; }