Corrected move BatchUpdate usage to make move animation smoother
This commit is contained in:
parent
b1bd8d2d90
commit
fa6b6a4769
@ -309,10 +309,12 @@ private extension SidebarOutlineDataSource {
|
|||||||
let source = node.parent?.representedObject as? Container
|
let source = node.parent?.representedObject as? Container
|
||||||
let destination = parentNode.representedObject as? Container
|
let destination = parentNode.representedObject as? Container
|
||||||
|
|
||||||
|
BatchUpdate.shared.start()
|
||||||
source?.removeFeed(feed) { result in
|
source?.removeFeed(feed) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
destination?.addFeed(feed) { result in
|
destination?.addFeed(feed) { result in
|
||||||
|
BatchUpdate.shared.end()
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
break
|
break
|
||||||
@ -364,10 +366,12 @@ private extension SidebarOutlineDataSource {
|
|||||||
|
|
||||||
if let existingFeed = destinationAccount.existingFeed(withURL: feed.url) {
|
if let existingFeed = destinationAccount.existingFeed(withURL: feed.url) {
|
||||||
|
|
||||||
|
BatchUpdate.shared.start()
|
||||||
destinationContainer.addFeed(existingFeed) { result in
|
destinationContainer.addFeed(existingFeed) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
sourceAccount.deleteFeed(feed) { result in
|
sourceAccount.deleteFeed(feed) { result in
|
||||||
|
BatchUpdate.shared.end()
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
break
|
break
|
||||||
@ -382,10 +386,12 @@ private extension SidebarOutlineDataSource {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
BatchUpdate.shared.start()
|
||||||
destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer) { result in
|
destinationAccount.createFeed(url: feed.url, name: feed.editedName, container: destinationContainer) { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
sourceAccount.deleteFeed(feed) { result in
|
sourceAccount.deleteFeed(feed) { result in
|
||||||
|
BatchUpdate.shared.end()
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
break
|
break
|
||||||
@ -406,24 +412,20 @@ private extension SidebarOutlineDataSource {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
BatchUpdate.shared.perform {
|
draggedNodes.forEach { node in
|
||||||
|
if sameAccount(node, parentNode) {
|
||||||
draggedNodes.forEach { node in
|
if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false {
|
||||||
if sameAccount(node, parentNode) {
|
copyInAccount(node: node, to: parentNode)
|
||||||
if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false {
|
|
||||||
copyInAccount(node: node, to: parentNode)
|
|
||||||
} else {
|
|
||||||
moveInAccount(node: node, to: parentNode)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false {
|
moveInAccount(node: node, to: parentNode)
|
||||||
copyBetweenAccounts(node: node, to: parentNode)
|
}
|
||||||
} else {
|
} else {
|
||||||
moveBetweenAccounts(node: node, to: parentNode)
|
if NSApplication.shared.currentEvent?.modifierFlags.contains(.option) ?? false {
|
||||||
}
|
copyBetweenAccounts(node: node, to: parentNode)
|
||||||
|
} else {
|
||||||
|
moveBetweenAccounts(node: node, to: parentNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let allReferencedNodes = draggedNodes.union(Set([parentNode]))
|
let allReferencedNodes = draggedNodes.union(Set([parentNode]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user