Clamp player layout aspect and size

This commit is contained in:
Stu Leak 2026-01-07 13:51:29 -05:00
parent a8d2096686
commit d4f75832e4

View File

@ -10661,13 +10661,18 @@ func buildVideoPane(state *appState, min fyne.Size, src *videoSource, onCover fu
if src != nil && src.Width > 0 && src.Height > 0 { if src != nil && src.Width > 0 && src.Height > 0 {
defaultAspect = float64(src.Width) / float64(src.Height) defaultAspect = float64(src.Width) / float64(src.Height)
} }
if defaultAspect < 0.6 {
defaultAspect = 0.6
} else if defaultAspect > 2.4 {
defaultAspect = 2.4
}
targetWidth := float32(min.Width) targetWidth := float32(min.Width)
targetHeight := float32(min.Height) targetHeight := float32(min.Height)
if targetWidth <= 0 { if targetWidth <= 0 {
targetWidth = 320 targetWidth = 480
} }
if targetHeight <= 0 { if targetHeight <= 0 {
targetHeight = 180 targetHeight = 360
} }
aspect := float32(defaultAspect) aspect := float32(defaultAspect)
stageWidth := targetWidth stageWidth := targetWidth