Skip to content

fix(ui): expand option row height for wrapped multi-line labels#11264

Open
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:fix/option-row-height-wrapped-labels
Open

fix(ui): expand option row height for wrapped multi-line labels#11264
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:fix/option-row-height-wrapped-labels

Conversation

@BenJule

@BenJule BenJule commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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 with Label::split_lines(...) (unlimited lines) and vertically centers it inside the reserved height (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_lines at label_width * m_em_unit), plus the existing vertical gap m_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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screen resolution problems

1 participant