Skip to content

Commit

Permalink
Merge pull request #4 from adamjuhasz/master
Browse files Browse the repository at this point in the history
strokeColor is cached when changing drawingColor, affecting first points
  • Loading branch information
lauraskelton committed Jun 21, 2015
2 parents 7532036 + 2d9a7d6 commit 175ee54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Example/jot/ExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ - (void)toggleDrawingButtonAction

} else if (self.jotViewController.state == JotViewStateText) {
self.jotViewController.state = JotViewStateDrawing;
self.jotViewController.drawingColor = [UIColor colorWithRed:((double)arc4random()/UINT32_MAX) green:((double)arc4random()/UINT32_MAX) blue:((double)arc4random()/UINT32_MAX) alpha:1.0];
[self.toggleDrawingButton setTitle:kTextImageName forState:UIControlStateNormal];
}
}
Expand Down
6 changes: 6 additions & 0 deletions jot/JotDrawView.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ - (CGFloat)strokeWidthForVelocity:(CGFloat)velocity
return self.strokeWidth - ((self.strokeWidth * (1.f - kJotRelativeMinStrokeWidth)) / (1.f + (CGFloat)pow((double)M_E, (double)(-((velocity - self.initialVelocity) / self.initialVelocity)))));
}

- (void)setStrokeColor:(UIColor *)strokeColor
{
_strokeColor = strokeColor;
self.bezierPath = nil;
}

- (JotTouchBezier *)bezierPath
{
if (!_bezierPath) {
Expand Down

0 comments on commit 175ee54

Please sign in to comment.