fix: window minimum, stock spacing layout, sidebar width floor
Part A stages 1-3 of the GUI layout cleanup plan: - Stage 1 (F1-F3): delete settingsControlWidth's redundant wrapper (the Border centre slot already stretches controls), truncate the config path label, and name the default window size so it can be asserted against. Settings no longer widens the window past what it asks for. - Stage 2 (F4-F5): drop compactVBoxLayout for the stock layout.NewCustomPaddedVBoxLayout and a single derived rowOverlap() spacing, replacing three hand-tuned spacing constants. - Stage 3 (F7): delete the inert 400px sidebar width floor; the Border left slot already renders it at content MinSize. See docs/PLAN-gui-layout.md.
This commit is contained in:
+7
-41
@@ -37,47 +37,13 @@ func (l minWidthLayout) Layout(objects []fyne.CanvasObject, size fyne.Size) {
|
||||
}
|
||||
}
|
||||
|
||||
// compactVBoxLayout stacks children vertically with a configurable gap between
|
||||
// them, producing tighter rows than container.NewVBox (which inserts
|
||||
// theme.Padding() between every child). A negative spacing pulls neighbouring
|
||||
// rows together so they overlap the labels' built-in vertical padding, which is
|
||||
// how the details metadata is condensed to fit 720p screens.
|
||||
type compactVBoxLayout struct {
|
||||
spacing float32
|
||||
}
|
||||
|
||||
func (l compactVBoxLayout) MinSize(objects []fyne.CanvasObject) fyne.Size {
|
||||
var w, h float32
|
||||
var visible int
|
||||
for _, o := range objects {
|
||||
if !o.Visible() {
|
||||
continue
|
||||
}
|
||||
min := o.MinSize()
|
||||
if min.Width > w {
|
||||
w = min.Width
|
||||
}
|
||||
h += min.Height
|
||||
visible++
|
||||
}
|
||||
if visible > 1 {
|
||||
h += l.spacing * float32(visible-1)
|
||||
}
|
||||
return fyne.NewSize(w, h)
|
||||
}
|
||||
|
||||
func (l compactVBoxLayout) Layout(objects []fyne.CanvasObject, size fyne.Size) {
|
||||
var y float32
|
||||
for _, o := range objects {
|
||||
if !o.Visible() {
|
||||
continue
|
||||
}
|
||||
h := o.MinSize().Height
|
||||
o.Move(fyne.NewPos(0, y))
|
||||
o.Resize(fyne.NewSize(size.Width, h))
|
||||
y += h + l.spacing
|
||||
}
|
||||
}
|
||||
// rowOverlap is the (negative) gap that pulls stacked label rows together by
|
||||
// exactly one label's vertical inner padding. Two adjacent labels each inset
|
||||
// their text by theme.InnerPadding(), so the whitespace between two lines of
|
||||
// text is double what a single row needs; removing one label's worth
|
||||
// condenses the block without letting the text lines touch. Derived rather
|
||||
// than hard-coded so it follows a theme that changes SizeNameInnerPadding.
|
||||
func rowOverlap() float32 { return -theme.InnerPadding() }
|
||||
|
||||
// fixedHeightLayout forces its contents to a fixed height while leaving the
|
||||
// width to the parent container. It is used to reserve a stable amount of space
|
||||
|
||||
Reference in New Issue
Block a user