okay now working with adjust
parent
3a456cb457
commit
f479bdf3ee
|
@ -95,7 +95,7 @@ public class VisibilityTracker<ID: Hashable>: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func sortViews() {
|
func sortViews() {
|
||||||
var sortedPairs = visibleViews.sorted(by: { Int($0.1) < Int($1.1) })
|
var sortedPairs = visibleViews.sorted(by: { abs(Int($0.1)) < abs(Int($1.1)) })
|
||||||
// let sortedPairs = visibleViews.sorted(by: { Int($0.1) < Int($1.1) })
|
// let sortedPairs = visibleViews.sorted(by: { Int($0.1) < Int($1.1) })
|
||||||
// let sortedPairs = visibleViews.sorted(by: { $0 < $1 })
|
// let sortedPairs = visibleViews.sorted(by: { $0 < $1 })
|
||||||
sortedViewIDs = sortedPairs.map { $0.0 }
|
sortedViewIDs = sortedPairs.map { $0.0 }
|
||||||
|
|
Binary file not shown.
|
@ -4,59 +4,11 @@
|
||||||
type = "1"
|
type = "1"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
<Breakpoints>
|
<Breakpoints>
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "15F59F9C-3FC1-4D0F-B85D-E6FBE78FA1B7"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "gloss/ContentView.swift"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "577"
|
|
||||||
endingLineNumber = "577"
|
|
||||||
landmarkName = "unknown"
|
|
||||||
landmarkType = "0">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "CDC436E9-4048-417F-B565-1230E11797C1"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "gloss/ContentView.swift"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "446"
|
|
||||||
endingLineNumber = "446"
|
|
||||||
landmarkName = "body"
|
|
||||||
landmarkType = "24">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
uuid = "EA8119C2-B8C5-4B88-AA9A-2C4C80482D9E"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "gloss/ContentView.swift"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "451"
|
|
||||||
endingLineNumber = "451"
|
|
||||||
landmarkName = "body"
|
|
||||||
landmarkType = "24">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
<BreakpointProxy
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
<BreakpointContent
|
<BreakpointContent
|
||||||
uuid = "19620363-AF5F-4353-862D-4E40746274F5"
|
uuid = "19620363-AF5F-4353-862D-4E40746274F5"
|
||||||
shouldBeEnabled = "Yes"
|
shouldBeEnabled = "No"
|
||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "gloss/ContentView.swift"
|
filePath = "gloss/ContentView.swift"
|
||||||
|
@ -72,7 +24,7 @@
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
<BreakpointContent
|
<BreakpointContent
|
||||||
uuid = "A3202903-6BE5-4879-8970-4CE7B825E6DD"
|
uuid = "A3202903-6BE5-4879-8970-4CE7B825E6DD"
|
||||||
shouldBeEnabled = "Yes"
|
shouldBeEnabled = "No"
|
||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "gloss/ContentView.swift"
|
filePath = "gloss/ContentView.swift"
|
||||||
|
@ -84,5 +36,37 @@
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "DCBFFF14-138E-43D2-BA78-A5265A13CD4F"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "gloss/ContentView.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "457"
|
||||||
|
endingLineNumber = "457"
|
||||||
|
landmarkName = "body"
|
||||||
|
landmarkType = "24">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "1FDEB1B0-A696-4F5A-86AB-30728070E82F"
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "gloss/ContentView.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "425"
|
||||||
|
endingLineNumber = "425"
|
||||||
|
landmarkName = "body"
|
||||||
|
landmarkType = "24">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
</Breakpoints>
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|
|
@ -421,8 +421,8 @@ struct ContentView: View {
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
Print("first scroll to")
|
|
||||||
Print(scrollId)
|
Print("scroll Id target: \(scrollId)")
|
||||||
|
|
||||||
proxy.scrollTo(scrollId! , anchor: .top)
|
proxy.scrollTo(scrollId! , anchor: .top)
|
||||||
|
|
||||||
|
@ -432,10 +432,11 @@ struct ContentView: View {
|
||||||
|
|
||||||
// if (currentId != scrollId!) {
|
// if (currentId != scrollId!) {
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||||
|
|
||||||
Print(" scroll id target", currentId)
|
Print(" scroll id target", scrollId)
|
||||||
Print(" current id ", scrollId)
|
Print(" current id ", currentId)
|
||||||
|
Print(gTracker!.sortedViewIDs)
|
||||||
if (currentId! != scrollId!) {
|
if (currentId! != scrollId!) {
|
||||||
Print("NO MATCH")
|
Print("NO MATCH")
|
||||||
}
|
}
|
||||||
|
@ -446,10 +447,20 @@ struct ContentView: View {
|
||||||
var curOffset = gTracker!.visibleViews[scrollId!]
|
var curOffset = gTracker!.visibleViews[scrollId!]
|
||||||
Print(" stats", gTracker!.visibleViews)
|
Print(" stats", gTracker!.visibleViews)
|
||||||
// // setScrollOffset = CGFloat(Int(currentOffset!) * -1 + Int(scrollOffset!))
|
// // setScrollOffset = CGFloat(Int(currentOffset!) * -1 + Int(scrollOffset!))
|
||||||
setScrollOffset = CGFloat(Int(scrollOffset!) - Int(curOffset!))
|
if (curOffset != nil) {
|
||||||
// // setScrollOffset = CGFloat(Int(scrollOffset!))
|
setScrollOffset = CGFloat(Int(scrollOffset!) - Int(curOffset!))
|
||||||
// Print("setting scroll offset", setScrollOffset)
|
Print("applying scroll offset \(setScrollOffset)")
|
||||||
refresh2.toggle()
|
// // setScrollOffset = CGFloat(Int(scrollOffset!))
|
||||||
|
// Print("setting scroll offset", setScrollOffset)
|
||||||
|
refresh2.toggle()
|
||||||
|
} else {
|
||||||
|
var adjust = (Int(scrollId!)! - Int(currentId!)!) * 200
|
||||||
|
Print("adjusting \(adjust)")
|
||||||
|
|
||||||
|
setScrollOffset = CGFloat(adjust)
|
||||||
|
refresh.toggle()
|
||||||
|
|
||||||
|
}
|
||||||
// // currentId = scrollId!
|
// // currentId = scrollId!
|
||||||
|
|
||||||
// DispatchQueue.main.async {
|
// DispatchQueue.main.async {
|
||||||
|
@ -553,14 +564,15 @@ struct ContentView: View {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
currentId = tracker.sortedViewIDs[tracker.sortedViewIDs.count - 1]
|
// currentId = tracker.sortedViewIDs[tracker.sortedViewIDs.count - 1]
|
||||||
|
currentId = tracker.sortedViewIDs[0]
|
||||||
currentOffset = tracker.visibleViews[currentId!]!
|
currentOffset = tracker.visibleViews[currentId!]!
|
||||||
if (Int(currentOffset!) < 0) {
|
// if (Int(currentOffset!) != -1 && Int(currentOffset!) < 0) {
|
||||||
if (tracker.sortedViewIDs.count > 1) {
|
// if (tracker.sortedViewIDs.count > 1) {
|
||||||
currentId = tracker.sortedViewIDs[1]
|
// currentId = tracker.sortedViewIDs[1]
|
||||||
currentOffset = tracker.visibleViews[currentId!]!
|
// currentOffset = tracker.visibleViews[currentId!]!
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// if (currentId != nil) {
|
// if (currentId != nil) {
|
||||||
// // if (printCount % printRate == 0) {
|
// // if (printCount % printRate == 0) {
|
||||||
// // print(printCount)
|
// // print(printCount)
|
||||||
|
|
Loading…
Reference in New Issue