From b87f14f962d4b5a25a3cf9ddc343d6cf5ef14a24 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 3 Dec 2019 19:35:19 -0600 Subject: [PATCH] InputRoll - fix bug in the last gridline calculation in horizontal view --- .../CustomControls/InputRoll/InputRoll.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index 1a0d27e989..666d829bc3 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -1897,8 +1897,17 @@ namespace BizHawk.Client.EmuHawk private int GetHColHeight(int index) => _horizontalColumnHeights != null && index < _horizontalColumnHeights.Length ? _horizontalColumnHeights[index] : CellHeight; - private int GetHColTop(int index) => - _horizontalColumnTops != null && index < _horizontalColumnTops.Length ? _horizontalColumnTops[index] : (index * CellHeight); + private int GetHColTop(int index) + { + if (_horizontalColumnTops == null) + { + return 0; + } + + return index < _horizontalColumnTops.Length + ? _horizontalColumnTops[index] + : _horizontalColumnTops.Last() + CellHeight; + } private int GetHColBottom(int index) => GetHColTop(index) + GetHColHeight(index);