Skip to content

Commit

Permalink
set min dist = 1 for dist b/w three fingers
Browse files Browse the repository at this point in the history
  • Loading branch information
gurinderhans committed Jan 28, 2023
1 parent 2dbb182 commit 6dd315a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ThreeFingerDragManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public void ProcessInput(IntPtr lParam)
Utils.CalculateHypotenuse(contacts[1].X - contacts[2].X, contacts[1].Y - contacts[2].Y),
};

if (distBetween3Fingers.Max() > (distBetween3Fingers.Min() * this.DragStartFingersApartDistThreshold))
/// NOTE: some trackpad drivers report 3rd finger location same as 2nd finger, ie. min dist = 0
/// so we ensure min dist = 1, then we can set threshold to a high value to skip this check
double minDist = Math.Max(1, distBetween3Fingers.Min());
if (distBetween3Fingers.Max() > (minDist * this.DragStartFingersApartDistThreshold))
{
this.logger.Debug($"3fingers too far apart=({string.Join(",", distBetween3Fingers)})");
return;
Expand Down

0 comments on commit 6dd315a

Please sign in to comment.