65 lines
1.9 KiB
Swift
65 lines
1.9 KiB
Swift
//
|
|
// TeleprompterView.swift
|
|
// OnCue
|
|
//
|
|
// Created by Pradyun Setti on 22/06/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
import SwiftData
|
|
|
|
struct TeleprompterView: View {
|
|
let project: OCProject
|
|
|
|
@State private var textSize = 45.0
|
|
@State private var horizPadding = 15.0
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
Text(project.script)
|
|
.font(.system(size: textSize))
|
|
.padding(.horizontal, horizPadding)
|
|
}
|
|
// AutoScrollView {
|
|
// Text(project.script)
|
|
// .font(.system(size: textSize))
|
|
// .padding(.horizontal, horizPadding)
|
|
// }
|
|
.toolbar {
|
|
ToolbarItem(placement: .topBarTrailing) {
|
|
Menu { overflowMenu } label: {
|
|
Image(systemName: "ellipsis.circle")
|
|
}
|
|
|
|
}
|
|
ToolbarItem(placement: .topBarTrailing) {
|
|
NavigationLink(destination: { CardsView(project: project) }) {
|
|
Image(systemName: "stop.fill")
|
|
}
|
|
}
|
|
}
|
|
.persistentSystemOverlays(.hidden)
|
|
}
|
|
|
|
var overflowMenu: some View {
|
|
VStack {
|
|
Menu { Stepper("\(textSize.formatted())", value: $textSize, in: 12...150) } label: {
|
|
Label("Text Size", systemImage: "textformat.size")
|
|
}
|
|
Menu { Stepper("\(horizPadding.formatted())", value: $horizPadding, in: 0...150, step: 5) } label: {
|
|
Label("Margin", systemImage: "rectangle.portrait.arrowtriangle.2.inward")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
let config = ModelConfiguration(isStoredInMemoryOnly: true)
|
|
let container = try! ModelContainer(for: OCProject.self, configurations: config)
|
|
|
|
container.mainContext.insert(PreviewData.project)
|
|
|
|
return TeleprompterView(project: PreviewData.project)
|
|
.modelContainer(container)
|
|
}
|