Skip to content

Commit fa6df66

Browse files
committed
Use CGRectInset to expand rect
1 parent 1791c58 commit fa6df66

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

NMRangeSlider/NMRangeSlider.m

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,11 @@ -(void)layoutSubviews
393393
// TODO: Do it the correct way. I think wwdc 2012 had a video on it...
394394
- (CGRect) touchRectForHandle:(UIImageView*) handleImageView
395395
{
396-
float xPadding = 10;
397-
float yPadding = 10; //(self.bounds.size.height-touchRect.size.height)/2.0f
398-
399-
CGRect touchRect = handleImageView.frame;
400-
touchRect.origin.x -= xPadding/2.0;
401-
touchRect.origin.y -= yPadding/2.0;
402-
touchRect.size.height += xPadding;
403-
touchRect.size.width += yPadding;
396+
float xPadding = 5;
397+
float yPadding = 5; //(self.bounds.size.height-touchRect.size.height)/2.0f
398+
399+
// expands rect by xPadding in both x-directions, and by yPadding in both y-directions
400+
CGRect touchRect = CGRectInset(handleImageView.frame, -xPadding, -yPadding);;
404401
return touchRect;
405402
}
406403

0 commit comments

Comments
 (0)