Clamp player layout aspect and size
This commit is contained in:
parent
a8d2096686
commit
d4f75832e4
9
main.go
9
main.go
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user