@@ -329,15 +329,15 @@ void GUIListPanel::BuildDrawBitmap() {
329
329
330
330
// Draw the associated bitmap
331
331
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) {
333
336
// If it was deemed too large, draw it scaled
334
337
I->m_pBitmap ->DrawTransScaled (m_DrawBitmap, 3 - itemX, bitmapY, bitmapWidth, bitmapHeight);
335
- } else if (!I-> m_Name . empty ()) {
338
+ } else {
336
339
// There's text to compete for space with
337
340
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 );
341
341
}
342
342
}
343
343
@@ -991,10 +991,15 @@ GUIListPanel::Item* GUIListPanel::GetItem(int Index) {
991
991
if (Index >= 0 && Index < m_Items.size ()) {
992
992
return m_Items.at (Index);
993
993
}
994
- return 0 ;
994
+ return nullptr ;
995
995
}
996
996
997
997
GUIListPanel::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
+
998
1003
int Height = m_Height;
999
1004
if (m_HorzScroll->_GetVisible ()) {
1000
1005
Height -= m_HorzScroll->GetHeight ();
@@ -1004,6 +1009,7 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
1004
1009
if (m_VertScroll->_GetVisible ()) {
1005
1010
y -= m_VertScroll->GetValue ();
1006
1011
}
1012
+
1007
1013
int Count = 0 ;
1008
1014
for (std::vector<Item*>::iterator it = m_Items.begin (); it != m_Items.end (); it++, Count++) {
1009
1015
Item* pItem = *it;
@@ -1019,7 +1025,8 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
1019
1025
break ;
1020
1026
}
1021
1027
}
1022
- return 0 ;
1028
+
1029
+ return nullptr ;
1023
1030
}
1024
1031
1025
1032
int GUIListPanel::GetItemHeight (Item* pItem) {
0 commit comments