Skip to content

Commit

Permalink
Updated to highlight a drag path too close to the center.
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyboy committed Mar 1, 2012
1 parent 9c228b0 commit 0413d8c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Binary file not shown.
17 changes: 15 additions & 2 deletions RotaryWheelProject/SMRotaryWheel.m
Expand Up @@ -206,8 +206,6 @@ - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
return NO;
}



float dx = touchPoint.x - container.center.x;
float dy = touchPoint.y - container.center.y;
deltaAngle = atan2(dy,dx);
Expand All @@ -225,6 +223,21 @@ - (BOOL)continueTrackingWithTouch:(UITouch*)touch withEvent:(UIEvent*)event
{

CGPoint pt = [touch locationInView:self];

float dist = [self calculateDistanceFromCenter:pt];

if (dist < 40 || dist > 100)
{
// a drag path too close to the center
NSLog(@"drag path too close to the center (%f,%f)", pt.x, pt.y);

// here you might want to implement your solution when the drag
// is too close to the center
// You might go back to the clove previously selected
// or you might calculate the clove corresponding to
// the "exit point" of the drag.

}

float dx = pt.x - container.center.x;
float dy = pt.y - container.center.y;
Expand Down

0 comments on commit 0413d8c

Please sign in to comment.