@@ -189,16 +189,41 @@ - (void)drawRect:(CGRect)rect {
189
189
// ----- Animate Drawing -----//
190
190
// ---------------------------//
191
191
if (self.animationTime == 0 ) {
192
- [self .color set ];
192
+ if (self.enableRefrenceLines == YES ) {
193
+ [referenceLinesPath setLineWidth: self .lineWidth/2 ];
194
+
195
+ if (self.refrenceLineColor ) {
196
+ [self .refrenceLineColor set ];
197
+ } else {
198
+ [self .color set ];
199
+ }
200
+
201
+ [referenceLinesPath strokeWithBlendMode: kCGBlendModeNormal alpha: self .lineAlpha/2 ];
202
+ }
193
203
204
+ [self .color set ];
194
205
[line setLineWidth: self .lineWidth];
195
206
[line strokeWithBlendMode: kCGBlendModeNormal alpha: self .lineAlpha];
196
207
208
+ } else {
197
209
if (self.enableRefrenceLines == YES ) {
198
- [referenceLinesPath setLineWidth: self .lineWidth/2 ];
199
- [referenceLinesPath strokeWithBlendMode: kCGBlendModeNormal alpha: self .lineAlpha/2 ];
210
+ CAShapeLayer *referenceLinesPathLayer = [CAShapeLayer layer ];
211
+ referenceLinesPathLayer.frame = self.bounds ;
212
+ referenceLinesPathLayer.path = referenceLinesPath.CGPath ;
213
+ referenceLinesPathLayer.opacity = self.lineAlpha /2 ;
214
+ referenceLinesPathLayer.fillColor = nil ;
215
+ referenceLinesPathLayer.lineWidth = self.lineWidth /2 ;
216
+
217
+ if (self.refrenceLineColor ) {
218
+ referenceLinesPathLayer.strokeColor = self.refrenceLineColor .CGColor ;
219
+ } else {
220
+ referenceLinesPathLayer.strokeColor = self.color .CGColor ;
221
+ }
222
+
223
+ [self animateForLayer: referenceLinesPathLayer withAnimationType: self .animationType isAnimatingReferenceLine: YES ];
224
+ [self .layer addSublayer: referenceLinesPathLayer];
200
225
}
201
- } else {
226
+
202
227
CAShapeLayer *pathLayer = [CAShapeLayer layer ];
203
228
pathLayer.frame = self.bounds ;
204
229
pathLayer.path = line.CGPath ;
@@ -209,18 +234,6 @@ - (void)drawRect:(CGRect)rect {
209
234
pathLayer.lineCap = kCALineCapRound ;
210
235
[self animateForLayer: pathLayer withAnimationType: self .animationType isAnimatingReferenceLine: NO ];
211
236
[self .layer addSublayer: pathLayer];
212
-
213
- if (self.enableRefrenceLines == YES ) {
214
- CAShapeLayer *referenceLinesPathLayer = [CAShapeLayer layer ];
215
- referenceLinesPathLayer.frame = self.bounds ;
216
- referenceLinesPathLayer.path = referenceLinesPath.CGPath ;
217
- referenceLinesPathLayer.opacity = self.lineAlpha /2 ;
218
- referenceLinesPathLayer.strokeColor = self.color .CGColor ;
219
- referenceLinesPathLayer.fillColor = nil ;
220
- referenceLinesPathLayer.lineWidth = self.lineWidth /2 ;
221
- [self animateForLayer: referenceLinesPathLayer withAnimationType: self .animationType isAnimatingReferenceLine: YES ];
222
- [self .layer addSublayer: referenceLinesPathLayer];
223
- }
224
237
}
225
238
}
226
239
0 commit comments