finalize work and fix overlay

This commit is contained in:
Ethan Pippin 2022-01-19 14:33:18 -07:00
parent df73265df3
commit 433d4a97be
2 changed files with 17 additions and 17 deletions

View File

@ -52,14 +52,14 @@ struct VLCPlayerOverlayView: View {
// MARK: Top Bar
ZStack {
ZStack(alignment: .center) {
if viewModel.overlayType == .compact {
LinearGradient(gradient: Gradient(colors: [.black.opacity(0.7), .clear]),
LinearGradient(gradient: Gradient(colors: [.black.opacity(0.8), .clear]),
startPoint: .top,
endPoint: .bottom)
.ignoresSafeArea()
.frame(height: 80)
.frame(height: 70)
}
VStack(alignment: .EpisodeSeriesAlignmentGuide) {
@ -78,6 +78,7 @@ struct VLCPlayerOverlayView: View {
Text(viewModel.title)
.font(.title3)
.fontWeight(.bold)
.lineLimit(1)
.alignmentGuide(.EpisodeSeriesAlignmentGuide) { context in
context[.leading]
}
@ -297,12 +298,11 @@ struct VLCPlayerOverlayView: View {
.alignmentGuide(.EpisodeSeriesAlignmentGuide) { context in
context[.leading]
}
.offset(y: -20)
.offset(y: -18)
}
}
.padding(.horizontal, UIDevice.current.userInterfaceIdiom == .pad ? 30 : 0)
}
.padding(.horizontal, UIDevice.current.userInterfaceIdiom == .pad ? 50 : 0)
.padding(.top, UIDevice.current.userInterfaceIdiom == .pad ? 10 : 0)
// MARK: Center
@ -336,10 +336,10 @@ struct VLCPlayerOverlayView: View {
// MARK: Bottom Bar
ZStack {
ZStack(alignment: .center) {
if viewModel.overlayType == .compact {
LinearGradient(gradient: Gradient(colors: [.clear, .black.opacity(0.7)]),
LinearGradient(gradient: Gradient(colors: [.clear, .black.opacity(0.8)]),
startPoint: .top,
endPoint: .bottom)
.ignoresSafeArea()
@ -401,12 +401,10 @@ struct VLCPlayerOverlayView: View {
.accessibilityLabel(L10n.remainingTime)
.accessibilityValue(viewModel.rightLabelText)
}
.padding(.horizontal)
.frame(maxWidth: UIDevice.current.userInterfaceIdiom == .pad ? 800 : nil)
.padding(.horizontal, UIDevice.current.userInterfaceIdiom == .pad ? 30 : 0)
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 10 : 0)
}
.frame(maxHeight: 50)
}
.ignoresSafeArea(edges: .top)
.tint(Color.white)
.foregroundColor(Color.white)
}

View File

@ -151,7 +151,7 @@ class VLCPlayerViewController: UIViewController {
super.viewWillTransition(to: size, with: coordinator)
}
// MARK: subviews
// MARK: VideoContentView
private func makeVideoContentView() -> UIView {
let view = UIView()
@ -161,6 +161,8 @@ class VLCPlayerViewController: UIViewController {
return view
}
// MARK: MainGestureView
private func makeMainGestureView() -> UIView {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
@ -206,11 +208,11 @@ class VLCPlayerViewController: UIViewController {
if gestureRecognizer.state == .began || gestureRecognizer.state == .changed {
pinchScale = gestureRecognizer.scale
} else {
isScreenFilled.toggle()
if pinchScale > 1 {
if pinchScale > 1 && !isScreenFilled {
isScreenFilled.toggle()
fillScreen()
} else {
} else if pinchScale < 1 && isScreenFilled {
isScreenFilled.toggle()
shrinkScreen()
}
}