builds
							parent
							
								
									4154f8f46d
								
							
						
					
					
						commit
						1275ad4f96
					
				| 
						 | 
					@ -59,6 +59,7 @@ func goToRibbon(selectedRibbon: Ribbon,
 | 
				
			||||||
            print("switching ribbons")
 | 
					            print("switching ribbons")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            paneConnector.wrappedValue.showOverlay = true
 | 
					            paneConnector.wrappedValue.showOverlay = true
 | 
				
			||||||
 | 
					            showOverlay.wrappedValue = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if loading {
 | 
					            if loading {
 | 
				
			||||||
                paneConnector.wrappedValue.currentId = destRibbon.scrollId
 | 
					                paneConnector.wrappedValue.currentId = destRibbon.scrollId
 | 
				
			||||||
| 
						 | 
					@ -208,8 +209,10 @@ struct ContentView: View {
 | 
				
			||||||
    @State var scrollId: String?
 | 
					    @State var scrollId: String?
 | 
				
			||||||
    @State var scrollOffset: CGFloat?
 | 
					    @State var scrollOffset: CGFloat?
 | 
				
			||||||
    @State var setScrollOffset: CGFloat?
 | 
					    @State var setScrollOffset: CGFloat?
 | 
				
			||||||
 | 
					    @State var foocat = "meow"
 | 
				
			||||||
    @State var showOverlay: Bool = false
 | 
					    @State var showOverlay: Bool = false
 | 
				
			||||||
    @State var refresh: Bool = false
 | 
					    @State var refresh: Bool = false
 | 
				
			||||||
 | 
					    @State var refresh3: Bool = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @State var vertSep = CGFloat(20)
 | 
					    @State var vertSep = CGFloat(20)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -325,9 +328,13 @@ struct ContentView: View {
 | 
				
			||||||
                                        var curOffset = gTracker.visibleViews[paneConnector.scrollId]
 | 
					                                        var curOffset = gTracker.visibleViews[paneConnector.scrollId]
 | 
				
			||||||
                                        Print(" stats", gTracker.visibleViews)
 | 
					                                        Print(" stats", gTracker.visibleViews)
 | 
				
			||||||
                                        if curOffset != nil {
 | 
					                                        if curOffset != nil {
 | 
				
			||||||
                                            setScrollOffset = CGFloat(Int(paneConnector.scrollOffset) - Int(curOffset!))
 | 
					                                            paneConnector.setScrollOffset = CGFloat(Int(paneConnector.scrollOffset) - Int(curOffset!))
 | 
				
			||||||
 | 
					                                            // setScrollOffset = CGFloat(Int(paneConnector.scrollOffset) - Int(curOffset!))
 | 
				
			||||||
 | 
					                                            // setScrollOffset = CGFloat(Int(paneConnector.scrollOffset) - Int(curOffset!))
 | 
				
			||||||
                                            Print("applying scroll offset \(setScrollOffset)")
 | 
					                                            Print("applying scroll offset \(setScrollOffset)")
 | 
				
			||||||
                                            refresh2.toggle()
 | 
					                                            Print("applying scroll offset \(paneConnector.setScrollOffset)")
 | 
				
			||||||
 | 
					                                            Print("applying scroll offset2 \(foocat)")
 | 
				
			||||||
 | 
					                                            self.refresh.toggle()
 | 
				
			||||||
                                        } else {
 | 
					                                        } else {
 | 
				
			||||||
                                            var adjust = (Int(paneConnector.scrollId)! - Int(paneConnector.currentId)!) * 200
 | 
					                                            var adjust = (Int(paneConnector.scrollId)! - Int(paneConnector.currentId)!) * 200
 | 
				
			||||||
                                            Print("adjusting \(adjust)")
 | 
					                                            Print("adjusting \(adjust)")
 | 
				
			||||||
| 
						 | 
					@ -339,15 +346,22 @@ 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
 | 
				
			||||||
                            if setScrollOffset != nil {
 | 
					                            Print("introspect")
 | 
				
			||||||
                                DispatchQueue.main.async {
 | 
					 | 
				
			||||||
                                    scrollView.contentOffset.y = scrollView.contentOffset.y + setScrollOffset!
 | 
					 | 
				
			||||||
                                    setScrollOffset = nil
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                    // self.showOverlay = false
 | 
					                            // Weird hack for reactivity
 | 
				
			||||||
                                    withAnimation {
 | 
					                            if self.refresh {
 | 
				
			||||||
 | 
					                                let reactive = self.refresh
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if paneConnector.setScrollOffset != nil {
 | 
				
			||||||
 | 
					                                DispatchQueue.main.async {
 | 
				
			||||||
 | 
					                                    scrollView.contentOffset.y = scrollView.contentOffset.y + paneConnector.setScrollOffset!
 | 
				
			||||||
 | 
					                                    paneConnector.setScrollOffset = nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                    withAnimation(.easeIn(duration: 0.2)) {
 | 
				
			||||||
                                        paneConnector.showOverlay = false
 | 
					                                        paneConnector.showOverlay = false
 | 
				
			||||||
 | 
					                                        self.refresh.toggle()
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
| 
						 | 
					@ -447,7 +461,7 @@ struct ContentView: View {
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if paneConnector.showOverlay {
 | 
					                if self.paneConnector.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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue