Skip to content

Commit

Permalink
Disabled implicit animations on MMCoverFlowLayers replicatorLayer
Browse files Browse the repository at this point in the history
- no implicit animations for bounds, position and instanceTransform
  • Loading branch information
mmllr committed Apr 2, 2014
1 parent 3b1d6df commit 8eb7d90
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Classes/osx/MMCoverFlowLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ + (CAReplicatorLayer*)createReplicatorLayer
layer.preservesDepth = YES;
layer.instanceBlueOffset = layer.instanceGreenOffset = layer.instanceRedOffset = kDefaultReflectionOffset;
layer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
[layer mm_disableImplicitAnimationForKey:NSStringFromSelector(@selector(instanceTransform))];
[layer mm_disableImplicitPositionAndBoundsAnimations];
return layer;
}

Expand Down Expand Up @@ -235,6 +237,7 @@ - (void)layoutSublayers
}
self.layout.visibleSize = self.bounds.size;
self.replicatorLayer.instanceTransform = CATransform3DConcat( CATransform3DMakeScale(1, -1, 1), CATransform3DMakeTranslation(0, -self.layout.itemSize.height, 0));

[CATransaction begin];
[CATransaction setDisableActions:self.inLiveResize];
[CATransaction setAnimationDuration:self.scrollDuration];
Expand Down
18 changes: 18 additions & 0 deletions Classes/osx/Specs/MMCoverFlowLayerSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,24 @@ software and associated documentation files (the "Software"), to deal in the Sof
it(@"should have an instanceBlueOffset equal to reflectionOffset", ^{
[[theValue(replicatorLayer.instanceBlueOffset) should] equal:sut.reflectionOffset withDelta:.000001];
});
context(@"core animation actions", ^{
__block NSDictionary *actions = nil;
beforeEach(^{
actions = replicatorLayer.actions;
});
afterEach(^{
actions = nil;
});
it(@"should have disabled the bounds action", ^{
[[actions[NSStringFromSelector(@selector(bounds))] should] equal:[NSNull null]];
});
it(@"should have disabled the position action", ^{
[[actions[NSStringFromSelector(@selector(position))] should] equal:[NSNull null]];
});
it(@"should have disabled the instanceTransform action", ^{
[[actions[NSStringFromSelector(@selector(instanceTransform))] should] equal:[NSNull null]];
});
});
context(NSStringFromSelector(@selector(instanceTransform)), ^{
__block NSValue *expectedTransform = nil;
beforeEach(^{
Expand Down

0 comments on commit 8eb7d90

Please sign in to comment.