Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #320 from realm/do-fix-mac-ui-issues
Browse files Browse the repository at this point in the history
Fix toolbar validation & cells dragging in Mac app
  • Loading branch information
stel authored Oct 6, 2016
2 parents a4cc591 + 0db8402 commit e43a639
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions RealmTasks Apple/RealmTasks macOS/TaskCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,13 @@ extension TaskCellView: TaskTextFieldDelegate {
extension TaskCellView: NSGestureRecognizerDelegate {

func gestureRecognizerShouldBegin(gestureRecognizer: NSGestureRecognizer) -> Bool {
guard gestureRecognizer is NSPanGestureRecognizer else {
return false
}

let currentlyEditingTextField = ((window?.firstResponder as? NSText)?.delegate as? NSTextField)

guard let event = NSApp.currentEvent where currentlyEditingTextField != textView else {
guard currentlyEditingTextField != textView else {
return false
}

return fabs(event.deltaX) > fabs(event.deltaY)
return true
}

// FIXME: This could easily be refactored to avoid such a high CC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ extension TaskListViewController {
}

override func validateToolbarItem(theItem: NSToolbarItem) -> Bool {
return theItem.action != #selector(newTask) || currentlyEditingCellView?.text.isEmpty == false
return theItem.action != #selector(newTask) || currentlyEditingCellView == nil || currentlyEditingCellView?.text.isEmpty == false
}
}

Expand Down

0 comments on commit e43a639

Please sign in to comment.