@@ -329,15 +329,15 @@ void GUIListPanel::BuildDrawBitmap() {
329329
330330 // Draw the associated bitmap
331331 if (I->m_pBitmap ) {
332- if (bitmapWidth == thirdWidth) {
332+ if (I->m_Name .empty ()) {
333+ // No text, just bitmap, so give it more room
334+ I->m_pBitmap ->DrawTrans (m_DrawBitmap, ((thirdWidth * 1 .3f ) - (bitmapWidth / 2 )) - itemX + 4 , bitmapY, 0 );
335+ } else if (bitmapWidth == thirdWidth) {
333336 // If it was deemed too large, draw it scaled
334337 I->m_pBitmap ->DrawTransScaled (m_DrawBitmap, 3 - itemX, bitmapY, bitmapWidth, bitmapHeight);
335- } else if (!I-> m_Name . empty ()) {
338+ } else {
336339 // There's text to compete for space with
337340 I->m_pBitmap ->DrawTrans (m_DrawBitmap, ((thirdWidth / 2 ) - (bitmapWidth / 2 )) - itemX + 2 , bitmapY, 0 );
338- } else {
339- // No text, just bitmap, so give it more room
340- I->m_pBitmap ->DrawTrans (m_DrawBitmap, ((thirdWidth / 2 ) - (bitmapWidth / 2 )) - itemX + 4 , bitmapY, 0 );
341341 }
342342 }
343343
@@ -991,10 +991,15 @@ GUIListPanel::Item* GUIListPanel::GetItem(int Index) {
991991 if (Index >= 0 && Index < m_Items.size ()) {
992992 return m_Items.at (Index);
993993 }
994- return 0 ;
994+ return nullptr ;
995995}
996996
997997GUIListPanel::Item* GUIListPanel::GetItem (int X, int Y) {
998+ // If outside of X bounds, return nothing
999+ if (X < m_X || X >= m_X + m_Width) {
1000+ return nullptr ;
1001+ }
1002+
9981003 int Height = m_Height;
9991004 if (m_HorzScroll->_GetVisible ()) {
10001005 Height -= m_HorzScroll->GetHeight ();
@@ -1004,6 +1009,7 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
10041009 if (m_VertScroll->_GetVisible ()) {
10051010 y -= m_VertScroll->GetValue ();
10061011 }
1012+
10071013 int Count = 0 ;
10081014 for (std::vector<Item*>::iterator it = m_Items.begin (); it != m_Items.end (); it++, Count++) {
10091015 Item* pItem = *it;
@@ -1019,7 +1025,8 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
10191025 break ;
10201026 }
10211027 }
1022- return 0 ;
1028+
1029+ return nullptr ;
10231030}
10241031
10251032int GUIListPanel::GetItemHeight (Item* pItem) {
0 commit comments