add mouse pointer velocity tweak for trackpad (relative) mode
This commit is contained in:
1 parent
001deeee66
commit
a5c8224023
12 files changed
+575
-520
No files matched your search
@@ -7,12 +7,13 @@
|
||||
//
|
||||
|
||||
#import "StreamView.h"
|
||||
#import "DataManager.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RelativeTouchHandler : UIResponder
|
||||
|
||||
-(id)initWithView:(StreamView*)view;
|
||||
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "RelativeTouchHandler.h"
|
||||
#import "CustomTapGestureRecognizer.h"
|
||||
#import "DataManager.h"
|
||||
|
||||
#include <Limelight.h>
|
||||
#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.15
|
||||
@@ -17,6 +18,7 @@ static const int REFERENCE_WIDTH = 1280;
|
||||
static const int REFERENCE_HEIGHT = 720;
|
||||
|
||||
@implementation RelativeTouchHandler {
|
||||
TemporarySettings* currentSettings;
|
||||
CGPoint touchLocation, originalLocation;
|
||||
BOOL touchMoved;
|
||||
BOOL isDragging;
|
||||
@@ -32,10 +34,10 @@ static const int REFERENCE_HEIGHT = 720;
|
||||
UIView* view;
|
||||
}
|
||||
|
||||
- (id)initWithView:(StreamView*)view {
|
||||
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings {
|
||||
self = [self init];
|
||||
self->view = view;
|
||||
|
||||
self->currentSettings = settings;
|
||||
// replace righclick recoginizing with my CustomTapGestureRecognizer for better experience, higher recoginizing rate.
|
||||
rightClickTapRecognizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(mouseRightClick)];
|
||||
rightClickTapRecognizer.numberOfTouchesRequired = 2;
|
||||
@@ -112,8 +114,8 @@ static const int REFERENCE_HEIGHT = 720;
|
||||
if (touchLocation.x != currentLocation.x ||
|
||||
touchLocation.y != currentLocation.y)
|
||||
{
|
||||
int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / view.bounds.size.width);
|
||||
int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / view.bounds.size.height);
|
||||
int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / view.bounds.size.width) * currentSettings.mousePointerVelocityFactor.floatValue;
|
||||
int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / view.bounds.size.height) * currentSettings.mousePointerVelocityFactor.floatValue;
|
||||
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
||||
|
||||
@@ -100,7 +100,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
case NATIVE_TOUCH_MODE:
|
||||
self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings];break;
|
||||
case RELATIVE_TOUCH_MODE:
|
||||
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self];
|
||||
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self andSettings:settings];
|
||||
keyboardToggleRecognizer.immediateTriggering = true; //triggers signal in touchesBegan callback stage
|
||||
break;
|
||||
case ABSOLUTE_TOUCH_MODE:
|
||||
|
||||
Reference in new issue
Block a user