From 71079db99f4c2b02d45d229bee84907fb814de0b Mon Sep 17 00:00:00 2001 From: Bradley Sepos Date: Wed, 21 Dec 2016 01:00:25 -0500 Subject: macgui: Tweak queue toolbar icon badge. Text should be centered within the ellipse now. Align badge to bottom left of icon. --- macosx/HBToolbarBadgedItem.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'macosx/HBToolbarBadgedItem.m') 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]; -- cgit v1.2.3