mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
Merge pull request #562 from stonerl/honor-aspect-ratio
honour the aspect ratio when resizing
This commit is contained in:
commit
23f5fc9575
@ -27,10 +27,7 @@ struct VideoPlayerSizeModifier: ViewModifier {
|
|||||||
content
|
content
|
||||||
.frame(width: geometry.size.width)
|
.frame(width: geometry.size.width)
|
||||||
.frame(maxHeight: maxHeight)
|
.frame(maxHeight: maxHeight)
|
||||||
|
|
||||||
#if !os(macOS)
|
|
||||||
.aspectRatio(ratio, contentMode: usedAspectRatioContentMode)
|
.aspectRatio(ratio, contentMode: usedAspectRatioContentMode)
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ratio: CGFloat? { // swiftlint:disable:this no_cgfloat
|
var ratio: CGFloat? { // swiftlint:disable:this no_cgfloat
|
||||||
@ -46,10 +43,10 @@ struct VideoPlayerSizeModifier: ViewModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var usedAspectRatioContentMode: ContentMode {
|
var usedAspectRatioContentMode: ContentMode {
|
||||||
#if os(iOS)
|
#if os(tvOS)
|
||||||
fullScreen ? .fill : .fit
|
|
||||||
#else
|
|
||||||
.fit
|
.fit
|
||||||
|
#else
|
||||||
|
fullScreen ? .fill : .fit
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ struct VideoPlayerView: View {
|
|||||||
static let defaultAspectRatio = 16 / 9.0
|
static let defaultAspectRatio = 16 / 9.0
|
||||||
static var defaultMinimumHeightLeft: Double {
|
static var defaultMinimumHeightLeft: Double {
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
300
|
335
|
||||||
#else
|
#else
|
||||||
200
|
200
|
||||||
#endif
|
#endif
|
||||||
@ -156,7 +156,7 @@ struct VideoPlayerView: View {
|
|||||||
.persistentSystemOverlays(!fullScreenPlayer)
|
.persistentSystemOverlays(!fullScreenPlayer)
|
||||||
#endif
|
#endif
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
.frame(minWidth: 1100, minHeight: 700)
|
.frame(minWidth: playerSidebar != .never ? 1100 : 650, minHeight: 700)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user