diff options
author | Bradley Sepos <[email protected]> | 2016-12-21 01:00:25 -0500 |
---|---|---|
committer | Bradley Sepos <[email protected]> | 2016-12-21 01:00:25 -0500 |
commit | 71079db99f4c2b02d45d229bee84907fb814de0b (patch) | |
tree | f5beda402e581636adf73b423512ebd6566802d8 /macosx/HBToolbarBadgedItem.m | |
parent | 2823fa6460fb12666d9a5a649ae62ad8b052ddd3 (diff) |
macgui: Tweak queue toolbar icon badge.
Text should be centered within the ellipse now. Align badge to bottom left of icon.
Diffstat (limited to 'macosx/HBToolbarBadgedItem.m')
-rw-r--r-- | macosx/HBToolbarBadgedItem.m | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/macosx/HBToolbarBadgedItem.m b/macosx/HBToolbarBadgedItem.m index dd91d9be6..b149dc0aa 100644 --- a/macosx/HBToolbarBadgedItem.m +++ b/macosx/HBToolbarBadgedItem.m @@ -162,7 +162,7 @@ NSPoint indent = NSMakePoint(10 * scaleFactor, 2 * scaleFactor); CGFloat radius = (textBounds.size.height + indent.y) * 0.5f; - NSRect badgeRect = NSMakeRect(size.width - textBounds.size.width - indent.x, size.height - textBounds.size.height - indent.y, + NSRect badgeRect = NSMakeRect(0, 0, textBounds.size.width + indent.x, textBounds.size.height + indent.y); badgeRect = NSIntegralRect(badgeRect); @@ -189,16 +189,17 @@ CGContextDrawPath(context, kCGPathFill); // Draw the text - badgeRect.origin.x = CGRectGetMidX(badgeRect) - (textBounds.size.width * 0.5f); - badgeRect.origin.x -= (textBounds.size.width - textBounds.size.width) * 0.5f; + badgeRect.origin.x = CGRectGetMidX(badgeRect); + badgeRect.origin.x -= textBounds.origin.x / 2; + badgeRect.origin.x -= ((textBounds.size.width - textBounds.origin.x) * 0.5f); badgeRect.origin.y = CGRectGetMidY(badgeRect); badgeRect.origin.y -= textBounds.origin.y / 2; badgeRect.origin.y -= ((textBounds.size.height - textBounds.origin.y) * 0.5f); + badgeRect.origin.x = floor(badgeRect.origin.x); badgeRect.origin.y = floor(badgeRect.origin.y); - badgeRect.origin.x = ceil(badgeRect.origin.x); - badgeRect.size.height = textBounds.size.height; badgeRect.size.width = textBounds.size.width; + badgeRect.size.height = textBounds.size.height; [badgeString drawInRect:badgeRect withAttributes:attr]; |