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