From fb43b9012be380ee475d5910a081c016f55f6ba3 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Mon, 30 Jan 2012 10:23:40 +0000 Subject: [PATCH] sync swipe motion in deck viewer act accordingly to a swipe/pan on corresponding platform (iOS vs everything else) --- JGE/src/iOS/EAGLView.m | 2 +- projects/mtg/src/GameStateDeckViewer.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/JGE/src/iOS/EAGLView.m b/JGE/src/iOS/EAGLView.m index 7600c3544..cfa5fa537 100755 --- a/JGE/src/iOS/EAGLView.m +++ b/JGE/src/iOS/EAGLView.m @@ -419,7 +419,7 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170 else { CGPoint v2 = [panGesture velocityInView: self]; - g_engine->Scroll( 0 - static_cast(v2.x), 0 - static_cast(v2.y)); + g_engine->Scroll( static_cast(v2.x), static_cast(v2.y)); [self performSelector: @selector(resetInput) withObject: nil afterDelay: 0.5]; } diff --git a/projects/mtg/src/GameStateDeckViewer.cpp b/projects/mtg/src/GameStateDeckViewer.cpp index e20f9d44a..1da92e464 100644 --- a/projects/mtg/src/GameStateDeckViewer.cpp +++ b/projects/mtg/src/GameStateDeckViewer.cpp @@ -1769,14 +1769,24 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId) } } +/* + to keep actions consistent across the different platforms, we need to branch the way swipes are interpreted. iOS5 changes + the way a swipe moves a document on the page. swipe down is to simulate dragging the page down instead of moving down + on a page. + */ void GameStateDeckViewer::OnScroll(int inXVelocity, int inYVelocity) { int magnitude = static_cast( sqrtf( (float )( (inXVelocity * inXVelocity) + (inXVelocity * inXVelocity)))); bool flickHorizontal = (abs(inXVelocity) > abs(inYVelocity)); +#ifdef IOS + bool flickUp = !flickHorizontal && (inYVelocity > 0) ? true : false; + bool flickRight = flickHorizontal && (inXVelocity < 0) ? true : false; +#else bool flickUp = !flickHorizontal && (inYVelocity < 0) ? true : false; bool flickRight = flickHorizontal && (inXVelocity > 0) ? true : false; - +#endif + if (mStage == STAGE_FILTERS) { if (flickHorizontal)