mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-26 06:22:45 +00:00
Fix some incorrect tap behavior on right clicks
This commit is contained in:
parent
829e7cf33c
commit
16cc829906
@ -23,6 +23,7 @@ public class RelativeTouchContext implements TouchContext {
|
|||||||
private double distanceMoved;
|
private double distanceMoved;
|
||||||
private double xFactor, yFactor;
|
private double xFactor, yFactor;
|
||||||
private int pointerCount;
|
private int pointerCount;
|
||||||
|
private int maxPointerCountInGesture;
|
||||||
|
|
||||||
private final NvConnection conn;
|
private final NvConnection conn;
|
||||||
private final int actionIndex;
|
private final int actionIndex;
|
||||||
@ -67,6 +68,13 @@ public class RelativeTouchContext implements TouchContext {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this input wasn't the last finger down, do not report
|
||||||
|
// a tap. This ensures we don't report duplicate taps for each
|
||||||
|
// finger on a multi-finger tap gesture
|
||||||
|
if (actionIndex + 1 != maxPointerCountInGesture) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
long timeDelta = SystemClock.uptimeMillis() - originalTouchTime;
|
long timeDelta = SystemClock.uptimeMillis() - originalTouchTime;
|
||||||
return isWithinTapBounds(lastTouchX, lastTouchY) && timeDelta <= TAP_TIME_THRESHOLD;
|
return isWithinTapBounds(lastTouchX, lastTouchY) && timeDelta <= TAP_TIME_THRESHOLD;
|
||||||
}
|
}
|
||||||
@ -92,6 +100,7 @@ public class RelativeTouchContext implements TouchContext {
|
|||||||
originalTouchY = lastTouchY = eventY;
|
originalTouchY = lastTouchY = eventY;
|
||||||
|
|
||||||
if (isNewFinger) {
|
if (isNewFinger) {
|
||||||
|
maxPointerCountInGesture = pointerCount;
|
||||||
originalTouchTime = SystemClock.uptimeMillis();
|
originalTouchTime = SystemClock.uptimeMillis();
|
||||||
cancelled = confirmedDrag = confirmedMove = confirmedScroll = false;
|
cancelled = confirmedDrag = confirmedMove = confirmedScroll = false;
|
||||||
distanceMoved = 0;
|
distanceMoved = 0;
|
||||||
@ -279,5 +288,9 @@ public class RelativeTouchContext implements TouchContext {
|
|||||||
@Override
|
@Override
|
||||||
public void setPointerCount(int pointerCount) {
|
public void setPointerCount(int pointerCount) {
|
||||||
this.pointerCount = pointerCount;
|
this.pointerCount = pointerCount;
|
||||||
|
|
||||||
|
if (pointerCount > maxPointerCountInGesture) {
|
||||||
|
maxPointerCountInGesture = pointerCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user