Fix +/- 1px uneven line spacing in textlists.

Center selector bar on selected row when selector bar height does not match row height.
This commit is contained in:
Aloshi 2014-05-16 15:58:17 -05:00
parent 90cc0991a3
commit e051b75b4f

View file

@ -135,7 +135,7 @@ void TextListComponent<T>::render(const Eigen::Affine3f& parentTrans)
if(size() == 0)
return;
const float entrySize = font->getHeight(mLineSpacing);
const float entrySize = round(font->getHeight(mLineSpacing));
int startEntry = 0;
@ -161,7 +161,7 @@ void TextListComponent<T>::render(const Eigen::Affine3f& parentTrans)
if(startEntry < listCutoff)
{
Renderer::setMatrix(trans);
Renderer::drawRect(0.f, (mCursor - startEntry)*entrySize, mSize.x(), font->getHeight(), mSelectorColor);
Renderer::drawRect(0.f, (mCursor - startEntry)*entrySize + (entrySize - font->getHeight())/2, mSize.x(), font->getHeight(), mSelectorColor);
}
// clip to inside margins