Permalink
Browse files

Fix icon bounce in app with vertical dock

  • Loading branch information...
eswick committed Feb 3, 2015
1 parent fc563f5 commit f7d359cf17c4eea1dcac7c2779e72026ad6a6485
Showing with 19 additions and 3 deletions.
  1. +13 −2 CAKeyframeAnimation+dockBounce.m
  2. +6 −1 Tweak.m
@@ -1,4 +1,9 @@
#define UIApp ([UIApplication sharedApplication])
#define cur_orientation ([UIApp statusBarOrientation])
#define in_landscape (UIInterfaceOrientationIsLandscape(cur_orientation) && UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)
@implementation CAKeyframeAnimation (DockBounce)
+ (CAKeyframeAnimation *)dockBounceAnimationWithIconHeight:(CGFloat)iconHeight {
@@ -11,11 +16,17 @@ + (CAKeyframeAnimation *)dockBounceAnimationWithIconHeight:(CGFloat)iconHeight {
{
CGFloat positionOffset = factors[i]/128.0f * iconHeight;
//CATransform3D transform = CATransform3DMakeTranslation(0, , 0);
[values addObject:[NSNumber numberWithFloat:-positionOffset]];
}
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
CAKeyframeAnimation *animation;
if (in_landscape) {
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.x"];
} else {
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
}
animation.repeatCount = 1;
animation.duration = 32.0f/30.0f;
animation.fillMode = kCAFillModeForwards;
@@ -803,7 +803,12 @@ - (void)layoutSubviews {
SBDockIconListView *dockListView = [[objc_getClass("SBIconController") sharedInstance] dockListView];
CGRect frame = self.frame;
frame.origin.y += (self.bounds.size.height - [dockListView iconCenterY]) + ([dockListView collapsedIconWidth] / 2) + ([objc_getClass("SBIconBadgeView") _overhang].y * [dockListView collapsedIconScale]);
if (in_landscape) {
frame.origin.x += (self.bounds.size.width - [dockListView iconCenterY]) + ([dockListView collapsedIconWidth] / 2) + ([objc_getClass("SBIconBadgeView") _overhang].x * [dockListView collapsedIconScale]);
} else {
frame.origin.y += (self.bounds.size.height - [dockListView iconCenterY]) + ([dockListView collapsedIconWidth] / 2) + ([objc_getClass("SBIconBadgeView") _overhang].y * [dockListView collapsedIconScale]);
}
[bounceWindow setFrame:frame];
}

0 comments on commit f7d359c

Please sign in to comment.