tweak RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S for relative touch
This commit is contained in:
1 parent
f2cf788d86
commit
8834f492b4
4 files changed
+10
-8
No files matched your search
@@ -10,14 +10,13 @@
|
|||||||
#define CustomTapGestureRecognizer_h
|
#define CustomTapGestureRecognizer_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@interface CustomTapGestureRecognizer : UIGestureRecognizer{
|
@interface CustomTapGestureRecognizer : UIGestureRecognizer{
|
||||||
CGFloat lowestTouchPointYCoord;
|
CGFloat lowestTouchPointYCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@property (nonatomic, assign) uint8_t numberOfTouchesRequired;
|
@property (nonatomic, assign) uint8_t numberOfTouchesRequired;
|
||||||
@property (nonatomic, assign) bool immediateTriggering; // trigger the signal on touchesBegan stage if enabled.
|
@property (nonatomic, assign) bool immediateTriggering; // if enabled, trigger the signal on touchesBegan stage.
|
||||||
@property (nonatomic, assign) double tapDownTimeThreshold; // tap down threshold in seconds.
|
@property (nonatomic, assign) double tapDownTimeThreshold; // tap down threshold in seconds.
|
||||||
@property (nonatomic, readonly) CGFloat lowestTouchPointHeight;
|
@property (nonatomic, readonly) CGFloat lowestTouchPointHeight;
|
||||||
@property (nonatomic, readonly) bool gestureCaptured;
|
@property (nonatomic, readonly) bool gestureCaptured;
|
||||||
|
|||||||
@@ -11,9 +11,12 @@
|
|||||||
#import "CustomTapGestureRecognizer.h"
|
#import "CustomTapGestureRecognizer.h"
|
||||||
|
|
||||||
// The most accurate & reliable tap gesture recognizer of iOS:
|
// The most accurate & reliable tap gesture recognizer of iOS:
|
||||||
// - almost 100% recoginition rate. UITapGestureRecognizer of Apple API is just intractable.
|
// - Almost 100% recoginition rate. UITapGestureRecognizer of Apple API fails frequently, just intractable.
|
||||||
// - instances of different numberOfTouchesRequired barely compete with each other, even when immediateTriggering is set to false.
|
// - When immediateTriggering is set to false (for native multi-touch):
|
||||||
// - set property immediateTriggering = true, ensures no competition with gestures of less fingers in non-native touch mode.
|
// Gesture signal will be triggered on touchesEnded stage, multi finger touch operations will not be interrupted by the arising keyboard.
|
||||||
|
// Instances of different [numberOfTouchesRequired] barely compete with each other, for example, the chance of 3-finger gesture get triggered by 4 or 5 finger tap is very small.
|
||||||
|
// - Set property immediateTriggering to true, to ensure the priority of keyboard toggle in non-native touch mode, in compete with 2-finger gestures.
|
||||||
|
// - This recognizer also provides properties like gestureCapturedTime, to be accessed outside the class for useful purpose.
|
||||||
|
|
||||||
@implementation CustomTapGestureRecognizer
|
@implementation CustomTapGestureRecognizer
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
@implementation NativeTouchHandler {
|
@implementation NativeTouchHandler {
|
||||||
StreamView* streamView;
|
StreamView* streamView;
|
||||||
TemporarySettings* currentSettings;
|
TemporarySettings* currentSettings;
|
||||||
BOOL activateCoordSelector;
|
bool activateCoordSelector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#import "CustomTapGestureRecognizer.h"
|
#import "CustomTapGestureRecognizer.h"
|
||||||
|
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.2
|
#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.15
|
||||||
|
|
||||||
|
|
||||||
static const int REFERENCE_WIDTH = 1280;
|
static const int REFERENCE_WIDTH = 1280;
|
||||||
@@ -132,7 +132,7 @@ static const int REFERENCE_HEIGHT = 720;
|
|||||||
CGPoint secondLocation = [[[[event allTouches] allObjects] objectAtIndex:1] locationInView:view];
|
CGPoint secondLocation = [[[[event allTouches] allObjects] objectAtIndex:1] locationInView:view];
|
||||||
|
|
||||||
CGPoint avgLocation = CGPointMake((firstLocation.x + secondLocation.x) / 2, (firstLocation.y + secondLocation.y) / 2);
|
CGPoint avgLocation = CGPointMake((firstLocation.x + secondLocation.x) / 2, (firstLocation.y + secondLocation.y) / 2);
|
||||||
if ((CACurrentMediaTime() - rightClickTapRecognizer.gestureCapturedTime > RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S) && touchLocation.y != avgLocation.y) { //prevent sending scrollevent while right click gesture is being recognized. The time threshold is only 100ms, resulting in a barely noticeable delay before the scroll event is activated.
|
if ((CACurrentMediaTime() - rightClickTapRecognizer.gestureCapturedTime > RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S) && touchLocation.y != avgLocation.y) { //prevent sending scrollevent while right click gesture is being recognized. The time threshold is only 150ms, resulting in a barely noticeable delay before the scroll event is activated.
|
||||||
LiSendHighResScrollEvent((avgLocation.y - touchLocation.y) * 10);
|
LiSendHighResScrollEvent((avgLocation.y - touchLocation.y) * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user