small refactor

undo
saint 2024-06-04 07:34:15 -04:00
parent 0ac847c88c
commit 678400c05e
1 changed files with 4 additions and 34 deletions

View File

@ -377,16 +377,16 @@ struct ContentView: View {
DragGesture()
.onChanged { gesture in
let margin = CGFloat(50)
let dragThreshold = CGFloat(10)
print("mao viewState :\(viewState.width)")
print(pulledOut.width)
// threshold of how much to swipe before the view drags
if abs(gesture.translation.width) > 10 {
if abs(gesture.translation.width) > dragThreshold {
viewState.width = gesture.translation.width
// if gesture.translation.width < -50, pulledOut.width == CGFloat(0) {
// }
}
if viewState.width < -50 && pulledOut.width <= 0 {
if viewState.width < -margin && pulledOut.width <= 0 {
dragOffset = margin + viewState.width + pulledOut.width
}
@ -413,15 +413,6 @@ struct ContentView: View {
setPulledOutWith = pulledOutLeft
}
// if setPulledOutWith < 0 {
// setDragOffset = CGFloat(50) + setPulledOutWith
// } else if setPulledOutWith > 0 {
// setDragOffset = setPulledOutWith
// } else {
// setDragOffset = .zero
// }
print("mao setPulledOutWith \(setPulledOutWith)")
withAnimation(.spring(response: 0.2)) {
pulledOut.width = setPulledOutWith
dragOffset = setDragOffset
@ -429,27 +420,6 @@ struct ContentView: View {
}
}
)
// if self.paneConnector.showOverlay {
// Rectangle()
// .frame(width: geometry.size.width - 50, height: geometry.size.height + 200)
// .background(.ultraThinMaterial)
// // .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)
// }
}
.onChange(of: paneConnector.refresh) { _ in
Print("we changing changing")
}
}
}