From 7fc3fbd39bc10f4c6e6ef5bf8efaf1bbf6df9478 Mon Sep 17 00:00:00 2001 From: Oliver 'kfsone' Smith Date: Wed, 24 Feb 2021 13:50:51 -0800 Subject: [PATCH] Use ConstrainRectangle in button.go --- raygui/button.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/raygui/button.go b/raygui/button.go index 628b8ad..741e3e9 100644 --- a/raygui/button.go +++ b/raygui/button.go @@ -20,13 +20,7 @@ func Button(bounds rl.Rectangle, text string) bool { textHeight := int32(style[GlobalTextFontsize]) textWidth := rl.MeasureText(text, textHeight) - // Update control - if int32(bounds.Height) < textHeight { - bounds.Height = float32(textHeight + GetStyle32(ButtonTextPadding)/2) - } - if int32(bounds.Width) < textWidth { - bounds.Width = float32(textWidth + GetStyle32(ButtonTextPadding)) - } + ConstrainRectangle(&bounds, textWidth, textWidth+GetStyle32(ButtonTextPadding), textHeight, textHeight+GetStyle32(ButtonTextPadding)/2) // Determine what state we're in and whether its valid. state := GetInteractionState(bounds)