diff --git a/Easydict/Feature/PerferenceWindow/EZSettingViewController.m b/Easydict/Feature/PerferenceWindow/EZSettingViewController.m index 2f19f8bb0..b2f937614 100644 --- a/Easydict/Feature/PerferenceWindow/EZSettingViewController.m +++ b/Easydict/Feature/PerferenceWindow/EZSettingViewController.m @@ -772,20 +772,22 @@ - (void)updateViewConstraints { [self.fontSizeLabel mas_remakeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.autoGetSelectedTextLabel); - make.top.equalTo(self.showAppleDictionaryQuickLinkButton.mas_bottom).offset(self.verticalPadding); + make.top.equalTo(self.showAppleDictionaryQuickLinkButton.mas_bottom).offset(20); }]; + CGFloat changeFontSizeViewWidth = 200; [self.changeFontSizeView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.fontSizeLabel.mas_right).offset(self.horizontalPadding + 2); make.centerY.equalTo(self.fontSizeLabel); - make.width.mas_equalTo(200); + make.width.mas_equalTo(changeFontSizeViewWidth); make.height.mas_equalTo(30); }]; [self.fontSizeHintView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.fontSizeLabel.mas_right).offset(self.horizontalPadding); - make.top.equalTo(self.changeFontSizeView.mas_bottom).mas_offset(5); - make.width.mas_equalTo(300); + make.top.equalTo(self.changeFontSizeView.mas_bottom).mas_offset(8); + make.width.mas_equalTo(changeFontSizeViewWidth + 5); + make.height.mas_equalTo(45); }]; [self.separatorView2 mas_remakeConstraints:^(MASConstraintMaker *make) { diff --git a/Easydict/Feature/ViewController/View/ChangeFontSizeView/FontSizeHintView.swift b/Easydict/Feature/ViewController/View/ChangeFontSizeView/FontSizeHintView.swift index 666242fcd..762d69518 100644 --- a/Easydict/Feature/ViewController/View/ChangeFontSizeView/FontSizeHintView.swift +++ b/Easydict/Feature/ViewController/View/ChangeFontSizeView/FontSizeHintView.swift @@ -8,6 +8,8 @@ import AppKit import Foundation +import Hue +import SnapKit @objc public class FontSizeHintView: NSView { private lazy var minLabel: NSTextField = .init(labelWithString: NSLocalizedString("small", comment: "")) @@ -21,42 +23,25 @@ import Foundation minLabel.font = .systemFont(ofSize: 10) maxLabel.font = .systemFont(ofSize: 14) - hintLabel.font = .systemFont(ofSize: 11) + hintLabel.textColor = NSColor(hex: "7B7C7C") - let sizeLabelStackView: NSStackView = { - let stackView = NSStackView(views: [minLabel, maxLabel]) - stackView.alignment = .centerY - stackView.distribution = .equalSpacing - stackView.orientation = .horizontal - return stackView - }() - - let verticalStackView: NSStackView = { - let stackView = NSStackView(views: [sizeLabelStackView, hintLabel]) - stackView.alignment = .left - stackView.distribution = .fill - stackView.orientation = .vertical - stackView.spacing = 12 - return stackView - }() - - addSubview(verticalStackView) + addSubview(minLabel) + addSubview(maxLabel) + addSubview(hintLabel) - NSLayoutConstraint.activate([ - sizeLabelStackView.widthAnchor.constraint(equalToConstant: 205), - sizeLabelStackView.heightAnchor.constraint(equalToConstant: 20), - ]) + hintLabel.snp.makeConstraints { make in + make.left.bottom.equalTo(self) + } - NSLayoutConstraint.activate([ - verticalStackView.leftAnchor.constraint(equalTo: leftAnchor), - verticalStackView.topAnchor.constraint(equalTo: topAnchor), - verticalStackView.rightAnchor.constraint(equalTo: rightAnchor), - ]) + maxLabel.snp.makeConstraints { make in + make.right.top.equalTo(self) + } - NSLayoutConstraint.activate([ - bottomAnchor.constraint(equalTo: verticalStackView.bottomAnchor), - ]) + minLabel.snp.makeConstraints { make in + make.left.equalTo(self) + make.centerY.equalTo(maxLabel) + } } @available(*, unavailable)