InputRoll - simplify

This commit is contained in:
adelikat 2019-12-03 13:46:59 -06:00
parent e7e68a630c
commit 90f6d8a2f5
1 changed files with 26 additions and 36 deletions

View File

@ -157,49 +157,39 @@ namespace BizHawk.Client.EmuHawk
{ {
_renderer.PrepDrawString(Font, _foreColor); _renderer.PrepDrawString(Font, _foreColor);
if (HorizontalOrientation) int h = ColumnHeight;
{ int yOffset = HorizontalOrientation ? -_vBar.Value : 0;
int y = -_vBar.Value;
for(int j = 0; j < visibleColumns.Count; j++) for (int j = 0; j < visibleColumns.Count; j++)
{ {
var column = visibleColumns[j]; var column = visibleColumns[j];
var w = column.Width;
int x, y;
if (HorizontalOrientation)
{
var columnHeight = GetHColHeight(j); var columnHeight = GetHColHeight(j);
var textHeight = (int)_renderer.MeasureString(column.Text, Font).Height; var textHeight = (int)_renderer.MeasureString(column.Text, Font).Height;
int strX = CellWidthPadding; x = CellWidthPadding;
int strY = y + ((columnHeight - textHeight) / 2); y = yOffset + ((columnHeight - textHeight) / 2);
if (IsHoveringOnColumnCell && column == CurrentCell.Column) yOffset += columnHeight;
{
_renderer.PrepDrawString(Font, SystemColors.HighlightText);
DrawString(column.Text, new Rectangle(strX, strY, column.Width, CellHeight));
_renderer.PrepDrawString(Font, _foreColor);
} }
else else
{ {
DrawString(column.Text, new Rectangle(strX, strY, column.Width, CellHeight)); x = column.Left + 2 * CellWidthPadding - _hBar.Value;
}
y += columnHeight;
}
}
else
{
foreach (var column in visibleColumns)
{
var x = column.Left + 2 * CellWidthPadding - _hBar.Value;
// TODO: fix this CellPadding issue (2 * CellPadding vs just CellPadding) // TODO: fix this CellPadding issue (2 * CellPadding vs just CellPadding)
var y = CellHeightPadding; y = CellHeightPadding;
}
if (IsHoveringOnColumnCell && column == CurrentCell.Column) if (IsHoveringOnColumnCell && column == CurrentCell.Column)
{ {
_renderer.PrepDrawString(Font, SystemColors.HighlightText); _renderer.PrepDrawString(Font, SystemColors.HighlightText);
DrawString(column.Text, new Rectangle(x, y, column.Width, ColumnHeight)); DrawString(column.Text, new Rectangle(x, y, column.Width, h));
_renderer.PrepDrawString(Font, _foreColor); _renderer.PrepDrawString(Font, _foreColor);
} }
else else
{ {
DrawString(column.Text, new Rectangle(x, y, column.Width, ColumnHeight)); DrawString(column.Text, new Rectangle(x, y, w, h));
}
} }
} }
} }