Browse files

naming things is hard

  • Loading branch information...
1 parent be7bf1e commit 6d80b120ecad05f9b6bd9a03ee6beac9850b9245 Jonathan Penn committed Jan 8, 2014
Showing with 7 additions and 6 deletions.
  1. +7 −6 Pig Spinner/Pig Spinner/RCWSpinnerViewController.m
View
13 Pig Spinner/Pig Spinner/RCWSpinnerViewController.m
@@ -83,15 +83,15 @@ - (void)positionViewsInSize:(CGSize)size
self.spinnerBehavior.action = ^{
CGAffineTransform transform = [(UIView *)weakSelf.spinnerBehavior.items.firstObject transform];
CGFloat angle = atan2(transform.b, transform.a);
- [weakSelf highlightSegmentAtAngle:angle];
+ [weakSelf showNameOfSegmentAtAngle:angle];
};
[self.animator addBehavior:self.spinnerBehavior];
self.what.center = CGPointMake(self.background.center.x, self.background.center.y + side/2.4);
}
-- (void)highlightSegmentAtAngle:(CGFloat)angle
+- (void)showNameOfSegmentAtAngle:(CGFloat)angle
{
if (angle > 0 && angle <= 1.230600) {
self.what.text = @"2 FENCES";
@@ -116,13 +116,14 @@ - (void)dragged:(RCWQuickDragRecognizer *)recognizer
case UIGestureRecognizerStateEnded:
case UIGestureRecognizerStateCancelled: {
CGPoint velocity = [recognizer velocityInView:self.background];
- CGFloat angle = 0;
+ CGFloat amount;
if (fabs(velocity.x) > fabs(velocity.y)) {
- angle = velocity.x;
+ amount = velocity.x;
} else {
- angle = velocity.y;
+ amount = velocity.y;
}
- [self.spinnerBehavior addAngularVelocity:0-angle forItem:self.spinner];
+ if (amount < 0) amount *= -1;
+ [self.spinnerBehavior addAngularVelocity:amount forItem:self.spinner];
break;
}

0 comments on commit 6d80b12

Please sign in to comment.