fix(ui): expand option row height for wrapped multi-line labels#11264
Open
BenJule wants to merge 1 commit into
Open
fix(ui): expand option row height for wrapped multi-line labels#11264BenJule wants to merge 1 commit into
BenJule wants to merge 1 commit into
Conversation
init_ctrl_lines() reserved the option-row height with a '(label width > column ? 2 : 1)' heuristic that caps a wrapped label at two lines. CtrlLine::render, however, wraps the label with Label::split_lines (unlimited lines) and vertically centers it inside the row height, so a label that wraps to three or more lines (common with longer translations) overflowed and was drawn on top of the next option row. Reserve the actual wrapped height using the same helper and width that the renderer uses, plus the existing vertical gap. Single- and two-line rows are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the slicer settings panel, option labels overlap each other when a label is long enough to wrap across several lines. It is most visible in non‑English UIs (reported for pt‑BR in #11259): labels such as "Altura inicial da camada", "Subcamada de cor mista", "Superfície superior" or "Preenchimento sólido interno" are drawn on top of the following option row. It happens regardless of monitor resolution and at 100 % display scaling.
Root cause
OG_CustomCtrl::init_ctrl_lines()reserves each row's height with a heuristic:height = label_sz.y * (label_sz.GetWidth() > int(opt_group->label_width * m_em_unit) ? 2 : 1) + m_v_gap;This assumes a label wraps to at most two lines.
CtrlLine::render(), however, wraps the label withLabel::split_lines(...)(unlimited lines) and vertically centers it inside the reservedheight(v_pos + (height - label_size.y) / 2). When a label wraps to three or more lines,label_size.y > height, the centering offset goes negative and the label overflows onto the neighbouring row.Fix
Reserve the actual wrapped height, measured with the same helper and width the renderer uses (
Label::split_linesatlabel_width * m_em_unit), plus the existing vertical gapm_v_gap. Single‑line and two‑line rows are unchanged (their reserved height is identical to before); only labels that wrap to 3+ lines now get the room they are drawn in. The BBS multi‑option‑per‑line branch is left untouched.Note
I traced this statically against the render path and kept the change minimal; I could not visually verify a built binary here. A quick check with long/translated labels (e.g. pt‑BR) in a narrow settings column would be appreciated. The separate "print plate button clipped at the top‑right on small screens" symptom from #11259 is a horizontal‑space issue and is not addressed here.
Closes #11259