@@ -564,10 +564,8 @@ void PopupMenu::_draw_items() {
564
564
// Separator
565
565
item_ofs.x += items[i].h_ofs ;
566
566
if (items[i].separator ) {
567
- int sep_h = separator->get_center_size ().height + separator->get_minimum_size ().height ;
568
- int sep_ofs = Math::floor ((h - sep_h) / 2.0 );
569
567
if (!text.is_empty () || !items[i].icon .is_null ()) {
570
- int content_size = items[i].text_buf ->get_size ().width ;
568
+ int content_size = items[i].text_buf ->get_size ().width + hseparation * 2 ;
571
569
if (!items[i].icon .is_null ()) {
572
570
content_size += icon_size.width + hseparation;
573
571
}
@@ -576,12 +574,18 @@ void PopupMenu::_draw_items() {
576
574
int content_left = content_center - content_size / 2 ;
577
575
int content_right = content_center + content_size / 2 ;
578
576
if (content_left > item_ofs.x ) {
577
+ int sep_h = labeled_separator_left->get_center_size ().height + labeled_separator_left->get_minimum_size ().height ;
578
+ int sep_ofs = Math::floor ((h - sep_h) / 2.0 );
579
579
labeled_separator_left->draw (ci, Rect2 (item_ofs + Point2 (0 , sep_ofs), Size2 (MAX (0 , content_left - item_ofs.x ), sep_h)));
580
580
}
581
581
if (content_right < display_width) {
582
+ int sep_h = labeled_separator_right->get_center_size ().height + labeled_separator_right->get_minimum_size ().height ;
583
+ int sep_ofs = Math::floor ((h - sep_h) / 2.0 );
582
584
labeled_separator_right->draw (ci, Rect2 (Point2 (content_right, item_ofs.y + sep_ofs), Size2 (MAX (0 , display_width - content_right), sep_h)));
583
585
}
584
586
} else {
587
+ int sep_h = separator->get_center_size ().height + separator->get_minimum_size ().height ;
588
+ int sep_ofs = Math::floor ((h - sep_h) / 2.0 );
585
589
separator->draw (ci, Rect2 (item_ofs + Point2 (0 , sep_ofs), Size2 (display_width, sep_h)));
586
590
}
587
591
}
0 commit comments