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)

This commit is contained in:
Serhiy Mytrovtsiy
2024-12-31 14:56:52 +01:00
parent 85ea7f2eef
commit 9aaffea7af

View File

@@ -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)