fix pointerVelocityDivider bug

This commit is contained in:
True Zhuanjia
2024-05-30 23:24:26 +08:00
2 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -18,8 +18,8 @@ static NSMutableDictionary *pointerIdDict; //pointerId Dict for native touch.
static NSMutableSet<NSNumber *> *pointerIdSet; //pointerIdSet for native touch.
static NSMutableDictionary *pointerDict;
static CGFloat pointerVelocityFactor = 0.7;
static CGFloat pointerVelocityDivider = 0.5;
static CGFloat pointerVelocityFactor;
static CGFloat pointerVelocityDivider;
static CGFloat pointerVelocityDividerLocation;
StreamView *streamView;
@@ -68,7 +68,9 @@ StreamView *streamView;
pointerIdDict = [NSMutableDictionary dictionary];
pointerIdSet = [NSMutableSet set];
pointerDict = [NSMutableDictionary dictionary];
pointerVelocityDividerLocation = CGRectGetHeight([[UIScreen mainScreen] bounds]) * pointerVelocityDivider;
pointerVelocityDividerLocation = CGRectGetWidth([[UIScreen mainScreen] bounds]) * pointerVelocityDivider;
NSLog(@"pointerVelocityDivider: %.2f", pointerVelocityDivider);
NSLog(@"pointerVelocityDividerLocation: %.2f", pointerVelocityDividerLocation);
}
+ (void)populatePointerObjIntoDict:(UITouch*)touch{
+2 -2
View File
@@ -62,9 +62,9 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
self->streamAspectRatio = (float)streamConfig.width / (float)streamConfig.height;
settings = [[[DataManager alloc] init] getSettings];
[TouchPointer initContextWith:self];
[TouchPointer setPointerVelocityDivider:settings.pointerVelocityModeDivider.floatValue];
[TouchPointer setPointerVelocityFactor:settings.touchPointerVelocityFactor.floatValue];
[TouchPointer initContextWith:self];
keysDown = [[NSMutableSet alloc] init];
keyInputField = [[KeyboardInputField alloc] initWithFrame:CGRectZero];
@@ -335,7 +335,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)sendTouchEvent:(UITouch*)event touchType:(uint8_t)touchType{
CGPoint targetCoords;
if(settings.pointerVelocityModeDivider.floatValue != 1.0) targetCoords = [TouchPointer selectCoordsFor:event]; // coordinates of touch pointer replaced to relative ones here.
if(settings.pointerVelocityModeDivider.floatValue != 1.0 && event.phase == UITouchPhaseMoved) targetCoords = [TouchPointer selectCoordsFor:event]; // coordinates of touch pointer replaced to relative ones here.
else targetCoords = [event locationInView:self];
CGPoint location = [self adjustCoordinatesForVideoArea:targetCoords];
CGSize videoSize = [self getVideoAreaSize];