Skip to content

Commit

Permalink
fix where prev color view didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
Bailey Seymour committed Aug 5, 2015
1 parent d48f286 commit cdc39fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PFColorAlert.mm
Expand Up @@ -190,7 +190,7 @@ - (PFColorAlert *)initWithStartColor:(UIColor *)startColor showAlpha:(BOOL)showA
[self.saturationSlider updateGraphicsWithColor:startColor];
[self.brightnessSlider updateGraphicsWithColor:startColor];
[self.alphaSlider updateGraphicsWithColor:startColor];
// [self.litePreviewView setMainColor:[UIColor colorWithHue:startColor.hue saturation:startColor.saturation brightness:startColor.brightness alpha:startColor.alpha] previousColor:startColor];
[self.litePreviewView setMainColor:[UIColor colorWithHue:startColor.hue saturation:startColor.saturation brightness:startColor.brightness alpha:startColor.alpha] previousColor:startColor];

[self setPrimaryColor:startColor];

Expand Down
1 change: 1 addition & 0 deletions PFColorLitePreviewView.h
Expand Up @@ -5,4 +5,5 @@
@property (nonatomic, retain) UIColor *previousColor;
- (void)updateWithColor:(UIColor *)color;
- (id)initWithFrame:(CGRect)frame mainColor:(UIColor *)mc previousColor:(UIColor *)prev;
- (void)setMainColor:(UIColor *)mc previousColor:(UIColor *)prev;
@end
14 changes: 10 additions & 4 deletions PFColorLitePreviewView.m
Expand Up @@ -15,17 +15,23 @@ - (void)updateWithColor:(UIColor *)color
[self setNeedsDisplay];
}

- (void)setMainColor:(UIColor *)mc previousColor:(UIColor *)prev
{
self.mainColor = mc;
if (prev) self.previousColor = prev;
}

- (id)initWithFrame:(CGRect)frame mainColor:(UIColor *)mc previousColor:(UIColor *)prev
{
self = [super initWithFrame:frame];

if (self)
{
self.mainColor = mc;

if (prev) self.previousColor = prev;
[self setBackgroundColor:[UIColor clearColor]];

[self setNeedsDisplay];
}

Expand All @@ -36,7 +42,7 @@ - (void)drawRect:(CGRect)rect
{

if (!self.mainColor) self.mainColor = [UIColor whiteColor];

CGContextRef context = UIGraphicsGetCurrentContext();

// CGContextSetLineWidth(context, 4.0);
Expand Down Expand Up @@ -107,7 +113,7 @@ - (void)drawRect:(CGRect)rect
CGContextSetFillColorWithColor(context, self.previousColor.CGColor);
CGContextDrawPath(context, kCGPathEOFill);
}
else
else
{
CGContextAddArc(context, rect.size.width / 2, rect.size.height / 2, rect.size.width / 3, 0, 2 * M_PI, 1);
CGContextSetFillColorWithColor(context, self.mainColor.CGColor);
Expand Down

0 comments on commit cdc39fb

Please sign in to comment.