@@ -52,8 +52,8 @@ - (instancetype)initWithFrame:(NSRect)frameRect tabline:(MMTabline *)tabline
52
52
[self addSubview: _titleLabel];
53
53
54
54
NSDictionary *viewDict = NSDictionaryOfVariableBindings(_closeButton, _titleLabel);
55
- [self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" H:|-7 -[_closeButton]-(>=5)-[_titleLabel]-(>=8 )-|" options: NSLayoutFormatAlignAllCenterY metrics: nil views: viewDict]];
56
- [self addConstraint: [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeCenterY relatedBy: NSLayoutRelationEqual toItem: _titleLabel attribute: NSLayoutAttributeCenterY multiplier: 1 constant: 0 ]];
55
+ [self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" H:|-9 -[_closeButton]-(>=5)-[_titleLabel]-(>=16 )-|" options: NSLayoutFormatAlignAllCenterY metrics: nil views: viewDict]];
56
+ [self addConstraint: [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeCenterY relatedBy: NSLayoutRelationEqual toItem: _titleLabel attribute: NSLayoutAttributeCenterY multiplier: 1 constant: - 2 ]];
57
57
NSLayoutConstraint *centerConstraint = [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeCenterX relatedBy: NSLayoutRelationEqual toItem: _titleLabel attribute: NSLayoutAttributeCenterX multiplier: 1 constant: 0 ];
58
58
centerConstraint.priority = NSLayoutPriorityFittingSizeCompression +1 ;
59
59
[self addConstraint: centerConstraint];
@@ -101,7 +101,6 @@ - (void)setState:(MMTabState)state
101
101
if (state == MMTabStateSelected) {
102
102
_closeButton.alphaValue = 1 ;
103
103
_titleLabel.textColor = _tabline.tablineSelFgColor ?: NSColor .controlTextColor ;
104
- _titleLabel.font = [NSFont systemFontOfSize: 11 weight: NSFontWeightMedium ];
105
104
self.fillColor = _tabline.tablineSelBgColor ?: [NSColor colorNamed: @" TablineSel" ];
106
105
self.shadow = _shadow;
107
106
}
@@ -115,13 +114,11 @@ - (void)setState:(MMTabState)state
115
114
_titleLabel.animator .textColor = _tabline.tablineFgColor ?: NSColor .disabledControlTextColor ;
116
115
self.animator .fillColor = _tabline.tablineBgColor ?: [NSColor colorNamed: @" Tabline" ];
117
116
}
118
- _titleLabel.font = [NSFont systemFontOfSize: 11 ];
119
117
self.shadow = nil ;
120
118
}
121
119
else { // state == MMTabStateUnselectedHover
122
120
_closeButton.animator .alphaValue = 1 ;
123
121
_titleLabel.animator .textColor = _tabline.tablineSelFgColor ?: NSColor .controlTextColor ;
124
- _titleLabel.font = [NSFont systemFontOfSize: 11 ];
125
122
self.animator .fillColor = self.unselectedHoverColor ;
126
123
self.animator .shadow = _shadow;
127
124
}
@@ -144,13 +141,14 @@ - (NSColor *)unselectedHoverColor
144
141
- (void )drawRect : (NSRect )dirtyRect
145
142
{
146
143
[self .fillColor set ];
144
+ CGFloat maxX = NSMaxX (self.bounds );
147
145
NSBezierPath *p = [NSBezierPath new ];
148
146
[p moveToPoint: NSZeroPoint ];
149
- [p lineToPoint: NSMakePoint (3.6 , NSMaxY ( self .bounds) - 2.5 )];
150
- [p curveToPoint: NSMakePoint (6.5 , NSMaxY ( self .bounds)) controlPoint1: NSMakePoint (3.8 , NSMaxY ( self .bounds) - 1 ) controlPoint2: NSMakePoint (5.1 , NSMaxY ( self .bounds) )];
151
- [p lineToPoint: NSMakePoint (NSMaxX ( self .bounds) - 6.5 , NSMaxY ( self .bounds) )];
152
- [p curveToPoint: NSMakePoint (NSMaxX ( self .bounds) - 3.6 , NSMaxY ( self .bounds) - 2.5 ) controlPoint1: NSMakePoint (NSMaxX ( self .bounds) - 5.1 , NSMaxY ( self .bounds)) controlPoint2: NSMakePoint (NSMaxX ( self .bounds) - 3.8 , NSMaxY ( self .bounds) - 1 )];
153
- [p lineToPoint: NSMakePoint (NSMaxX ( self .bounds) , 0 )];
147
+ [p lineToPoint: NSMakePoint (5.41 , 20.76 )];
148
+ [p curveToPoint: NSMakePoint (8.32 , 23 ) controlPoint1: NSMakePoint (5.76 , 22.08 ) controlPoint2: NSMakePoint (6.95 , 23 )];
149
+ [p lineToPoint: NSMakePoint (maxX - 8.32 , 23 )];
150
+ [p curveToPoint: NSMakePoint (maxX - 5.41 , 20.76 ) controlPoint1: NSMakePoint (maxX - 6.95 , 23 ) controlPoint2: NSMakePoint (maxX - 5.76 , 22.08 )];
151
+ [p lineToPoint: NSMakePoint (maxX , 0 )];
154
152
[p closePath ];
155
153
[p fill ];
156
154
}
0 commit comments