Skip to content

Commit

Permalink
Adjust the presentation to closer match what Finder does
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekazakov committed Jan 22, 2024
1 parent 844730a commit b7c057e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Source/Panel/include/Panel/UI/TagsPresentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace nc::panel {

struct TrailingTagsInplaceDisplay {
static constexpr int MaxDrawn = 3;
static constexpr int Diameter = 10;
static constexpr int Diameter = 9;
static constexpr int Step = 5;
static constexpr int Margin = 8;

Expand Down
24 changes: 12 additions & 12 deletions Source/Panel/source/UI/TagsPresentation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
if( num_colors_to_draw == 0 )
return;

constexpr double radius = static_cast<double>(Diameter / 2);
constexpr double radius = static_cast<double>(Diameter) / 2.;
constexpr double spacing = static_cast<double>(Step);
static NSBezierPath *const circle = [] {
NSBezierPath *circle = [NSBezierPath bezierPath];
Expand All @@ -81,33 +81,33 @@
static NSBezierPath *const shadow = [] {
NSBezierPath *shadow = [NSBezierPath bezierPath];
[shadow appendBezierPathWithArcWithCenter:NSMakePoint(0., 0.) radius:radius + 1. startAngle:0 endAngle:360];
[shadow setLineWidth:1.];
[shadow setLineWidth:2.0];
return shadow;
}();

NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
for( ssize_t i = num_colors_to_draw - 1; i >= 0; --i ) {
[currentContext saveGraphicsState];

auto colors = Color(colors_to_draw[i]);
[colors.first setFill];
if( _accent )
[_accent setStroke];
else
[colors.second setStroke];

NSAffineTransform *tr = [NSAffineTransform transform];
[tr translateXBy:_offset_x + i * spacing yBy:_view_height / 2.];
[tr concat];

[circle fill];
[circle stroke];

if( i < static_cast<ssize_t>(num_colors_to_draw) - 1 ) {
[_background setStroke];
[shadow stroke];
}

auto colors = Color(colors_to_draw[i]);
[colors.first setFill];
if( _accent )
[_accent setStroke];
else
[colors.second setStroke];

[circle fill];
[circle stroke];

[currentContext restoreGraphicsState];
}
}
Expand Down

0 comments on commit b7c057e

Please sign in to comment.