added some back arrows and start of custom picker
parent
32696d7b58
commit
4dfc93ea90
|
@ -0,0 +1,55 @@
|
||||||
|
//
|
||||||
|
// BackButton.swift
|
||||||
|
// gloss
|
||||||
|
//
|
||||||
|
// Created by Saint on 5/27/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SwiftUI
|
||||||
|
struct BackArrow: Shape {
|
||||||
|
func path(in rect: CGRect) -> Path {
|
||||||
|
var path = Path()
|
||||||
|
let width = rect.size.width
|
||||||
|
let height = rect.size.height
|
||||||
|
path.move(to: CGPoint(x: 0.83333*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.83333*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.25*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.25*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.16667*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.16667*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.25*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.25*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.83333*width, y: 0.45833*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.41667*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.29167*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.41667*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.20833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.20833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.29167*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.41667*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.33333*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.70833*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.41667*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.79167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.79167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.41667*width, y: 0.70833*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
//
|
||||||
|
// ForwardArrow.swift
|
||||||
|
// gloss
|
||||||
|
//
|
||||||
|
// Created by Saint on 5/27/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct ForwardArrow: Shape {
|
||||||
|
func path(in rect: CGRect) -> Path {
|
||||||
|
var path = Path()
|
||||||
|
let width = rect.size.width
|
||||||
|
let height = rect.size.height
|
||||||
|
path.move(to: CGPoint(x: 0.16667*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.16667*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.75*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.75*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.83333*width, y: 0.54167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.83333*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.75*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.75*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.45833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.16667*width, y: 0.45833*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.58333*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.375*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.29167*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.58333*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.29167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.20833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.20833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.29167*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.58333*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.66667*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.625*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.70833*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
path.move(to: CGPoint(x: 0.58333*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.70833*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.5*width, y: 0.79167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.79167*height))
|
||||||
|
path.addLine(to: CGPoint(x: 0.58333*width, y: 0.70833*height))
|
||||||
|
path.closeSubpath()
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,8 @@
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
851259B02C05281300BE70F8 /* BackButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 851259AF2C05281300BE70F8 /* BackButton.swift */; };
|
||||||
|
851259B22C05299200BE70F8 /* ForwardArrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 851259B12C05299200BE70F8 /* ForwardArrow.swift */; };
|
||||||
8514D5BC299EFB780054F185 /* store.db in Resources */ = {isa = PBXBuildFile; fileRef = 8514D5BB299EFB780054F185 /* store.db */; };
|
8514D5BC299EFB780054F185 /* store.db in Resources */ = {isa = PBXBuildFile; fileRef = 8514D5BB299EFB780054F185 /* store.db */; };
|
||||||
8514D5BF299F04710054F185 /* GRDB in Frameworks */ = {isa = PBXBuildFile; productRef = 8514D5BE299F04710054F185 /* GRDB */; };
|
8514D5BF299F04710054F185 /* GRDB in Frameworks */ = {isa = PBXBuildFile; productRef = 8514D5BE299F04710054F185 /* GRDB */; };
|
||||||
852774C129A150B100458CA7 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = 852774C029A150B100458CA7 /* Line.swift */; };
|
852774C129A150B100458CA7 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = 852774C029A150B100458CA7 /* Line.swift */; };
|
||||||
|
@ -45,6 +47,8 @@
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
851259AF2C05281300BE70F8 /* BackButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackButton.swift; sourceTree = "<group>"; };
|
||||||
|
851259B12C05299200BE70F8 /* ForwardArrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardArrow.swift; sourceTree = "<group>"; };
|
||||||
8514D5BB299EFB780054F185 /* store.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = store.db; sourceTree = "<group>"; };
|
8514D5BB299EFB780054F185 /* store.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = store.db; sourceTree = "<group>"; };
|
||||||
852774C029A150B100458CA7 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
852774C029A150B100458CA7 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
||||||
8528897429B2B86B003F2E16 /* CrownOfThorns.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrownOfThorns.swift; sourceTree = "<group>"; };
|
8528897429B2B86B003F2E16 /* CrownOfThorns.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrownOfThorns.swift; sourceTree = "<group>"; };
|
||||||
|
@ -108,6 +112,8 @@
|
||||||
85431A7C2905F4F500EE0760 = {
|
85431A7C2905F4F500EE0760 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
851259B12C05299200BE70F8 /* ForwardArrow.swift */,
|
||||||
|
851259AF2C05281300BE70F8 /* BackButton.swift */,
|
||||||
857C34482BFB7DC800661A63 /* Fenestra.swift */,
|
857C34482BFB7DC800661A63 /* Fenestra.swift */,
|
||||||
8594ED972BF6845F001213F2 /* HexColor.swift */,
|
8594ED972BF6845F001213F2 /* HexColor.swift */,
|
||||||
85E00E7B29F34D2D00FF9E78 /* ScrollState.swift */,
|
85E00E7B29F34D2D00FF9E78 /* ScrollState.swift */,
|
||||||
|
@ -285,6 +291,7 @@
|
||||||
857C34492BFB7DC800661A63 /* Fenestra.swift in Sources */,
|
857C34492BFB7DC800661A63 /* Fenestra.swift in Sources */,
|
||||||
85942EEB29AD55A400307621 /* RibbonRequest.swift in Sources */,
|
85942EEB29AD55A400307621 /* RibbonRequest.swift in Sources */,
|
||||||
85431A8B2905F4F500EE0760 /* ContentView.swift in Sources */,
|
85431A8B2905F4F500EE0760 /* ContentView.swift in Sources */,
|
||||||
|
851259B02C05281300BE70F8 /* BackButton.swift in Sources */,
|
||||||
85942EF529B108C600307621 /* Seg.swift in Sources */,
|
85942EF529B108C600307621 /* Seg.swift in Sources */,
|
||||||
85E00E7C29F34D2D00FF9E78 /* ScrollState.swift in Sources */,
|
85E00E7C29F34D2D00FF9E78 /* ScrollState.swift in Sources */,
|
||||||
8594ED982BF6845F001213F2 /* HexColor.swift in Sources */,
|
8594ED982BF6845F001213F2 /* HexColor.swift in Sources */,
|
||||||
|
@ -301,6 +308,7 @@
|
||||||
8528897C29BD69B2003F2E16 /* VisibilityTrackingScrollView.swift in Sources */,
|
8528897C29BD69B2003F2E16 /* VisibilityTrackingScrollView.swift in Sources */,
|
||||||
85942EF929B1150B00307621 /* SegDenorm.swift in Sources */,
|
85942EF929B1150B00307621 /* SegDenorm.swift in Sources */,
|
||||||
85431A9C2905F5D800EE0760 /* SwiftUIView.swift in Sources */,
|
85431A9C2905F5D800EE0760 /* SwiftUIView.swift in Sources */,
|
||||||
|
851259B22C05299200BE70F8 /* ForwardArrow.swift in Sources */,
|
||||||
8528897E29BD69B2003F2E16 /* VisibilityTracker.swift in Sources */,
|
8528897E29BD69B2003F2E16 /* VisibilityTracker.swift in Sources */,
|
||||||
85942EF729B108EA00307621 /* SegDenormRequest.swift in Sources */,
|
85942EF729B108EA00307621 /* SegDenormRequest.swift in Sources */,
|
||||||
8528897D29BD69B2003F2E16 /* VisibilityTrackingModifier.swift in Sources */,
|
8528897D29BD69B2003F2E16 /* VisibilityTrackingModifier.swift in Sources */,
|
||||||
|
|
|
@ -205,14 +205,13 @@ struct ContentView: View {
|
||||||
@State var viewState = CGSize.zero
|
@State var viewState = CGSize.zero
|
||||||
@State var pulledOut = CGSize.zero
|
@State var pulledOut = CGSize.zero
|
||||||
|
|
||||||
|
@State var selection = 0
|
||||||
|
|
||||||
@StateObject var paneConnector = PaneConnector()
|
@StateObject var paneConnector = PaneConnector()
|
||||||
|
|
||||||
@State var refresh: Bool = false
|
@State var refresh: Bool = false
|
||||||
|
|
||||||
@State var endedDrag = true
|
|
||||||
|
|
||||||
@State var readOffset = CGPoint()
|
@State var readOffset = CGPoint()
|
||||||
@State var dragOffset = CGFloat()
|
|
||||||
|
|
||||||
@Query(SegDenormRequest(book: "bible.john")) private var segs: [SegDenorm]
|
@Query(SegDenormRequest(book: "bible.john")) private var segs: [SegDenorm]
|
||||||
|
|
||||||
|
@ -269,6 +268,54 @@ struct ContentView: View {
|
||||||
.background(Color(red: 0.1, green: 0.1, blue: 0.1))
|
.background(Color(red: 0.1, green: 0.1, blue: 0.1))
|
||||||
.frame(alignment: .topLeading)
|
.frame(alignment: .topLeading)
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
HStack {
|
||||||
|
BackArrow()
|
||||||
|
.frame(width: CGFloat(30), height: CGFloat(30))
|
||||||
|
.scaledToFit()
|
||||||
|
.foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
|
||||||
|
.tag(0)
|
||||||
|
|
||||||
|
ForwardArrow()
|
||||||
|
.frame(width: CGFloat(30), height: CGFloat(30))
|
||||||
|
.foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
|
||||||
|
.tag(1)
|
||||||
|
|
||||||
|
Text("cat")
|
||||||
|
.foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
|
||||||
|
.tag(2)
|
||||||
|
}
|
||||||
|
.cornerRadius(15)
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
BackArrow()
|
||||||
|
.frame(width: CGFloat(30), height: CGFloat(30))
|
||||||
|
.foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
|
||||||
|
.if(selection == 0) { $0.background(Color.white) }
|
||||||
|
.if(selection != 0) { $0.background(Color.black) }
|
||||||
|
.onTapGesture {
|
||||||
|
withAnimation(.spring(response: 0.2)) {
|
||||||
|
self.selection = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ForwardArrow()
|
||||||
|
.frame(width: CGFloat(30), height: CGFloat(30))
|
||||||
|
.foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
|
||||||
|
.if(selection == 1) { $0.background(Color.white) }
|
||||||
|
.if(selection != 1) { $0.background(Color.black) }
|
||||||
|
.onTapGesture {
|
||||||
|
withAnimation(.spring(response: 0.2)) {
|
||||||
|
self.selection = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.background(Color.black)
|
||||||
|
.cornerRadius(5)
|
||||||
|
}
|
||||||
|
.offset(x: geometry.size.width - 300)
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
// Top pane
|
// Top pane
|
||||||
Pane(paneConnector: paneConnector,
|
Pane(paneConnector: paneConnector,
|
||||||
|
@ -332,33 +379,30 @@ struct ContentView: View {
|
||||||
DragGesture()
|
DragGesture()
|
||||||
.onChanged { gesture in
|
.onChanged { gesture in
|
||||||
|
|
||||||
if endedDrag {
|
print(viewState.width)
|
||||||
endedDrag = false
|
print(pulledOut.width)
|
||||||
|
// threshold of how much to swipe before the view drags
|
||||||
//TODO: should this still be adjusted
|
if abs(gesture.translation.width) > 10 {
|
||||||
//scrollOffset = readOffset.y - 20
|
|
||||||
}
|
|
||||||
Print(viewState.width)
|
|
||||||
if abs(gesture.translation.width) > 20 {
|
|
||||||
viewState.width = gesture.translation.width
|
viewState.width = gesture.translation.width
|
||||||
if gesture.translation.width < -50, pulledOut.width == CGFloat(0) {
|
// if gesture.translation.width < -50, pulledOut.width == CGFloat(0) {
|
||||||
dragOffset = gesture.translation.width + 50
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onEnded { _ in
|
.onEnded { _ in
|
||||||
endedDrag = true
|
var setPulledOutWith = CGFloat(0)
|
||||||
var pulledOutWidth = CGFloat(0)
|
if viewState.width < 0 && pulledOut.width > 0 {
|
||||||
if viewState.width < 0 {
|
setPulledOutWith = CGFloat(0)
|
||||||
pulledOutWidth = CGFloat(0)
|
} else if viewState.width > 0 && pulledOut.width < 0 {
|
||||||
|
setPulledOutWith = CGFloat(0)
|
||||||
|
} else if viewState.width < 0 && pulledOut.width == 0 {
|
||||||
|
setPulledOutWith = CGFloat(-200)
|
||||||
} else if abs(viewState.width + pulledOut.width) > 30 {
|
} else if abs(viewState.width + pulledOut.width) > 30 {
|
||||||
pulledOutWidth = CGFloat(200)
|
setPulledOutWith = CGFloat(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
withAnimation(.spring(response: 0.2)) {
|
withAnimation(.spring(response: 0.2)) {
|
||||||
pulledOut.width = pulledOutWidth
|
pulledOut.width = setPulledOutWith
|
||||||
viewState = .zero
|
viewState = .zero
|
||||||
dragOffset = .zero
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue