Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix for iOS touch input coordinates being halved on Retina displays
- Loading branch information
Showing
with
12 additions
and
0 deletions.
-
+12
−0
src/video/uikit/SDL_uikitview.m
|
@@ -94,6 +94,12 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event |
|
|
|
|
|
if (touch) { |
|
|
CGPoint locationInView = [touch locationInView: self]; |
|
|
|
|
|
/* Make sure UIView points are converted to screen pixels: */ |
|
|
if ([self respondsToSelector:@selector(contentScaleFactor)]) { |
|
|
locationInView.x *= self.contentScaleFactor; |
|
|
locationInView.y *= self.contentScaleFactor; |
|
|
} |
|
|
|
|
|
/* send moved event */ |
|
|
SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y); |
|
@@ -184,6 +190,12 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event |
|
|
|
|
|
if (touch) { |
|
|
CGPoint locationInView = [touch locationInView: self]; |
|
|
|
|
|
/* Make sure UIView points are converted to screen pixels: */ |
|
|
if ([self respondsToSelector:@selector(contentScaleFactor)]) { |
|
|
locationInView.x *= self.contentScaleFactor; |
|
|
locationInView.y *= self.contentScaleFactor; |
|
|
} |
|
|
|
|
|
/* send moved event */ |
|
|
SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y); |
|
|