summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioswindow.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-02-14 13:09:08 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:56:09 +0100
commit11d50be6dd8bbfe695408ccd011cbf63f1b4324a (patch)
tree6b3c4abe8370805009779b4be3583270adf1987d /src/plugins/platforms/ios/qioswindow.mm
parent3eeb388b429242da8bfd9b9dc70660980f62090a (diff)
iOS: Set touch point position in screen coords.
Previously the position was set in window coordinates, which would break for non-fullscreen windows. Change-Id: Iefa2f590c6d62b09fc3e7fe60a882c1acd33e029 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qioswindow.mm')
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index e95f392655..e4fb5e2e1c 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -177,10 +177,13 @@
touchPoint.pressure = 0.0;
// Set position
- CGPoint location = [touch locationInView:self];
- touchPoint.area = QRectF(location.x, location.y, 0, 0);
- QSize viewSize = fromCGRect(self.frame).size();
- touchPoint.normalPosition = QPointF(location.x / viewSize.width(), location.y / viewSize.height());
+ QRect viewGeometry = fromCGRect(self.frame);
+ QPoint touchViewLocation = fromCGPoint([touch locationInView:self]);
+ QPoint touchScreenLocation = touchViewLocation + viewGeometry.topLeft();
+ touchPoint.area = QRectF(touchScreenLocation , QSize(0, 0));
+
+ CGSize fullscreenSize = self.window.rootViewController.view.bounds.size;
+ touchPoint.normalPosition = QPointF(touchScreenLocation.x() / fullscreenSize.width, touchScreenLocation.y() / fullscreenSize.height);
}
}