Skip to content

Commit

Permalink
perf(UI): adjust blue text button expandValue and vertical padding
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Dec 10, 2023
1 parent e16abb2 commit b9518f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface EZBlueTextButton : EZHoverButton

@property (nonatomic, assign) CGFloat expandValue; // default is 6.
@property (nonatomic, assign) CGFloat expandValue; // default is 5.

@property (nonatomic, copy, nullable) NSString *openURL;
@property (nonatomic, assign) BOOL closeWindowAfterOpeningURL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ @implementation EZBlueTextButton

- (instancetype)initWithFrame:(NSRect)frameRect {
if (self = [super initWithFrame:frameRect]) {
self.expandValue = 6;
self.expandValue = 5;
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static const CGFloat kHorizontalMargin_8 = 8;
static const CGFloat kVerticalMargin_12 = 12;
static const CGFloat kVerticalPadding_6 = 6;
static const CGFloat kBlueTextButtonVerticalPadding_3 = 3;
static const CGFloat kBlueTextButtonVerticalPadding_2 = 2;

static NSString *const kAppleDictionaryURIScheme = @"x-dictionary";

Expand Down Expand Up @@ -652,13 +652,13 @@ - (void)refreshWithResult:(EZQueryResult *)result {
exceptedWidth += leftOffset;
make.left.offset(leftOffset); // Since button has been expanded, so need to be shifted to the left.
if (partLabel) {
CGFloat topOffset = kBlueTextButtonVerticalPadding_3;
CGFloat topOffset = kBlueTextButtonVerticalPadding_2;
height += topOffset;
make.top.equalTo(partLabel.mas_bottom).offset(topOffset);
} else {
CGFloat topOffset = kHorizontalMargin_8;
if (lastView) {
topOffset = kBlueTextButtonVerticalPadding_3;
topOffset = kBlueTextButtonVerticalPadding_2;
if (idx == 0) {
topOffset = 8;
}
Expand Down Expand Up @@ -971,7 +971,7 @@ - (NSView *)buildSynonymsAndAntonymsView:(NSString *)title parts:(NSArray<EZTran
}];

[wrapView mas_makeConstraints:^(MASConstraintMaker *make) {
CGFloat topOffset = kBlueTextButtonVerticalPadding_3;
CGFloat topOffset = kBlueTextButtonVerticalPadding_2;
make.top.equalTo(rtnView.mas_bottom).offset(topOffset);
*height += topOffset;
make.left.equalTo(partLabel.mas_right);
Expand Down

0 comments on commit b9518f1

Please sign in to comment.