Open db48x opened 4 weeks ago
@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.
Yeah something is screwy here.
This actually takes up 170px, but the size allotted by additional_height
in uilist::calc_data() is only 150px
Hm this is... closer? Something's strange. The area for text
seems to be drawn about 1 pixel larger (in y) for every line it should have than the calculation provides for. e.g. during testing additional height was calculated as 450px, but drawn as roughly 472px in the y dimension for 21 cigars.
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 = {};
1 cigar:
6 cigars:
21 cigars:
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 = {};
1 cigar:
6 cigars:
21 cigars:
41 cigars:
Applying that patch to the desc_size
footer also seems to resolve the butchery window issue.
before:
after:
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
Additional context
No response