Improve reliability of click detection in player window by adding minimum threshold for drag #4232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This updates the click detection in
MainWindowController
and adds a requirement that after mouseDown the user must drag the cursor at least 2pts distance for drag to start.A given
mouseDown
/mouseUp
pair is processed as either a click or a drag, but not both. The out-of-the-box behavior in Cocoa is unfortunately not very useful to take on its own: themouseDragged
callback is called with very high sensitivity (particularly with trackpad actions);mouseDragged
will get called for drag distances of just a fraction of a pixel. This is both not very useful as a an actual drag distance, and actively harmful because it results in clicks/taps appearing to be ignored from the user's standpoint.After some testing and tweaking, I concluded that a drag start threshold requirement of 2pts is all that's needed to ensure that clicks are registered reliably and there is no noticeable burden on actual drag attempts. Note that 2pts is all that's needed to start the drag, so if the user's goal is to move their player window by only 1pt, they will have to first drag it by 2 pts to register the drag, then drag it back by 1 pt to position it. I believe this behavior is similar to how CAD & layout software usually works, but as a video player it's expected to be very rare that any user will be making such fine adjustments anyway.