Skip to content

Commit

Permalink
Division/subdivision markers are misaligned #2
Browse files Browse the repository at this point in the history
  • Loading branch information
lminhtm committed Jun 20, 2016
1 parent de0d543 commit 6e58e21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LMGaugeView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "LMGaugeView"
s.version = "1.0.1"
s.version = "1.0.2"
s.summary = "LMGaugeView is a simple and customizable gauge control for iOS."
s.homepage = "https://github.com/lminhtm/LMGaugeView"
s.license = 'MIT'
Expand Down
6 changes: 3 additions & 3 deletions LMGaugeView/LMGaugeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ - (void)strokeGauge
/*!
* Set progress for ring layer
*/
CGFloat progress = self.maxValue ? (self.value - self.minValue)/self.maxValue : 0;
CGFloat progress = self.maxValue ? (self.value - self.minValue)/(self.maxValue - self.minValue) : 0;
self.progressLayer.strokeEnd = progress;

/*!
Expand Down Expand Up @@ -183,7 +183,7 @@ - (void)drawRect:(CGRect)rect
for (int j = 0; j <= self.numOfSubDivisions && self.numOfSubDivisions != 0; j++)
{
// Subdivisions
CGFloat value = i * self.divisionUnitValue + j * self.divisionUnitValue/self.numOfSubDivisions;
CGFloat value = i * self.divisionUnitValue + j * self.divisionUnitValue/self.numOfSubDivisions + self.minValue;
CGFloat angle = [self angleFromValue:value];
CGPoint dotCenter = CGPointMake(dotRadius * cos(angle) + center.x, dotRadius * sin(angle) + center.y);
[self drawDotAtContext:context
Expand All @@ -194,7 +194,7 @@ - (void)drawRect:(CGRect)rect
}

// Divisions
CGFloat value = i * self.divisionUnitValue;
CGFloat value = i * self.divisionUnitValue + self.minValue;
CGFloat angle = [self angleFromValue:value];
CGPoint dotCenter = CGPointMake(dotRadius * cos(angle) + center.x, dotRadius * sin(angle) + center.y);
[self drawDotAtContext:context
Expand Down

0 comments on commit 6e58e21

Please sign in to comment.