From 0b8fee56e2ca350e367585da9246dec0bc18544b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 29 Jun 2023 16:03:20 +0200 Subject: [PATCH] [ItemList] Fix item text positions in RTL mode. (cherry picked from commit 343c35e7b0f7ccf9e577c740e25097927ba8322b) --- scene/gui/item_list.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index d367a8d281c..d08d5863eb5 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1366,11 +1366,12 @@ void ItemList::_notification(int p_what) { text_ofs += base_ofs; text_ofs += items[i].rect_cache.position; - if (rtl) { - text_ofs.x = size.width - text_ofs.x - max_len; - } + float text_w = width - text_ofs.x; + items.write[i].text_buf->set_width(text_w); - items.write[i].text_buf->set_width(width - text_ofs.x); + if (rtl) { + text_ofs.x = size.width - width; + } if (rtl) { items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_RIGHT);