-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve handling mouse clicks on macOS #567
Improve handling mouse clicks on macOS #567
Conversation
This implementation is redundant as we add a target and action inside `Component`. `NSTableView` inherits from `NSControl` which supports this kind of behavior.
I ended up mocking `clickedRow` on `NSTableView` to be able to test the click behavior. I tried a bunch of other approaches before, like triggering actions on the view that should be clicked but that does not trigger anything in the responder chain, `clickedRow` remained unchanged.
@zenangst, thanks for your PR! By analyzing the history of the files in this pull request, we identified @JohnSundell to be a potential reviewer. |
Codecov Report
@@ Coverage Diff @@
## master #567 +/- ##
==========================================
+ Coverage 82.78% 83.01% +0.23%
==========================================
Files 120 121 +1
Lines 9051 9104 +53
==========================================
+ Hits 7493 7558 +65
+ Misses 1558 1546 -12
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 🍰
This is done to avoid recursion, if we don't force unwrap here it will end up running the same function over and over again.
This PR introduces a new
mouseClick
property onInteraction
. Now you can easily configure if you should single or double click onNSTableView
-based components. Will try to add the same behavior toNSCollectionView
based views in the future.mouseClick
does not really make sense to include on any other platform thanmacOS
.So I'll make an issue to make two
Interaction
structs, one for click-based OS:es and one combined foriOS
andtvOS
. I didn't include that change in this PR to keep the size down.