some formatting stuff i guess
parent
4c484ccd90
commit
605c165523
|
@ -7,10 +7,11 @@
|
|||
|
||||
import GRDB
|
||||
import GRDBQuery
|
||||
import SwiftUIIntrospect
|
||||
import os
|
||||
import SwiftUI
|
||||
import SwiftUIIntrospect
|
||||
import WrappingHStack
|
||||
|
||||
let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "network")
|
||||
|
||||
var currentId: String?
|
||||
|
@ -141,7 +142,6 @@ struct RibbonCrown: View {
|
|||
alignment: .center
|
||||
).foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
|
||||
.contentShape(.dragPreview, RoundedRectangle(cornerRadius: 32))
|
||||
|
||||
.if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
|
||||
|
||||
// .offset(x: 10)
|
||||
|
@ -203,40 +203,39 @@ private struct SegRow: View {
|
|||
var ribbonId: Int64
|
||||
@State var highlights = Set<Int>()
|
||||
|
||||
var body: some View {
|
||||
var body: some View {
|
||||
var segSplit = seg.body.components(separatedBy: ";;")
|
||||
let decoder = JSONDecoder()
|
||||
var retView = WrappingHStack(alignment: .leading, horizontalSpacing: 0) {
|
||||
ForEach(0..<segSplit.count, id: \.self) { segIndex in
|
||||
ForEach(0 ..< segSplit.count, id: \.self) { segIndex in
|
||||
|
||||
let verse = try! decoder.decode(Verse.self, from: segSplit[segIndex].data(using: .utf8)!)
|
||||
let arrayOfText = verse.body.components(separatedBy: " ")
|
||||
|
||||
let lineHeight = CGFloat(30)
|
||||
let fontSize = CGFloat(20)
|
||||
let highlightColor = "470000"
|
||||
|
||||
ForEach(0..<arrayOfText.count, id: \.self) { index in
|
||||
HStack (spacing: 0) {
|
||||
ForEach(0 ..< arrayOfText.count, id: \.self) { index in
|
||||
HStack(spacing: 0) {
|
||||
if index == 0 {
|
||||
|
||||
Text("")
|
||||
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
|
||||
.font(Font.custom("AveriaSerifLibre-Regular", size: fontSize))
|
||||
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
|
||||
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
|
||||
|
||||
VStack (spacing: 0) {
|
||||
VStack(spacing: 0) {
|
||||
ZStack {
|
||||
Text(" ")
|
||||
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
|
||||
.font(Font.custom("AveriaSerifLibre-Regular", size: fontSize))
|
||||
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
|
||||
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
|
||||
Text(String(verse.verse))
|
||||
.font(Font.custom("AveriaSerifLibre-Regular", size: 10))
|
||||
.padding(.horizontal, 0)
|
||||
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
|
||||
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
|
||||
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
|
||||
}
|
||||
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
|
||||
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,12 +243,8 @@ private struct SegRow: View {
|
|||
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
|
||||
.font(Font.custom("AveriaSerifLibre-Regular", size: fontSize))
|
||||
.padding(.horizontal, 1.5) // intra word spacing
|
||||
|
||||
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
|
||||
|
||||
|
||||
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
|
||||
.foregroundColor(Color.white)
|
||||
|
||||
.onTapGesture {
|
||||
Print(arrayOfText[index])
|
||||
Print(verse.verse)
|
||||
|
@ -260,8 +255,9 @@ private struct SegRow: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.frame(height:16) // intra line spacing
|
||||
.padding(.vertical, 0)
|
||||
.frame(height: 16) // intra line spacing
|
||||
.padding(.vertical, 0)
|
||||
// .if( index == 0 ) { $0.offset(x: -6) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -355,10 +351,10 @@ struct ContentView: View {
|
|||
refresh: $refresh,
|
||||
draggedRibbon: draggedRibbon,
|
||||
isDragging: isDragging)
|
||||
.onDrag {
|
||||
.onDrag {
|
||||
self.draggedRibbon = ribbon
|
||||
return NSItemProvider()
|
||||
}
|
||||
}
|
||||
.onDrop(of: [.item],
|
||||
delegate: DropViewDelegate(destinationItem: ribbon,
|
||||
draggedItem: $draggedRibbon,
|
||||
|
@ -493,7 +489,7 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { scrollView in Print("introspect")
|
||||
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { scrollView in Print("introspect")
|
||||
// Print("Scroll delegate offset", scrollDelegate.scrollOffset)
|
||||
|
||||
if setScrollOffset != nil {
|
||||
|
|
Loading…
Reference in New Issue