added gitignore

undo
saint 2023-11-14 16:39:46 -05:00
parent d623d9c34e
commit f3d52a23f7
3 changed files with 67 additions and 71 deletions

BIN
.DS_Store vendored

Binary file not shown.

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
xcuserdata/ xcuserdata/
build/ build/
.DS_Store

View File

@ -42,31 +42,19 @@ extension UserDefaults {
} }
} }
struct BlueButtonStyle: ButtonStyle { func goToRibbon(selectedRibbon: Ribbon,
func makeBody(configuration: Self.Configuration) -> some View { destRibbon: Ribbon,
configuration.label
.font(.headline)
.frame(width: 100)
.contentShape(Rectangle())
.foregroundColor(configuration.isPressed ? Color.white.opacity(0.5) : Color.black)
.background(configuration.isPressed ? Color.purple.opacity(0.5) : Color.purple)
.listRowBackground(configuration.isPressed ? Color.blue.opacity(0.5) : Color.black)
}
}
func goToRibbon(selectedRibbon: Ribbon,
destRibbon: Ribbon,
scrollId: Binding<String?>, scrollId: Binding<String?>,
scrollOffset: Binding<CGFloat?>, scrollOffset: Binding<CGFloat?>,
refresh: Binding<Bool>, refresh: Binding<Bool>,
showOverlay: Binding<Bool>, showOverlay: Binding<Bool>,
appDatabase: AppDatabase, appDatabase: AppDatabase,
loading: Bool loading: Bool
) )
{ {
Task { Task {
// print("SELECTED RIBBON", selectedRibbon) // print("SELECTED RIBBON", selectedRibbon)
var scrollOffsetToSave = currentOffset var scrollOffsetToSave = currentOffset
var scrollIdToSave = currentId var scrollIdToSave = currentId
@ -74,7 +62,7 @@ func goToRibbon(selectedRibbon: Ribbon,
if (selectedRibbon.id != destRibbon.id! || loading) { if (selectedRibbon.id != destRibbon.id! || loading) {
print("switching ribbons") print("switching ribbons")
// withAnimation(.spring(response: 0.05)) { // withAnimation(.spring(response: 0.05)) {
showOverlay.wrappedValue = true showOverlay.wrappedValue = true
// } // }
@ -121,6 +109,7 @@ func goToRibbon(selectedRibbon: Ribbon,
// print("scrollIdToSave: ", scrollIdToSave) // print("scrollIdToSave: ", scrollIdToSave)
} }
} }
extension View { extension View {
@ViewBuilder @ViewBuilder
func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View { func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View {
@ -151,32 +140,40 @@ struct RibbonCrown : View {
var body: some View { var body: some View {
ZStack { ZStack {
MyIcon().frame(width: CGFloat(100 * 1.66 * scale), height: CGFloat(100 * scale), alignment: .center) .foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4))) MyIcon().frame(
width: CGFloat(100 * 1.66 * scale),
height: CGFloat(100 * scale),
alignment: .center
) .foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
.if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) } .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
.offset(x: 10) // .offset(x: 10)
Text(ribbon.title) Text(ribbon.title)
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00))) .foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
// .foregroundColor(.white)) // .foregroundColor(.white))
// .foregroundColor(.black) // .foregroundColor(.black)
.frame(minWidth: CGFloat(70), maxWidth: CGFloat(70), minHeight: height, maxHeight: height, alignment: .center) .frame(minWidth: CGFloat(70),
maxWidth: CGFloat(70),
minHeight: height,
maxHeight: height,
alignment: .center)
.if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
// .if(!isDragging || draggedRibbon == nil || draggedRibbon!.id != ribbon.id) { $0.background(Color(red: 0.1, green: 0.1, blue: 0.1)) } .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
// .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id) { $0.background(.red) }
.background(Color(red: 0.1, green: 0.1, blue: 0.1)) // .if(!isDragging || draggedRibbon == nil || draggedRibbon!.id != ribbon.id) { $0.background(Color(red: 0.1, green: 0.1, blue: 0.1)) }
.offset(x: 10) // .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id) { $0.background(.red) }
// .background(Color(red: 0.1, green: 0.1, blue: 0.1)) .background(Color(red: 0.1, green: 0.1, blue: 0.1))
// .background(.red) // .offset(x: 10)
// .background(.yellow) // .background(Color(red: 0.1, green: 0.1, blue: 0.1))
.multilineTextAlignment(.center) // .background(.red)
// .minimumScaleFactor(0.5) // .background(.yellow)
// .padding([.top, .bottom], 10) .multilineTextAlignment(.center)
.font(Font.custom("AveriaSerifLibre-Regular", size: CGFloat(10))) // .minimumScaleFactor(0.5)
// .padding([.top, .bottom], 10)
.font(Font.custom("AveriaSerifLibre-Regular", size: CGFloat(10)))
} }
.frame(width: CGFloat(100 * 1.66 * scale + 10 ), height:CGFloat(100 * scale + 5)) .frame(width: CGFloat(100 * 1.66 * scale + 10 ), height:CGFloat(100 * scale + 5))
@ -278,7 +275,7 @@ struct ContentView: View {
@State var pulledOut = CGSize.zero @State var pulledOut = CGSize.zero
@State var taskTitle : String = "FIRST DOGGG" @State var taskTitle : String = "FIRST DOGGG"
@State var curBook : String = "Matthew" @State var curBook : String = "Matthew"
@State var selectedLine : Int64? @State var selectedLine : Int64?
@State var thisScrollView : UIScrollView? @State var thisScrollView : UIScrollView?
@State var scrollUpdate = false @State var scrollUpdate = false
@ -309,14 +306,14 @@ struct ContentView: View {
@State var readOffset = CGPoint() @State var readOffset = CGPoint()
@State var dragOffset = CGFloat() @State var dragOffset = CGFloat()
@State var refresh: Bool = false @State var refresh: Bool = false
@State var refresh2: Bool = false @State var refresh2: Bool = false
@State var draggedRibbon: Ribbon? @State var draggedRibbon: Ribbon?
@State var isDragging = false @State var isDragging = false
@State var reorder = true @State var reorder = true
@ -324,7 +321,7 @@ struct ContentView: View {
@Query<SelectedRibbonRequest> var selectedRibbon: [Ribbon] @Query<SelectedRibbonRequest> var selectedRibbon: [Ribbon]
// @Query(RibbonRequest(id: Int64(UserDefaults.standard.optionalInt(forKey: "lastRibbonId") ?? 1))) private var selectedRibbon: [Ribbon] // @Query(RibbonRequest(id: Int64(UserDefaults.standard.optionalInt(forKey: "lastRibbonId") ?? 1))) private var selectedRibbon: [Ribbon]
init() { init() {
UITableView.appearance().backgroundColor = UIColor(Color(red: 0.2, green: 0.2, blue: 0.2)) UITableView.appearance().backgroundColor = UIColor(Color(red: 0.2, green: 0.2, blue: 0.2))
@ -332,7 +329,7 @@ struct ContentView: View {
// self._scrollDelegate = State(initialValue: ScrollViewHandler()) // self._scrollDelegate = State(initialValue: ScrollViewHandler())
} }
var body: some View { var body: some View {
// Print("rendering") // Print("rendering")
@ -363,17 +360,17 @@ struct ContentView: View {
draggedRibbon: draggedRibbon, draggedRibbon: draggedRibbon,
isDragging: isDragging isDragging: isDragging
) )
// .offset(x: 6, y: 6)
.onDrag { .onDrag {
self.draggedRibbon = ribbon self.draggedRibbon = ribbon
return NSItemProvider() return NSItemProvider()
} }
.onDrop(of: [.item], .onDrop(of: [.item],
delegate: DropViewDelegate(destinationItem: ribbon, delegate: DropViewDelegate(destinationItem: ribbon,
draggedItem: $draggedRibbon, draggedItem: $draggedRibbon,
isDragging: $isDragging, isDragging: $isDragging,
appDatabase: appDatabase) appDatabase: appDatabase)
) )
.offset(x: 6, y: 6)
} }
@ -517,7 +514,7 @@ struct ContentView: View {
if (setScrollOffset != nil) { if (setScrollOffset != nil) {
// Print("Setting scroll offset in introspect", setScrollOffset) // Print("Setting scroll offset in introspect", setScrollOffset)
DispatchQueue.main.async { DispatchQueue.main.async {
scrollView.contentOffset.y = scrollView.contentOffset.y + setScrollOffset! scrollView.contentOffset.y = scrollView.contentOffset.y + setScrollOffset!
setScrollOffset = nil setScrollOffset = nil
withAnimation { withAnimation {
@ -538,7 +535,7 @@ struct ContentView: View {
} }
.zIndex(1) .zIndex(1)
.background(Color(red: 0.2, green: 0.2, blue: 0.2)) .background(Color(red: 0.2, green: 0.2, blue: 0.2))
.frame(width: geometry.size.width - 50, height: geometry.size.height / 2 - vertSep) .frame(width: geometry.size.width - 50, height: geometry.size.height / 2 - vertSep)
.offset(x:30 , y:0) .offset(x:30 , y:0)
.offset(x: pulledOut.width) .offset(x: pulledOut.width)
.offset(x: viewState.width, y: viewState.height) .offset(x: viewState.width, y: viewState.height)
@ -734,7 +731,7 @@ struct ContentView: View {
// if (setScrollOffset != nil) { // if (setScrollOffset != nil) {
// // Print("Setting scroll offset in introspect", setScrollOffset) // // Print("Setting scroll offset in introspect", setScrollOffset)
// DispatchQueue.main.async { // DispatchQueue.main.async {
// scrollView.contentOffset.y = scrollView.contentOffset.y + setScrollOffset! // scrollView.contentOffset.y = scrollView.contentOffset.y + setScrollOffset!
// setScrollOffset = nil // setScrollOffset = nil
// withAnimation { // withAnimation {
@ -797,23 +794,21 @@ struct ContentView: View {
} }
if (showOverlay) { if (showOverlay) {
Rectangle() Rectangle()
.frame(width: geometry.size.width - 50, height: geometry.size.height + 200) .frame(width: geometry.size.width - 50, height: geometry.size.height + 200)
.background(.ultraThinMaterial) .background(.ultraThinMaterial)
//.blur(radius: 0.8) //.blur(radius: 0.8)
.offset(x:30, y:-100 ) .offset(x:30, y:-100 )
.opacity(0.98) .opacity(0.98)
.transition(.opacity) .transition(.opacity)
// .frame(width: geometry.size.width - 50) // .frame(width: geometry.size.width - 50)
.offset(x: pulledOut.width) .offset(x: pulledOut.width)
.offset(x: viewState.width, y: viewState.height) .offset(x: viewState.width, y: viewState.height)
.zIndex(2)
.zIndex(2)
} }
} }
@ -843,12 +838,12 @@ struct ContentView: View {
// } // }
// printCount += 1 // printCount += 1
// if (currentId != nil) { // if (currentId != nil) {
// currentOffset = tracker.visibleViews[currentId!]! // currentOffset = tracker.visibleViews[currentId!]!
// } // }
let visibleViews2 = Array(tracker.visibleViews.keys) let visibleViews2 = Array(tracker.visibleViews.keys)
if (visibleViews2.count == 0) { if (visibleViews2.count == 0) {
return return
} }
@ -900,13 +895,13 @@ struct DropViewDelegate2: DropDelegate {
} }
struct DropViewDelegate: DropDelegate { struct DropViewDelegate: DropDelegate {
let destinationItem: Ribbon let destinationItem: Ribbon
// @Binding var colors: [Color] // @Binding var colors: [Color]
@Binding var draggedItem: Ribbon? @Binding var draggedItem: Ribbon?
@Binding var isDragging: Bool @Binding var isDragging: Bool
let appDatabase: AppDatabase let appDatabase: AppDatabase
func dropUpdated(info: DropInfo) -> DropProposal? { func dropUpdated(info: DropInfo) -> DropProposal? {
return DropProposal(operation: .move) return DropProposal(operation: .move)
} }
@ -924,12 +919,12 @@ struct DropViewDelegate: DropDelegate {
return return
} }
if disableDrop { if disableDrop {
return; return;
} }
var newRibbon = draggedItem! var newRibbon = draggedItem!
var newDest = destinationItem var newDest = destinationItem
var oldPos = draggedItem!.pos var oldPos = draggedItem!.pos
@ -957,7 +952,7 @@ struct DropViewDelegate: DropDelegate {
// draggedItem = nil // draggedItem = nil
} }
} }
func performDrop(info: DropInfo) -> Bool { func performDrop(info: DropInfo) -> Bool {
print("PERFORMED DROPPPP") print("PERFORMED DROPPPP")
draggedItem = nil draggedItem = nil