Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix for iOS touch input coordinates being halved on Retina displays

  • Loading branch information
DavidLudwig committed Jul 26, 2012
1 parent 08817dd commit 58b0ae530181e892fba64b127c83377d616502e1
Showing with 12 additions and 0 deletions.
  1. +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);

0 comments on commit 58b0ae5

Please sign in to comment.