private bool TryHandleCursorPositionSetByTouchScreen()
{
bool handled = false;
// We'll only consider this if the touch screen is pressed. Windows 8
// uses both the touch screen and the cursor and we want to obey both - so
// we'll first check the touch screen if it's down, otherwise use the mouse.
bool shouldReadValues = (InputDevice & Gui.InputDevice.TouchScreen) == InputDevice.TouchScreen &&
InputManager.TouchScreen.ScreenDown;
// Update February 9, 2014
// For iOS we should just use the values no matter what.
// Update October 26, 2014
// Android too
#if IOS || ANDROID
shouldReadValues = true;
#endif
if (shouldReadValues)
{
mScreenX = InputManager.TouchScreen.AverageTouchPoint.X;
mScreenY = InputManager.TouchScreen.AverageTouchPoint.Y;
//We need to ignore previous frame values at the start and end of pinching.
if (InputManager.TouchScreen.PinchStarted || InputManager.TouchScreen.PinchStopped)
{
mLastRay = GetRay();
mLastScreenX = mScreenX;
mLastScreenY = mScreenY;
}
handled = true;
}
return handled;
}