Enforce fixed Upscale split ratio
This commit is contained in:
parent
b80982b494
commit
8bc621b583
18
main.go
18
main.go
|
|
@ -146,24 +146,14 @@ func (l *fixedHSplitLayout) Layout(objects []fyne.CanvasObject, size fyne.Size)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
minLead := float64(lead.MinSize().Width)
|
|
||||||
minTrail := float64(trail.MinSize().Width)
|
|
||||||
ratio := float64(l.ratio)
|
ratio := float64(l.ratio)
|
||||||
if ratio <= 0 {
|
if ratio <= 0 {
|
||||||
ratio = 0.6
|
ratio = 0.6
|
||||||
}
|
}
|
||||||
|
if ratio < 0.1 {
|
||||||
min := minLead / total
|
ratio = 0.1
|
||||||
max := 1 - (minTrail / total)
|
} else if ratio > 0.9 {
|
||||||
if min <= max {
|
ratio = 0.9
|
||||||
if ratio < min {
|
|
||||||
ratio = min
|
|
||||||
}
|
|
||||||
if ratio > max {
|
|
||||||
ratio = max
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ratio = minLead / (minLead + minTrail)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leadWidth := float32(total * ratio)
|
leadWidth := float32(total * ratio)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user