From 653c0fdb30516eebcf9e53b925d5245dbc725a6f Mon Sep 17 00:00:00 2001 From: Chase W Date: Wed, 29 Apr 2015 11:54:30 -0400 Subject: [PATCH] Fixed inconsistency between sf::Touch::getPosition and touch events. --- src/SFML/Window/iOS/SFAppDelegate.mm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SFML/Window/iOS/SFAppDelegate.mm b/src/SFML/Window/iOS/SFAppDelegate.mm index 48ea2c36c..5908b4e39 100644 --- a/src/SFML/Window/iOS/SFAppDelegate.mm +++ b/src/SFML/Window/iOS/SFAppDelegate.mm @@ -242,6 +242,9 @@ namespace //////////////////////////////////////////////////////////// - (void)notifyTouchBegin:(unsigned int)index atPosition:(sf::Vector2i)position; { + position.x *= backingScaleFactor; + position.y *= backingScaleFactor; + // save the touch position if (index >= touchPositions.size()) touchPositions.resize(index + 1, sf::Vector2i(-1, -1)); @@ -253,8 +256,8 @@ namespace sf::Event event; event.type = sf::Event::TouchBegan; event.touch.finger = index; - event.touch.x = position.x * backingScaleFactor; - event.touch.y = position.y * backingScaleFactor; + event.touch.x = position.x; + event.touch.y = position.y; sfWindow->forwardEvent(event); } } @@ -263,6 +266,9 @@ namespace //////////////////////////////////////////////////////////// - (void)notifyTouchMove:(unsigned int)index atPosition:(sf::Vector2i)position; { + position.x *= backingScaleFactor; + position.y *= backingScaleFactor; + // save the touch position if (index >= touchPositions.size()) touchPositions.resize(index + 1, sf::Vector2i(-1, -1)); @@ -274,8 +280,8 @@ namespace sf::Event event; event.type = sf::Event::TouchMoved; event.touch.finger = index; - event.touch.x = position.x * backingScaleFactor; - event.touch.y = position.y * backingScaleFactor; + event.touch.x = position.x; + event.touch.y = position.y; sfWindow->forwardEvent(event); } }