-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUI: Fix text overlapping icon in Tree
#78756
GUI: Fix text overlapping icon in Tree
#78756
Conversation
godotengine#78756 ?? 2 months ago
602ddf7
to
4a526cf
Compare
I guess that would be an alternative to #71667 ? How does your solution handle deep nested trees? Ideally I'd like something close to the clip in #71667 (comment) (unfortunately, the sources of this approach have been lost to time, so it would need to be reproduced). |
No, I don't think it's related. This PR fixes a regression that came later than the last update #71667. Fixed only overlapping of the right icons (buttons) on the text, not on the left icon.
1.mp4The horizontal scroll bar remains, sorry for not capturing it on video. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall, but I'll let @bruvzg review implementation details.
4a526cf
to
f2cbd64
Compare
scene/gui/tree.cpp
Outdated
@@ -2096,7 +2117,12 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 | |||
buttons_width += button_size.width + theme_cache.button_margin; | |||
} | |||
|
|||
p_item->cells.write[i].text_buf->set_width(item_width); | |||
int text_width = item_width; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int text_width = item_width; | |
int text_width = item_width - theme_cache.inner_item_margin_left - theme_cache.inner_item_margin_right; |
This should fix the issue with the text overflow. It's already accounted for when drawing the rectangle, so we only need to add it to the text width. I've tested it and it seems to work fine.
See #75460.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've noticed a new bug, but it's probably not related to this PR.
1.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also be related to these new margin properties, I guess.
f2cbd64
to
07d2348
Compare
Thanks! |
Cherry-picked for 4.1.2. |
text_overrun_behavior
.TextLine
defaults toOVERRUN_TRIM_ELLIPSIS
andTextParagraph
defaults toOVERRUN_NO_TRIMMING
.text_overrun_behavior
customizable.