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