Merge pull request #58477 from AlbertFay/text-under-scrollbar

This commit is contained in:
Rémi Verschelde 2022-03-01 01:32:36 +01:00 committed by GitHub
commit c8e62555f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View file

@ -401,7 +401,7 @@
<member name="select_mode" type="int" setter="set_select_mode" getter="get_select_mode" enum="ItemList.SelectMode" default="0"> <member name="select_mode" type="int" setter="set_select_mode" getter="get_select_mode" enum="ItemList.SelectMode" default="0">
Allows single or multiple item selection. See the [enum SelectMode] constants. Allows single or multiple item selection. See the [enum SelectMode] constants.
</member> </member>
<member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="TextParagraph.OverrunBehavior" default="0"> <member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="TextParagraph.OverrunBehavior" default="3">
Sets the clipping behavior when the text exceeds an item's bounding rectangle. See [enum TextParagraph.OverrunBehavior] for a description of all modes. Sets the clipping behavior when the text exceeds an item's bounding rectangle. See [enum TextParagraph.OverrunBehavior] for a description of all modes.
</member> </member>
</members> </members>

View file

@ -1241,7 +1241,7 @@ void ItemList::_notification(int p_what) {
text_ofs.x = size.width - text_ofs.x - max_len; text_ofs.x = size.width - text_ofs.x - max_len;
} }
items.write[i].text_buf->set_width(max_len); items.write[i].text_buf->set_width(width - text_ofs.x);
if (rtl) { if (rtl) {
items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_RIGHT); items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
@ -1253,7 +1253,9 @@ void ItemList::_notification(int p_what) {
items[i].text_buf->draw_outline(get_canvas_item(), text_ofs, outline_size, font_outline_color); items[i].text_buf->draw_outline(get_canvas_item(), text_ofs, outline_size, font_outline_color);
} }
items[i].text_buf->draw(get_canvas_item(), text_ofs, modulate); if (width - text_ofs.x > 0) {
items[i].text_buf->draw(get_canvas_item(), text_ofs, modulate);
}
} }
} }

View file

@ -99,7 +99,7 @@ private:
SelectMode select_mode = SELECT_SINGLE; SelectMode select_mode = SELECT_SINGLE;
IconMode icon_mode = ICON_MODE_LEFT; IconMode icon_mode = ICON_MODE_LEFT;
VScrollBar *scroll_bar; VScrollBar *scroll_bar;
TextParagraph::OverrunBehavior text_overrun_behavior = TextParagraph::OVERRUN_NO_TRIMMING; TextParagraph::OverrunBehavior text_overrun_behavior = TextParagraph::OVERRUN_TRIM_ELLIPSIS;
uint64_t search_time_msec = 0; uint64_t search_time_msec = 0;
String search_string; String search_string;