Skip to content

Commit

Permalink
Fix name height mis calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
morajabi committed Dec 29, 2024
1 parent 5fed924 commit be10d79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apple/InlineMac/Utils/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum Theme {
// Space between avatar and content
static let messageHorizontalStackSpacing: CGFloat = 8
static let messageVerticalStackSpacing: CGFloat = 2.0
static let messageNameLabelHeight: CGFloat = 16
static let messageNameLabelHeight: CGFloat = 14
static let messageTextFont: NSFont = .systemFont(ofSize: NSFont.systemFontSize)
static let messageTextLineFragmentPadding: CGFloat = 0
static let messageTextContainerInset: NSSize = .zero
Expand Down
6 changes: 4 additions & 2 deletions apple/InlineMac/Views/Chat/Message/MessageViewAppKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class MessageViewAppKit: NSView {
let avatarLeading = Theme.messageSidePadding
let contentLeading = avatarLeading + Self.avatarSize + Theme.messageHorizontalStackSpacing - bgPadding
let sidePadding = Theme.messageSidePadding - bgPadding
let senderNameLeadingPadding = hasBubble ? 4.0 : 0.0
let senderNameLeadingPadding = hasBubble ? 6.0 : 0.0

if props.firstInGroup {
topPadding += Theme.messageGroupSpacing
Expand All @@ -277,7 +277,9 @@ class MessageViewAppKit: NSView {
NSLayoutConstraint.activate([
nameLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: contentLeading + senderNameLeadingPadding),
nameLabel.topAnchor.constraint(equalTo: topAnchor, constant: topPadding),
nameLabel.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor, constant: -sidePadding)
nameLabel.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor, constant: -sidePadding),
nameLabel.heightAnchor
.constraint(equalToConstant: Theme.messageNameLabelHeight),
])
}

Expand Down

0 comments on commit be10d79

Please sign in to comment.