Skip to content

Commit

Permalink
Fix for text widgets not correctly aligning or showing
Browse files Browse the repository at this point in the history
Two different fixes - first was to resize text provider.
Second was to stop cascading Hidden flag - the driver does this now
  • Loading branch information
andydotxyz committed Apr 14, 2020
1 parent 3dc5dc4 commit 7a54721
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions widget/hyperlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ func (hl *Hyperlink) Cursor() desktop.Cursor {
return desktop.PointerCursor
}

// Resize sets a new size for the hyperlink.
// Note this should not be used if the widget is being managed by a Layout within a Container.
func (hl *Hyperlink) Resize(size fyne.Size) {
hl.BaseWidget.Resize(size)
hl.provider.Resize(size)
}

// SetText sets the text of the hyperlink
func (hl *Hyperlink) SetText(text string) {
hl.Text = text
Expand Down
7 changes: 7 additions & 0 deletions widget/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ func (l *Label) Refresh() {
l.BaseWidget.Refresh()
}

// Resize sets a new size for the label.
// Note this should not be used if the widget is being managed by a Layout within a Container.
func (l *Label) Resize(size fyne.Size) {
l.BaseWidget.Resize(size)
l.provider.Resize(size)
}

// SetText sets the text of the label
func (l *Label) SetText(text string) {
l.Text = text
Expand Down
1 change: 0 additions & 1 deletion widget/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ func (r *textRenderer) Refresh() {

textCanvas.Alignment = r.provider.presenter.textAlign()
textCanvas.TextStyle = r.provider.presenter.textStyle()
textCanvas.Hidden = r.provider.Hidden

if add {
r.texts = append(r.texts, textCanvas)
Expand Down

0 comments on commit 7a54721

Please sign in to comment.