Scale mouse input deltas based on the ratio of the stream resolution to the screen size and the screen scale

This commit is contained in:
Cameron Gutman
2015-01-10 00:37:34 -05:00
parent 514d5d13a0
commit 179110508c
3 changed files with 27 additions and 2 deletions
+8
View File
@@ -11,6 +11,7 @@
#import "HttpManager.h"
#import "Utils.h"
#import "OnScreenControls.h"
#import "StreamView.h"
@implementation StreamManager {
StreamConfiguration* _config;
@@ -73,6 +74,13 @@
}
}
// Set mouse delta factors from the screen resolution and stream size
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale);
[((StreamView*)_renderView) setMouseDeltaFactors:_config.width / screenSize.width
y:_config.height / screenSize.height];
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
_connection = [[Connection alloc] initWithConfig:_config renderer:renderer connectionCallbacks:_callbacks];
NSOperationQueue* opQueue = [[NSOperationQueue alloc] init];