@@ -1039,7 +1039,7 @@ void ItemList::_notification(int p_what) {
10391039 scroll_bar->set_anchor_and_offset (SIDE_BOTTOM, ANCHOR_END, -theme_cache.panel_style ->get_margin (SIDE_BOTTOM));
10401040
10411041 Size2 size = get_size ();
1042- int width = size.width - theme_cache.panel_style ->get_minimum_size (). width ;
1042+ int width = size.width - theme_cache.panel_style ->get_margin (SIDE_RIGHT) ;
10431043 if (scroll_bar->is_visible ()) {
10441044 width -= scroll_bar_minwidth;
10451045 }
@@ -1192,9 +1192,9 @@ void ItemList::_notification(int p_what) {
11921192 Point2 pos = items[i].rect_cache .position + icon_ofs + base_ofs;
11931193
11941194 if (icon_mode == ICON_MODE_TOP) {
1195- pos.y += theme_cache.v_separation / 2 ;
1195+ pos.y += MAX ( theme_cache.v_separation , 0 ) / 2 ;
11961196 } else {
1197- pos.x += theme_cache.h_separation / 2 ;
1197+ pos.x += MAX ( theme_cache.h_separation , 0 ) / 2 ;
11981198 }
11991199
12001200 if (icon_mode == ICON_MODE_TOP) {
@@ -1243,8 +1243,8 @@ void ItemList::_notification(int p_what) {
12431243 }
12441244
12451245 Point2 draw_pos = items[i].rect_cache .position ;
1246- draw_pos.x += theme_cache.h_separation / 2 ;
1247- draw_pos.y += theme_cache.v_separation / 2 ;
1246+ draw_pos.x += MAX ( theme_cache.h_separation , 0 ) / 2 ;
1247+ draw_pos.y += MAX ( theme_cache.v_separation , 0 ) / 2 ;
12481248 if (rtl) {
12491249 draw_pos.x = size.width - draw_pos.x - tag_icon_size.x ;
12501250 }
@@ -1283,16 +1283,15 @@ void ItemList::_notification(int p_what) {
12831283 text_ofs += base_ofs;
12841284 text_ofs += items[i].rect_cache .position ;
12851285
1286- text_ofs.x += theme_cache.h_separation / 2 ;
1287- text_ofs.y += theme_cache.v_separation / 2 ;
1286+ text_ofs.y += MAX (theme_cache.v_separation , 0 ) / 2 ;
12881287
12891288 if (rtl) {
12901289 text_ofs.x = size.width - text_ofs.x - max_len;
12911290 }
12921291
12931292 items.write [i].text_buf ->set_alignment (HORIZONTAL_ALIGNMENT_CENTER);
12941293
1295- float text_w = items[i].rect_cache .size .width - theme_cache. h_separation ;
1294+ float text_w = items[i].rect_cache .size .width ;
12961295 items.write [i].text_buf ->set_width (text_w);
12971296
12981297 if (theme_cache.font_outline_size > 0 && theme_cache.font_outline_color .a > 0 ) {
@@ -1307,17 +1306,17 @@ void ItemList::_notification(int p_what) {
13071306
13081307 if (icon_mode == ICON_MODE_TOP) {
13091308 text_ofs.x += (items[i].rect_cache .size .width - size2.x ) / 2 ;
1310- text_ofs.x += theme_cache.h_separation / 2 ;
1311- text_ofs.y += theme_cache.v_separation / 2 ;
1309+ text_ofs.x += MAX ( theme_cache.h_separation , 0 ) / 2 ;
1310+ text_ofs.y += MAX ( theme_cache.v_separation , 0 ) / 2 ;
13121311 } else {
13131312 text_ofs.y += (items[i].rect_cache .size .height - size2.y ) / 2 ;
1314- text_ofs.x += theme_cache.h_separation / 2 ;
1313+ text_ofs.x += MAX ( theme_cache.h_separation , 0 ) / 2 ;
13151314 }
13161315
13171316 text_ofs += base_ofs;
13181317 text_ofs += items[i].rect_cache .position ;
13191318
1320- float text_w = width - text_ofs.x - theme_cache. h_separation ;
1319+ float text_w = width - text_ofs.x ;
13211320 items.write [i].text_buf ->set_width (text_w);
13221321
13231322 if (rtl) {
@@ -1410,14 +1409,14 @@ void ItemList::force_update_list_size() {
14101409 max_column_width = MAX (max_column_width, minsize.x );
14111410
14121411 // Elements need to adapt to the selected size.
1413- minsize.y += theme_cache.v_separation ;
1414- minsize.x += theme_cache.h_separation ;
1412+ minsize.y += MAX ( theme_cache.v_separation , 0 ) ;
1413+ minsize.x += MAX ( theme_cache.h_separation , 0 ) ;
14151414
14161415 items.write [i].rect_cache .size = minsize;
14171416 items.write [i].min_rect_cache .size = minsize;
14181417 }
14191418
1420- int fit_size = size.x - theme_cache.panel_style ->get_minimum_size ().width - scroll_bar_minwidth ;
1419+ int fit_size = size.x - theme_cache.panel_style ->get_minimum_size ().width ;
14211420
14221421 // 2-attempt best fit
14231422 current_columns = 0x7FFFFFFF ;
@@ -1443,7 +1442,7 @@ void ItemList::force_update_list_size() {
14431442 }
14441443
14451444 if (same_column_width) {
1446- items.write [i].rect_cache .size .x = max_column_width + theme_cache.h_separation ;
1445+ items.write [i].rect_cache .size .x = max_column_width + MAX ( theme_cache.h_separation , 0 ) ;
14471446 }
14481447 items.write [i].rect_cache .position = ofs;
14491448
@@ -1468,13 +1467,17 @@ void ItemList::force_update_list_size() {
14681467 }
14691468 }
14701469
1470+ float page = MAX (0 , size.height - theme_cache.panel_style ->get_minimum_size ().height );
1471+ float max = MAX (page, ofs.y + max_h);
1472+ if (page >= max) {
1473+ fit_size -= scroll_bar_minwidth;
1474+ }
1475+
14711476 if (all_fit) {
14721477 for (int j = items.size () - 1 ; j >= 0 && col > 0 ; j--, col--) {
14731478 items.write [j].rect_cache .size .y = max_h;
14741479 }
14751480
1476- float page = MAX (0 , size.height - theme_cache.panel_style ->get_minimum_size ().height );
1477- float max = MAX (page, ofs.y + max_h);
14781481 if (auto_height) {
14791482 auto_height_value = ofs.y + max_h + theme_cache.panel_style ->get_minimum_size ().height ;
14801483 }
0 commit comments