mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 06:10:32 +05:30
Fix video details offset
This commit is contained in:
parent
676d0f7723
commit
b7f1535942
@ -4,20 +4,20 @@ import SwiftUI
|
|||||||
struct VideoDetailsPaddingModifier: ViewModifier {
|
struct VideoDetailsPaddingModifier: ViewModifier {
|
||||||
static var defaultAdditionalDetailsPadding = 0.0
|
static var defaultAdditionalDetailsPadding = 0.0
|
||||||
|
|
||||||
let geometry: GeometryProxy
|
let playerSize: CGSize
|
||||||
let aspectRatio: Double?
|
let aspectRatio: Double?
|
||||||
let minimumHeightLeft: Double
|
let minimumHeightLeft: Double
|
||||||
let additionalPadding: Double
|
let additionalPadding: Double
|
||||||
let fullScreen: Bool
|
let fullScreen: Bool
|
||||||
|
|
||||||
init(
|
init(
|
||||||
geometry: GeometryProxy,
|
playerSize: CGSize,
|
||||||
aspectRatio: Double? = nil,
|
aspectRatio: Double? = nil,
|
||||||
minimumHeightLeft: Double? = nil,
|
minimumHeightLeft: Double? = nil,
|
||||||
additionalPadding: Double? = nil,
|
additionalPadding: Double? = nil,
|
||||||
fullScreen: Bool = false
|
fullScreen: Bool = false
|
||||||
) {
|
) {
|
||||||
self.geometry = geometry
|
self.playerSize = playerSize
|
||||||
self.aspectRatio = aspectRatio ?? VideoPlayerView.defaultAspectRatio
|
self.aspectRatio = aspectRatio ?? VideoPlayerView.defaultAspectRatio
|
||||||
self.minimumHeightLeft = minimumHeightLeft ?? VideoPlayerView.defaultMinimumHeightLeft
|
self.minimumHeightLeft = minimumHeightLeft ?? VideoPlayerView.defaultMinimumHeightLeft
|
||||||
self.additionalPadding = additionalPadding ?? Self.defaultAdditionalDetailsPadding
|
self.additionalPadding = additionalPadding ?? Self.defaultAdditionalDetailsPadding
|
||||||
@ -33,7 +33,7 @@ struct VideoDetailsPaddingModifier: ViewModifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var playerHeight: Double {
|
var playerHeight: Double {
|
||||||
[geometry.size.width / usedAspectRatio, geometry.size.height - minimumHeightLeft].min()!
|
playerSize.height
|
||||||
}
|
}
|
||||||
|
|
||||||
var topPadding: Double {
|
var topPadding: Double {
|
||||||
|
@ -240,7 +240,7 @@ struct VideoPlayerView: View {
|
|||||||
}
|
}
|
||||||
.background(colorScheme == .dark ? Color.black : Color.white)
|
.background(colorScheme == .dark ? Color.black : Color.white)
|
||||||
.modifier(VideoDetailsPaddingModifier(
|
.modifier(VideoDetailsPaddingModifier(
|
||||||
geometry: geometry,
|
playerSize: player.playerSize,
|
||||||
aspectRatio: player.avPlayerBackend.controller?.aspectRatio,
|
aspectRatio: player.avPlayerBackend.controller?.aspectRatio,
|
||||||
fullScreen: fullScreenDetails
|
fullScreen: fullScreenDetails
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user