Use ConstrainRectangle in button.go

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

View file

@ -20,13 +20,7 @@ func Button(bounds rl.Rectangle, text string) bool {
textHeight := int32(style[GlobalTextFontsize]) textHeight := int32(style[GlobalTextFontsize])
textWidth := rl.MeasureText(text, textHeight) textWidth := rl.MeasureText(text, textHeight)
// Update control ConstrainRectangle(&bounds, textWidth, textWidth+GetStyle32(ButtonTextPadding), textHeight, textHeight+GetStyle32(ButtonTextPadding)/2)
if int32(bounds.Height) < textHeight {
bounds.Height = float32(textHeight + GetStyle32(ButtonTextPadding)/2)
}
if int32(bounds.Width) < textWidth {
bounds.Width = float32(textWidth + GetStyle32(ButtonTextPadding))
}
// Determine what state we're in and whether its valid. // Determine what state we're in and whether its valid.
state := GetInteractionState(bounds) state := GetInteractionState(bounds)