@@ -52,8 +52,8 @@ - (instancetype)initWithFrame:(NSRect)frameRect tabline:(MMTabline *)tabline
5252 [self addSubview: _titleLabel];
5353
5454 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 ]];
5757 NSLayoutConstraint *centerConstraint = [NSLayoutConstraint constraintWithItem: self attribute: NSLayoutAttributeCenterX relatedBy: NSLayoutRelationEqual toItem: _titleLabel attribute: NSLayoutAttributeCenterX multiplier: 1 constant: 0 ];
5858 centerConstraint.priority = NSLayoutPriorityFittingSizeCompression +1 ;
5959 [self addConstraint: centerConstraint];
@@ -101,7 +101,6 @@ - (void)setState:(MMTabState)state
101101 if (state == MMTabStateSelected) {
102102 _closeButton.alphaValue = 1 ;
103103 _titleLabel.textColor = _tabline.tablineSelFgColor ?: NSColor .controlTextColor ;
104- _titleLabel.font = [NSFont systemFontOfSize: 11 weight: NSFontWeightMedium ];
105104 self.fillColor = _tabline.tablineSelBgColor ?: [NSColor colorNamed: @" TablineSel" ];
106105 self.shadow = _shadow;
107106 }
@@ -115,13 +114,11 @@ - (void)setState:(MMTabState)state
115114 _titleLabel.animator .textColor = _tabline.tablineFgColor ?: NSColor .disabledControlTextColor ;
116115 self.animator .fillColor = _tabline.tablineBgColor ?: [NSColor colorNamed: @" Tabline" ];
117116 }
118- _titleLabel.font = [NSFont systemFontOfSize: 11 ];
119117 self.shadow = nil ;
120118 }
121119 else { // state == MMTabStateUnselectedHover
122120 _closeButton.animator .alphaValue = 1 ;
123121 _titleLabel.animator .textColor = _tabline.tablineSelFgColor ?: NSColor .controlTextColor ;
124- _titleLabel.font = [NSFont systemFontOfSize: 11 ];
125122 self.animator .fillColor = self.unselectedHoverColor ;
126123 self.animator .shadow = _shadow;
127124 }
@@ -144,13 +141,14 @@ - (NSColor *)unselectedHoverColor
144141- (void )drawRect : (NSRect )dirtyRect
145142{
146143 [self .fillColor set ];
144+ CGFloat maxX = NSMaxX (self.bounds );
147145 NSBezierPath *p = [NSBezierPath new ];
148146 [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 )];
154152 [p closePath ];
155153 [p fill ];
156154}
0 commit comments