Center row icons between title and subtitle

When a row has a subtitle, position the icon at the midpoint between the title and subtitle text centers instead of aligning only with the title. This prevents icons from appearing too high when subtitles are present.
This commit is contained in:
Justin Mitchell
2026-06-17 01:41:10 -04:00
parent e567620003
commit 6648a980cb
2 changed files with 17 additions and 10 deletions
+9 -2
View File
@@ -315,8 +315,15 @@ void LyraTheme::drawList(const GfxRenderer& renderer, Rect rect, int itemCount,
if (rowIcon != nullptr) {
const freeink::Icon* ic = pickIcon(rowIcon(i), drawnIconPx);
if (ic != nullptr) {
// Place the icon's baked-in optical center on the title's optical center.
const int textCenter = titleTop + renderer.getTextVisualCenterOffset(UI_10_FONT_ID);
// Place the icon's baked-in optical center on the row's text center. For rows
// with a subtitle, center across both lines (title near the top, subtitle at
// itemY + 30) so the icon sits in the middle of the stacked block rather than
// riding up with the title alone.
int textCenter = titleTop + renderer.getTextVisualCenterOffset(UI_10_FONT_ID);
if (rowSubtitle != nullptr) {
const int subtitleCenter = itemY + 30 + renderer.getTextVisualCenterOffset(SMALL_FONT_ID);
textCenter = (textCenter + subtitleCenter) / 2;
}
renderer.drawIcon(*ic, rect.x + M().contentSidePadding + hPaddingInSelection,
textCenter - ic->opticalCenterY);
}