swiping seems to work fine, need to fix dragoffset now

fix_swipe
saint 2024-06-09 10:25:08 -04:00
parent 56b32c39ab
commit a8648b8508
1 changed files with 7 additions and 14 deletions

View File

@ -410,36 +410,29 @@ struct ContentView: View {
if startSwipeDir == .left {
maxOffsetLeft = .zero
maxOffsetRight = .zero
} else {
} else if startSwipeDir == .right {
maxOffsetLeft = CGFloat(200)
maxOffsetRight = .zero
maxOffsetRight = CGFloat(10)
}
}
if newOffset + pulledOut.width < -maxOffsetLeft {
if startSwipeState == .right && startSwipeDir == .left {
print("meow here")
newOffset = -maxOffsetLeft + rubberBandEffect(newOffset + maxOffsetLeft) - pulledOut.width
} else {
print("meow here")
newOffset = -maxOffsetLeft + rubberBandEffect(newOffset + maxOffsetLeft)
}
} else if newOffset + pulledOut.width > maxOffsetRight {
newOffset = maxOffsetRight + rubberBandEffect(newOffset - maxOffsetRight)
if startSwipeState == .left, startSwipeDir == .right {
newOffset = maxOffsetRight + rubberBandEffect(newOffset - maxOffsetRight) - pulledOut.width
} else {
newOffset = maxOffsetRight + rubberBandEffect(newOffset - maxOffsetRight)
}
}
// if newOffset.height < -maxOffset {
// newOffset.height = -maxOffset + rubberBandEffect(newOffset.height + maxOffset)
// } else if newOffset.height > maxOffset {
// newOffset.height = maxOffset + rubberBandEffect(newOffset.height - maxOffset)
// }
self.mainSwipe.width = newOffset
// dragOffset is what is used to make the text be readable
// with the right pane being visible