Sitelet https://github.com/wmfgithub/core-plot/commit/d036329ce7dab635ac9c9900f416c052b0ba6608
Skip to content

Commit d036329

Browse files
committed
Fixed animations given a starting location of NAN; they should start at the current value of the animated property.
1 parent 717632b commit d036329

7 files changed

Lines changed: 28 additions & 2 deletions

‎framework/Source/CPTAnimation.m‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ -(void)update
328328
started = YES;
329329
}
330330
if ( !animationOperation.isCanceled ) {
331+
if ( !period.startValue ) {
332+
[period setStartValueFromObject:animationOperation.boundObject propertyGetter:animationOperation.boundGetter];
333+
}
334+
331335
CGFloat progress = timingFunction(currentTime - startTime, duration);
332336

333337
NSDictionary *parameters = @{

‎framework/Source/_CPTAnimationCGFloatPeriod.m‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett
4040
CGFloat start;
4141
CGFloat end;
4242

43+
if ( !self.startValue ) {
44+
[self setStartValueFromObject:boundObject propertyGetter:boundGetter];
45+
}
46+
4347
[self.startValue getValue:&start];
4448
[self.endValue getValue:&end];
4549

‎framework/Source/_CPTAnimationCGPointPeriod.m‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ CGPoint currentPointValue(id boundObject, SEL boundGetter)
2121

2222
[invocation invoke];
2323

24-
[invocation invoke];
25-
2624
CGPoint value;
2725
[invocation getReturnValue:&value];
2826

@@ -42,6 +40,10 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett
4240
CGPoint start;
4341
CGPoint end;
4442

43+
if ( !self.startValue ) {
44+
[self setStartValueFromObject:boundObject propertyGetter:boundGetter];
45+
}
46+
4547
[self.startValue getValue:&start];
4648
[self.endValue getValue:&end];
4749

‎framework/Source/_CPTAnimationCGRectPeriod.m‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett
4040
CGRect start;
4141
CGRect end;
4242

43+
if ( !self.startValue ) {
44+
[self setStartValueFromObject:boundObject propertyGetter:boundGetter];
45+
}
46+
4347
[self.startValue getValue:&start];
4448
[self.endValue getValue:&end];
4549

‎framework/Source/_CPTAnimationCGSizePeriod.m‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett
4040
CGSize start;
4141
CGSize end;
4242

43+
if ( !self.startValue ) {
44+
[self setStartValueFromObject:boundObject propertyGetter:boundGetter];
45+
}
46+
4347
[self.startValue getValue:&start];
4448
[self.endValue getValue:&end];
4549

‎framework/Source/_CPTAnimationNSDecimalPeriod.m‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ -(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter
3838

3939
-(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter
4040
{
41+
if ( !self.startValue ) {
42+
[self setStartValueFromObject:boundObject propertyGetter:boundGetter];
43+
}
44+
4145
NSDecimal current = currentDecimalValue(boundObject, boundGetter);
4246
NSDecimal start = [(NSDecimalNumber *)self.startValue decimalValue];
4347
NSDecimal end = [(NSDecimalNumber *)self.endValue decimalValue];

‎framework/Source/_CPTAnimationPlotRangePeriod.m‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ -(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter
1515

1616
-(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter
1717
{
18+
if ( !self.startValue ) {
19+
[self setStartValueFromObject:boundObject propertyGetter:boundGetter];
20+
}
21+
1822
typedef CPTPlotRange *(*GetterType)(id, SEL);
1923
GetterType getterMethod = (GetterType)[boundObject methodForSelector : boundGetter];
2024

0 commit comments

Comments
 (0)