New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RagioGroup miscalulates label widths in horizontal mode #3386
Labels
bug
Something isn't working
Comments
grkuntzmd
changed the title
RagioGroup miscalulated label widths in horizontal mode
RagioGroup miscalulates label widths in horizontal mode
Nov 7, 2022
The RadioGroup Layout method is using the average minimum width of its items instead of the largest minimum width. If you have several small labels and one large label, the average minimum width will be smaller than the minimum width of the large label, causing it to overlap the next label. // MinSize calculates the minimum size of a radio item.
// This is based on the contained text, the radio icon and a standard amount of padding
// between each item.
func (r *radioGroupRenderer) MinSize() fyne.Size {
width := float32(0)
height := float32(0)
maxMinWidth := float32(0)
if r.radio.Horizontal {
for _, item := range r.items {
itemMin := item.MinSize()
maxMinWidth = fyne.Max(maxMinWidth, itemMin.Width)
}
}
for _, item := range r.items {
itemMin := item.MinSize()
if r.radio.Horizontal {
height = fyne.Max(height, itemMin.Height)
width += maxMinWidth
// width += itemMin.Width
} else {
width = fyne.Max(width, itemMin.Width)
height += itemMin.Height
}
}
return fyne.NewSize(width, height)
} |
grkuntzmd
added a commit
to grkuntzmd/fyne
that referenced
this issue
Nov 9, 2022
andydotxyz
added a commit
to andydotxyz/fyne
that referenced
this issue
Mar 26, 2023
3 tasks
Fixed on develop |
andydotxyz
added a commit
that referenced
this issue
Apr 28, 2023
Jacalz
added
bug
Something isn't working
and removed
unverified
A bug that has been reported but not verified
labels
Jun 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
Describe the bug
When long labels are used in the RagioGroup in horizontal mode, they overlap.
How to reproduce
go run .
Screenshots
Example code
Fyne version
2.2.3
Go compiler version
1.19.3
Operating system
Windows
Operating system version
Windows 11 Pro Version 22H2
Additional Information
No response
The text was updated successfully, but these errors were encountered: