Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emulate right click via dual-tap on touch devices (#1789)
Resolves #1782. This PR adds support for issuing context clicks from touch devices by tapping with two fingers at once. - I had to slightly refactor the existing code in order to accommodate the right-click logic. Mainly: - `touchInfo` has now become a `touchInfos` list - The `isDoubleClick` and `isRightClick` methods now also take that list as first argument. Both function also check the arity of that list, so that they are more self-contained. - Contrary to [the initial idea in the proof-of-concept branch](#1779 (review)), I ended up implementing “dual tap” (two-finger tap) rather than “tap and hold” (with one finger). The logic of the latter would have become quite complex, because we then would have to make the decision when the tap is released (stopped), not when it’s started. This also would bring further complexity with it, because more things might happen between touch-start and touch-end, such as a drag-and-drop attempt, or some multi-finger gesture. So I thought it was most simple to implement “dual tap”, because then the logic appeared much simpler, and we can make the decision right away at touch-start time. - I’ve also added a note to the top-level comment to make it clear that this implementation does not cover all cases 100% correctly. I have tested this on my iPad, so a code check would suffice from my side. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1789"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a> --------- Co-authored-by: Jan Heuermann <[email protected]>
- Loading branch information