Skip to content

Commit 6e58e21

Browse files
committed
Division/subdivision markers are misaligned #2
1 parent de0d543 commit 6e58e21

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

LMGaugeView.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "LMGaugeView"
4-
s.version = "1.0.1"
4+
s.version = "1.0.2"
55
s.summary = "LMGaugeView is a simple and customizable gauge control for iOS."
66
s.homepage = "https://github.com/lminhtm/LMGaugeView"
77
s.license = 'MIT'

LMGaugeView/LMGaugeView.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ - (void)strokeGauge
127127
/*!
128128
* Set progress for ring layer
129129
*/
130-
CGFloat progress = self.maxValue ? (self.value - self.minValue)/self.maxValue : 0;
130+
CGFloat progress = self.maxValue ? (self.value - self.minValue)/(self.maxValue - self.minValue) : 0;
131131
self.progressLayer.strokeEnd = progress;
132132

133133
/*!
@@ -183,7 +183,7 @@ - (void)drawRect:(CGRect)rect
183183
for (int j = 0; j <= self.numOfSubDivisions && self.numOfSubDivisions != 0; j++)
184184
{
185185
// Subdivisions
186-
CGFloat value = i * self.divisionUnitValue + j * self.divisionUnitValue/self.numOfSubDivisions;
186+
CGFloat value = i * self.divisionUnitValue + j * self.divisionUnitValue/self.numOfSubDivisions + self.minValue;
187187
CGFloat angle = [self angleFromValue:value];
188188
CGPoint dotCenter = CGPointMake(dotRadius * cos(angle) + center.x, dotRadius * sin(angle) + center.y);
189189
[self drawDotAtContext:context
@@ -194,7 +194,7 @@ - (void)drawRect:(CGRect)rect
194194
}
195195

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

0 commit comments

Comments
 (0)