made the reorder even smoother

undo
saint 2023-08-03 18:22:18 -04:00
parent ecb13c384c
commit f6dd4f0f2c
1 changed files with 22 additions and 0 deletions

View File

@ -417,6 +417,10 @@ struct ContentView: View {
.zIndex(0)
.animation(.default, value: ribbons)
.onDrop(of: [.item],
delegate: DropViewDelegate2(isDragging: $isDragging)
)
// Spacer()
// ForEach(ribbons) { ribbon in
@ -914,6 +918,24 @@ private let itemFormatter: DateFormatter = {
return formatter
}()
struct DropViewDelegate2: DropDelegate {
@Binding var isDragging: Bool
func dropUpdated(info: DropInfo) -> DropProposal? {
return DropProposal(operation: .move)
}
func performDrop(info: DropInfo) -> Bool {
return true
}
func dropEntered(info: DropInfo) {
isDragging = true
print("SECOND DROPPPOOO")
}
}
struct DropViewDelegate: DropDelegate {
let destinationItem: Ribbon