fix(style): reserve the height a wrapped description actually needs
Both widgets drew their description with a wrap width and then sized the row as if it were always one line. Same bug, two different symptoms. A setting row clips to its label column, so the second line was simply cut off, directly under a comment claiming the text wraps rather than being cut. A section header has no clip rect at all, so the overflow was drawn over its own border line and into whatever the caller rendered next. Both now measure with CalcTextSize against the same wrap width they draw with. The section header also gained the clip rect it never had, and its lead offset is computed once instead of twice, so the measured width and the drawn width cannot drift apart. Third fix, same family: the segmented control relied on its last InvisibleButton to leave the cursor in the right place. It happened to work, because the loop re-pins the cursor before every segment, but a caller cannot see that from the outside -- and the gallery duly reserved the row a second time with Dummy, doubling the gap after every segmented control. The widget now owns its advance explicitly, like the other two, and CalcSize is gone with its only caller.
This commit is contained in:
@@ -304,7 +304,6 @@ internal sealed class WidgetGalleryWindow : Window
|
||||
_segmentTwo,
|
||||
colors
|
||||
);
|
||||
ImGui.Dummy(SegmentedControl.CalcSize(width));
|
||||
|
||||
_segmentThree = SegmentedControl.Draw(
|
||||
ImGui.GetID("gallery.segmented.three"),
|
||||
@@ -314,7 +313,6 @@ internal sealed class WidgetGalleryWindow : Window
|
||||
_segmentThree,
|
||||
colors
|
||||
);
|
||||
ImGui.Dummy(SegmentedControl.CalcSize(width));
|
||||
|
||||
// Odd width over three segments: the edges must stay flush with no seam
|
||||
// and no overhang on the right.
|
||||
@@ -327,7 +325,6 @@ internal sealed class WidgetGalleryWindow : Window
|
||||
colors,
|
||||
disabled: true
|
||||
);
|
||||
ImGui.Dummy(SegmentedControl.CalcSize(201f));
|
||||
|
||||
ImGui.Spacing();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user