builds
parent
cce075abaa
commit
4154f8f46d
|
@ -58,15 +58,14 @@ func goToRibbon(selectedRibbon: Ribbon,
|
||||||
if selectedRibbon.id != destRibbon.id! || loading {
|
if selectedRibbon.id != destRibbon.id! || loading {
|
||||||
print("switching ribbons")
|
print("switching ribbons")
|
||||||
|
|
||||||
showOverlay.wrappedValue = true
|
paneConnector.wrappedValue.showOverlay = true
|
||||||
|
|
||||||
if loading {
|
if loading {
|
||||||
paneConnector.wrappedValue.currentId = destRibbon.scrollId
|
paneConnector.wrappedValue.currentId = destRibbon.scrollId
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollId.wrappedValue = destRibbon.scrollId
|
paneConnector.wrappedValue.scrollId = destRibbon.scrollId
|
||||||
scrollOffset.wrappedValue = CGFloat(destRibbon.scrollOffset)
|
paneConnector.wrappedValue.scrollOffset = CGFloat(destRibbon.scrollOffset)
|
||||||
// refresh.wrappedValue.toggle()
|
|
||||||
paneConnector.wrappedValue.refresh.toggle()
|
paneConnector.wrappedValue.refresh.toggle()
|
||||||
|
|
||||||
var updateSelectRibbon = SelectedRibbon(id: Int64(1), ribbonId: destRibbon.id!)
|
var updateSelectRibbon = SelectedRibbon(id: Int64(1), ribbonId: destRibbon.id!)
|
||||||
|
@ -82,9 +81,7 @@ func goToRibbon(selectedRibbon: Ribbon,
|
||||||
if !loading {
|
if !loading {
|
||||||
print("not loading")
|
print("not loading")
|
||||||
updatedRibbon.scrollOffset = Int(floor(scrollOffsetToSave))
|
updatedRibbon.scrollOffset = Int(floor(scrollOffsetToSave))
|
||||||
// updatedRibbon.scrollId = scrollIdToSave!
|
|
||||||
updatedRibbon.scrollId = scrollIdToSave
|
updatedRibbon.scrollId = scrollIdToSave
|
||||||
|
|
||||||
_ = try await appDatabase.saveRibbon(&updatedRibbon)
|
_ = try await appDatabase.saveRibbon(&updatedRibbon)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -313,26 +310,26 @@ struct ContentView: View {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
let gTracker = paneConnector.visibilityTracker!
|
let gTracker = paneConnector.visibilityTracker!
|
||||||
|
|
||||||
Print("scroll Id target: \(scrollId)")
|
Print("scroll Id target: \(paneConnector.scrollId)")
|
||||||
proxy.scrollTo(scrollId!, anchor: .top)
|
proxy.scrollTo(paneConnector.scrollId, anchor: .top)
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||||
Print(" scroll id target", scrollId)
|
Print(" scroll id target", paneConnector.scrollId)
|
||||||
Print(" current id ", currentId)
|
Print(" current id ", paneConnector.currentId)
|
||||||
Print(gTracker.sortedViewIDs)
|
Print(gTracker.sortedViewIDs)
|
||||||
if currentId! != scrollId! {
|
if paneConnector.currentId != paneConnector.scrollId {
|
||||||
Print("NO MATCH")
|
Print("NO MATCH")
|
||||||
}
|
}
|
||||||
|
|
||||||
Print(" current offset ", gTracker.visibleViews[scrollId!])
|
Print(" current offset ", gTracker.visibleViews[paneConnector.scrollId])
|
||||||
var curOffset = gTracker.visibleViews[scrollId!]
|
var curOffset = gTracker.visibleViews[paneConnector.scrollId]
|
||||||
Print(" stats", gTracker.visibleViews)
|
Print(" stats", gTracker.visibleViews)
|
||||||
if curOffset != nil {
|
if curOffset != nil {
|
||||||
setScrollOffset = CGFloat(Int(scrollOffset!) - Int(curOffset!))
|
setScrollOffset = CGFloat(Int(paneConnector.scrollOffset) - Int(curOffset!))
|
||||||
Print("applying scroll offset \(setScrollOffset)")
|
Print("applying scroll offset \(setScrollOffset)")
|
||||||
refresh2.toggle()
|
refresh2.toggle()
|
||||||
} else {
|
} else {
|
||||||
var adjust = (Int(scrollId!)! - Int(currentId!)!) * 200
|
var adjust = (Int(paneConnector.scrollId)! - Int(paneConnector.currentId)!) * 200
|
||||||
Print("adjusting \(adjust)")
|
Print("adjusting \(adjust)")
|
||||||
|
|
||||||
setScrollOffset = CGFloat(adjust)
|
setScrollOffset = CGFloat(adjust)
|
||||||
|
@ -350,7 +347,7 @@ struct ContentView: View {
|
||||||
|
|
||||||
// self.showOverlay = false
|
// self.showOverlay = false
|
||||||
withAnimation {
|
withAnimation {
|
||||||
showOverlay = false
|
paneConnector.showOverlay = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +447,7 @@ struct ContentView: View {
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if showOverlay {
|
if 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)
|
||||||
|
@ -587,6 +584,7 @@ struct ContentView_Previews: PreviewProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@discardableResult
|
||||||
extension View {
|
extension View {
|
||||||
func Print(_ vars: Any...) -> some View {
|
func Print(_ vars: Any...) -> some View {
|
||||||
for v in vars {
|
for v in vars {
|
||||||
|
|
Loading…
Reference in New Issue