Skip to content

Commit

Permalink
Don't compound minimum with actual min text size
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jul 11, 2018
1 parent 76c7b8a commit d2555a4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ type entryLayout struct {
// MinSize calculates the minimum size of an entry widget.
// This is based on the contained text with a standard amount of padding added.
func (e *entryLayout) MinSize([]fyne.CanvasObject) fyne.Size {
textSize := fyne.GetDriver().RenderedTextSize("M", e.label.FontSize)
var textSize fyne.Size
if e.label.Text == "" {
textSize = fyne.GetDriver().RenderedTextSize("M", e.label.FontSize)
} else {
textSize = e.label.MinSize()
}

return textSize.Add(e.label.MinSize().Add(fyne.NewSize(theme.Padding()*4, theme.Padding()*2)))
return textSize.Add(fyne.NewSize(theme.Padding()*4, theme.Padding()*2))
}

// Layout the components of the entry widget.
Expand Down

0 comments on commit d2555a4

Please sign in to comment.