mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 20:16:54 +01:00
Fix drag and drop targeting bugs.
This commit is contained in:
parent
dd7431d5cb
commit
c8cfcae8e3
@ -26,8 +26,12 @@ extension MasterFeedViewController: UITableViewDropDelegate {
|
|||||||
return UITableViewDropProposal(operation: .forbidden)
|
return UITableViewDropProposal(operation: .forbidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
if destNode.representedObject is Folder && session.location(in: destCell).y >= 0 {
|
if destNode.representedObject is Folder {
|
||||||
return UITableViewDropProposal(operation: .move, intent: .insertIntoDestinationIndexPath)
|
if session.location(in: destCell).y >= 0 {
|
||||||
|
return UITableViewDropProposal(operation: .move, intent: .insertIntoDestinationIndexPath)
|
||||||
|
} else {
|
||||||
|
return UITableViewDropProposal(operation: .move, intent: .unspecified)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return UITableViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
|
return UITableViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
|
||||||
}
|
}
|
||||||
|
@ -327,8 +327,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
|
|
||||||
// If this is a folder and isn't expanded or doesn't have any entries, let the users drop on it
|
// If this is a folder and isn't expanded or doesn't have any entries, let the users drop on it
|
||||||
if destNode.representedObject is Folder && (destNode.numberOfChildNodes == 0 || !destNode.isExpanded) {
|
if destNode.representedObject is Folder && (destNode.numberOfChildNodes == 0 || !destNode.isExpanded) {
|
||||||
let movementAdjustment = sourceIndexPath > destIndexPath ? 1 : 0
|
return proposedDestinationIndexPath
|
||||||
return IndexPath(row: destIndexPath.row + movementAdjustment, section: destIndexPath.section)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are dragging around in the same container, just return the original source
|
// If we are dragging around in the same container, just return the original source
|
||||||
@ -353,12 +352,14 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
sortedNodes.remove(at: index)
|
sortedNodes.remove(at: index)
|
||||||
|
|
||||||
if index >= sortedNodes.count {
|
if index >= sortedNodes.count {
|
||||||
let lastSortedIndexPath = dataSource.indexPath(for: sortedNodes[sortedNodes.count - 1])!
|
let lastSortedIndexPath = dataSource.indexPath(for: sortedNodes[sortedNodes.count - 1])!
|
||||||
return IndexPath(row: lastSortedIndexPath.row + 1, section: lastSortedIndexPath.section)
|
let movementAdjustment = sourceIndexPath > destIndexPath ? 1 : 0
|
||||||
|
return IndexPath(row: lastSortedIndexPath.row + movementAdjustment, section: lastSortedIndexPath.section)
|
||||||
} else {
|
} else {
|
||||||
return dataSource.indexPath(for: sortedNodes[index])!
|
let movementAdjustment = sourceIndexPath < destIndexPath ? 1 : 0
|
||||||
|
return dataSource.indexPath(for: sortedNodes[index - movementAdjustment])!
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user