Use ConstrainRectangle in button.go
This commit is contained in:
parent
a9c43af1bc
commit
7fc3fbd39b
1 changed files with 1 additions and 7 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue