From 9aaffea7afbc3f8977d6d06b6684d025548f290b Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Tue, 31 Dec 2024 14:56:52 +0100 Subject: [PATCH] fix: limited the label width in the popup view to fix the value when the label is too long and cannot fit in the row (#2288) --- Kit/helpers.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kit/helpers.swift b/Kit/helpers.swift index c97d2a1cc6b..6915c9c7e29 100644 --- a/Kit/helpers.swift +++ b/Kit/helpers.swift @@ -387,7 +387,7 @@ public func popupWithColorRow(_ view: NSView, color: NSColor, title: String, val colorView.wantsLayer = true colorView.layer?.backgroundColor = color.cgColor colorView.layer?.cornerRadius = 2 - let labelWidth = title.widthOfString(usingFont: .systemFont(ofSize: 13, weight: .regular)) + 5 + let labelWidth = min(180, title.widthOfString(usingFont: .systemFont(ofSize: 13, weight: .regular)) + 5) let labelView: LabelField = LabelField(frame: NSRect(x: 18, y: (22-16)/2, width: labelWidth, height: 16), title) let valueView: ValueField = ValueField(frame: NSRect(x: 18 + labelWidth, y: (22-16)/2, width: rowView.frame.width - labelWidth - 18, height: 16), value)