Skip to content

Commit

Permalink
Fixed calculation for relative angle.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirbyt committed Mar 1, 2012
1 parent beb4be3 commit a2013cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions KnobSample/KnobSample/ViewController.m
Expand Up @@ -54,7 +54,7 @@ - (void)viewDidLoad
[[self knobImageView] setUserInteractionEnabled:YES]; [[self knobImageView] setUserInteractionEnabled:YES];


// Allow rotation between the start and stop angles. // Allow rotation between the start and stop angles.
[self setStartAngle:270.0]; [self setStartAngle:-90.0];
[self setStopAngle:90.0]; [self setStopAngle:90.0];


[self resetKnob:self]; [self resetKnob:self];
Expand All @@ -64,7 +64,7 @@ - (void)rotated:(KTOneFingerRotationGestureRecognizer *)recognizer
{ {
CGFloat degrees = radiansToDegrees([recognizer rotation]); CGFloat degrees = radiansToDegrees([recognizer rotation]);
CGFloat currentAngle = [self currentAngle] + degrees; CGFloat currentAngle = [self currentAngle] + degrees;
CGFloat relativeAngle = fabsf(fmodf(currentAngle, 360.0)); // Converts to angle between 0 and 360 degrees. CGFloat relativeAngle = fmodf(currentAngle, 360.0); // Converts to angle between 0 and 360 degrees.


BOOL shouldRotate = NO; BOOL shouldRotate = NO;
if ([self startAngle] <= [self stopAngle]) { if ([self startAngle] <= [self stopAngle]) {
Expand Down

0 comments on commit a2013cd

Please sign in to comment.