From be10d79c6e48c0954339b4d97576ba24005a4ad3 Mon Sep 17 00:00:00 2001 From: Mohamad Date: Mon, 30 Dec 2024 00:27:24 +0330 Subject: [PATCH] Fix name height mis calculation --- apple/InlineMac/Utils/Theme.swift | 2 +- apple/InlineMac/Views/Chat/Message/MessageViewAppKit.swift | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apple/InlineMac/Utils/Theme.swift b/apple/InlineMac/Utils/Theme.swift index 3246d695..d8ed23ee 100644 --- a/apple/InlineMac/Utils/Theme.swift +++ b/apple/InlineMac/Utils/Theme.swift @@ -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 diff --git a/apple/InlineMac/Views/Chat/Message/MessageViewAppKit.swift b/apple/InlineMac/Views/Chat/Message/MessageViewAppKit.swift index 3dcfc340..2ae9045b 100644 --- a/apple/InlineMac/Views/Chat/Message/MessageViewAppKit.swift +++ b/apple/InlineMac/Views/Chat/Message/MessageViewAppKit.swift @@ -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 @@ -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), ]) }