Skip to content

Commit 6fa74a0

Browse files
committed
fix(icons): fix left aligned icons on menu items being in front of the text
1 parent 7f4d4ba commit 6fa74a0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

MenuAPI/items/MenuItem.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,12 +987,16 @@ internal virtual void Draw(int indexOffset)
987987

988988
DrawBackground(indexOffset, yOffset, out float x, out float y);
989989

990-
float textMinX = (textXOffset / MenuController.ScreenWidth) + (10f / MenuController.ScreenWidth);
991990
float textMaxX = (Width - 10f) / MenuController.ScreenWidth;
992991
float textY = y - ((30f / 2f) / MenuController.ScreenHeight);
993992

994993
textXOffset = DrawLeftIcon(textXOffset, y);
995994
rightTextIconOffset = DrawRightIcon(rightTextIconOffset, y);
995+
996+
// must be calculated after DrawLeftIcon, otherwise the left icon offset is not taken into account
997+
// and the item text will be drawn on top of the icon.
998+
float textMinX = (textXOffset / MenuController.ScreenWidth) + (10f / MenuController.ScreenWidth);
999+
9961000
DrawLabelText(textXOffset, rightTextIconOffset, y, font, textSize, textColor, textY);
9971001
DrawItemText(font, textSize, textColor, textMinX, textMaxX, textY, textXOffset, y);
9981002
}

0 commit comments

Comments
 (0)