makes dragging smoother, no jitter
parent
8373831d47
commit
d623d9c34e
|
@ -20,6 +20,8 @@ var currentOffset : CGFloat?
|
|||
var gTracker: VisibilityTracker<String>?
|
||||
var printCount: Int64 = 0
|
||||
|
||||
var disableDrop = false
|
||||
|
||||
// var curBook = "John"
|
||||
|
||||
extension UserDefaults {
|
||||
|
@ -922,6 +924,10 @@ struct DropViewDelegate: DropDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
if disableDrop {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var newRibbon = draggedItem!
|
||||
var newDest = destinationItem
|
||||
|
@ -942,6 +948,10 @@ struct DropViewDelegate: DropDelegate {
|
|||
newRibbon.pos = destinationItem.pos
|
||||
|
||||
_ = try await appDatabase.updateRibbonPosition(&newRibbon, oldPos, newPos )
|
||||
disableDrop = true
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
disableDrop = false
|
||||
}
|
||||
draggedItem!.pos = newPos
|
||||
|
||||
// draggedItem = nil
|
||||
|
|
Loading…
Reference in New Issue