Skip to content

Commit

Permalink
allow gestures in VoiceOver mode to unfold the left and right view
Browse files Browse the repository at this point in the history
  • Loading branch information
honcheng committed Dec 25, 2012
1 parent a5599f9 commit 3f44aa5
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion PaperFold/PaperFold/PaperFold/PaperFoldView.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ - (void)onContentViewPanned:(UIPanGestureRecognizer*)gesture
// cancel gesture if another animation has not finished yet
if ([self.animationTimer isValid]) return;

BOOL isVoiceOverRunning = UIAccessibilityIsVoiceOverRunning();

if ([gesture state]==UIGestureRecognizerStateBegan)
{
CGPoint velocity = [gesture velocityInView:self];
Expand All @@ -197,6 +199,25 @@ - (void)onContentViewPanned:(UIPanGestureRecognizer*)gesture
if (self.state==PaperFoldStateDefault)
{
self.paperFoldInitialPanDirection = PaperFoldInitialPanDirectionHorizontal;

if (isVoiceOverRunning)
{
if (velocity.x>0)
{
[self setPaperFoldState:PaperFoldStateLeftUnfolded animated:YES];
}
else if (velocity.x<0)
{
[self setPaperFoldState:PaperFoldStateRightUnfolded animated:YES];
}
}
}
else
{
if (isVoiceOverRunning)
{
[self setPaperFoldState:PaperFoldStateDefault animated:YES];
}
}
}
else
Expand All @@ -207,7 +228,7 @@ - (void)onContentViewPanned:(UIPanGestureRecognizer*)gesture
}
}
}
else
else if (!isVoiceOverRunning)
{
if (self.paperFoldInitialPanDirection==PaperFoldInitialPanDirectionHorizontal)
{
Expand Down

0 comments on commit 3f44aa5

Please sign in to comment.