Skip to content

Commit

Permalink
don't let the capacity bar get too small too quickly
Browse files Browse the repository at this point in the history
  • Loading branch information
c-alpha committed Aug 25, 2012
1 parent 41e2388 commit 9b1a618
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Battery Time Remaining/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ - (void)setStatusBarImage:(NSImage *)image title:(NSString *)title
// Image
[self.statusItem setImage:image];
[self.statusItem setAlternateImage:[self imageInvertColor:image]];

// Title
NSDictionary *attributedStyle = [NSDictionary dictionaryWithObjectsAndKeys:
// Font
[NSFont menuFontOfSize:12.0f],
NSFontAttributeName,
nil];
NSDictionary *attributedStyle = [NSDictionary dictionaryWithObjectsAndKeys:
// Font
[NSFont menuFontOfSize:12.0f],
NSFontAttributeName,
nil];

NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:title attributes:attributedStyle];
self.statusItem.attributedTitle = attributedTitle;
Expand Down Expand Up @@ -341,7 +341,7 @@ - (NSImage *)getBatteryIconPercent:(NSInteger)percent
const CGFloat capBarLeftOffset = 3.0f * drawingUnit;
CGFloat capBarHeight = [batteryLevelLeft size].height;
CGFloat capBarTopOffset = (([batteryOutline size].height - (EXTRA_TOP_OFFSET * drawingUnit)) - capBarHeight) / 2.0;
CGFloat capBarLength = floor(percent / 7.6f) * drawingUnit; // max width is 13 units
CGFloat capBarLength = ceil(percent / 8.0f) * drawingUnit; // max width is 13 units
if (capBarLength < (2 * drawingUnit)) { capBarLength = 2 * drawingUnit; }

[batteryOutline lockFocus];
Expand Down

0 comments on commit 9b1a618

Please sign in to comment.