-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
incorrect vertical size of uilist menus #75698
Comments
@katemonster33, do you have any thoughts on this? |
/confirmed Can confirm this issue, and that it happens on many, many boxes. Especially noted on the bandaging menu that only the very top of the text for 'disinfection' status shows if the 'bandage' status text is also showing. Box is clearly not wrapping to the actual size of the needed text, and just cuts off wherever. Guessing #75673 broke several things and this was only partially fixed in #75684 edit2: horizontal information like the amount of time a clothing disassembly takes is also completely missing now. edit3: @db48x maybe i should be login separate bug reports on this... proficiencies also appear to have been broken by the #75673 change. some now display greater than 100% as the 'percent' sign is spilling over onto the next line. unsure if this is cosmetic or changing behaviour, but i'm credited with proficiencies i'm sure i never hit 100% in, but am now showing greater than 100%. also, those over 100% have not disappeared from the list. |
The proficiency list is an interesting bug, but it isn’t drawn using ImGui. Do file that one separately. The butchery menu is filed as #75813; thanks for reminding me about it. |
Hm this is... closer? Something's strange. The area for index 9c4768909f..eaadebd435 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -633,7 +633,8 @@ void uilist::calc_data()
ImVec2 text_size = {};
if( !text.empty() ) {
text_size = calc_size( text );
- text_size.y += s.ItemSpacing.y * 2.0;
+ float expected_num_lines = text_size.y / ImGui::GetTextLineHeightWithSpacing();
+ text_size.y += ( s.ItemSpacing.y * 2.0 * expected_num_lines );
}
ImVec2 desc_size = {}; |
Better patch where I don't double-count the spacing. No wonder it was screwy! index 9c4768909f..9cc2ac9e69 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -633,7 +633,8 @@ void uilist::calc_data()
ImVec2 text_size = {};
if( !text.empty() ) {
text_size = calc_size( text );
- text_size.y += s.ItemSpacing.y * 2.0;
+ float expected_num_lines = text_size.y / ImGui::GetTextLineHeight();
+ text_size.y += ( s.ItemSpacing.y * expected_num_lines ) + ( s.ItemSpacing.y * 2.0 );
}
ImVec2 desc_size = {}; |
Describe the bug
Every line of text added above or below the menu items in a uilist menu causes the window to be a few pixels too short. This causes the end of the menu to be clipped. The more text there is, the more is clipped.
The uilist measures the text it is given to discover how large the menu should be. Is this some mismatch between how we (or our modified version of ImGui) measures text and how it renders it?
Attach save file
n/a
Steps to reproduce
Acquire multiple activatable objects (such as lamps, cigarettes, etc) and then use the sleep menu.
Expected behavior
I expect the menu to be the right size! Crazy, I know.
Screenshots
Two lines of text, slightly clipped at the bottom:
Four lines, more clipping:
Versions and configuration
Dark Days Ahead [dda],
Magiclysm [magiclysm],
Disable NPC Needs [no_npc_food],
Portal Storms Ignore NPCs [personal_portal_storms],
Slowdown Fungal Growth [no_fungal_growth]
]
Additional context
No response
The text was updated successfully, but these errors were encountered: