Fix document window drag & drop.

This commit is contained in:
Damiano Galassi committed 2018-02-12 13:05:35 +01:00
1 parent 160449af18
commit 0003ff73b3
3 files changed
+12 -3

No files matched your search

+6
View File
@@ -228,6 +228,10 @@ class TracksViewController: NSViewController, NSTableViewDataSource, NSTableView
func tableView(_ tableView: NSTableView,
writeRowsWith rowIndexes: IndexSet,
to pboard: NSPasteboard) -> Bool {
guard let firstRow = rowIndexes.first,
let track = track(at: firstRow), track.isMuxed == false
else { return false }
let data: Data = NSKeyedArchiver.archivedData(withRootObject: rowIndexes)
pboard.declareTypes([pasteboardType], owner: self)
pboard.setData(data, forType: pasteboardType)
@@ -262,6 +266,8 @@ class TracksViewController: NSViewController, NSTableViewDataSource, NSTableView
if let dragRow = rowIndexes.first {
mp4.moveTrack(at: UInt(dragRow - 1), to: UInt(row - 1))
tableView.reloadData()
// TODO: Support multiple rows drag
return true
}