summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-05-22 13:48:54 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-05-22 13:48:54 +0200
commita30a55dd1ff9b07b403aabbacf051a4517a4dbf2 (patch)
tree0bc8e63c10e3c71f26539bb6272405c62a212b0b
parenta14ef21c2565c11cc1903c31b5c9f0674dab8b3c (diff)
parent343c35e7b0f7ccf9e577c740e25097927ba8322b (diff)
downloadredot-engine-a30a55dd1ff9b07b403aabbacf051a4517a4dbf2.tar.gz
Merge pull request #77166 from bruvzg/item_list_rtl
[ItemList] Fix item text positions in RTL mode.
-rw-r--r--scene/gui/item_list.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 594276a428..aa9ecd4142 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1260,12 +1260,13 @@ void ItemList::_notification(int p_what) {
text_ofs += base_ofs;
text_ofs += items[i].rect_cache.position;
+ float text_w = width - text_ofs.x;
+ items.write[i].text_buf->set_width(text_w);
+
if (rtl) {
- text_ofs.x = size.width - text_ofs.x - max_len;
+ text_ofs.x = size.width - width;
}
- items.write[i].text_buf->set_width(width - text_ofs.x);
-
if (rtl) {
items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
} else {