Use ConstrainRectangle in combobox.go

This commit is contained in:
Oliver 'kfsone' Smith 2021-02-24 13:51:09 -08:00
parent 7fc3fbd39b
commit 01408701f9

View file

@ -38,12 +38,7 @@ func ComboBox(bounds rl.Rectangle, comboText []string, active int) int {
textWidth := rl.MeasureText(activeText, textHeight) textWidth := rl.MeasureText(activeText, textHeight)
// Ensure box is large enough. // Ensure box is large enough.
if int32(bounds.Width) < textWidth { ConstrainRectangle(&bounds, textWidth, textWidth + GetStyle32(ToggleTextPadding), textHeight, textHeight + GetStyle32(ToggleTextPadding))
bounds.Width = float32(textWidth + GetStyle32(ToggleTextPadding))
}
if int32(bounds.Height) < textHeight {
bounds.Height = float32(textHeight + GetStyle32(ToggleTextPadding))
}
b := bounds.ToInt32() b := bounds.ToInt32()
// Generate the worst-case sizing of the counter so we can avoid resizing it as the numbers go up/down. // Generate the worst-case sizing of the counter so we can avoid resizing it as the numbers go up/down.