From 7ba4882cbf3c3b55611228b2dc86146f0dcaff9f Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 11 Nov 2023 16:43:20 +0100 Subject: [PATCH] fix: changed top process value view to static width. To prevent strange glitches when the value view does not fit the value. Because the process name takes too much space. --- Kit/helpers.swift | 3 ++- Modules/CPU/popup.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Kit/helpers.swift b/Kit/helpers.swift index 88fc8f60..44a510cf 100644 --- a/Kit/helpers.swift +++ b/Kit/helpers.swift @@ -794,7 +794,7 @@ public class ProcessView: NSStackView { }() private var valueView: ValueField = ValueField() - public init(size: CGSize = CGSize(width: 264, height: 22)) { + public init(size: CGSize = CGSize(width: 264, height: 22), maxValue: String = "5555 GB") { var rect = NSRect(x: 5, y: 5, width: 12, height: 12) if size.height != 22 { rect = NSRect(x: 3, y: 3, width: 12, height: 12) @@ -846,6 +846,7 @@ public class ProcessView: NSStackView { imageBox.widthAnchor.constraint(equalToConstant: self.bounds.height), imageBox.heightAnchor.constraint(equalToConstant: self.bounds.height), self.labelView.heightAnchor.constraint(equalToConstant: 16), + self.valueView.widthAnchor.constraint(equalToConstant: maxValue.widthOfString(usingFont: self.valueView.font!).rounded(.up)), self.widthAnchor.constraint(equalToConstant: self.bounds.width), self.heightAnchor.constraint(equalToConstant: self.bounds.height) ]) diff --git a/Modules/CPU/popup.swift b/Modules/CPU/popup.swift index 9c5d66ed..8e2e430b 100644 --- a/Modules/CPU/popup.swift +++ b/Modules/CPU/popup.swift @@ -336,7 +336,7 @@ internal class Popup: PopupWrapper { container.spacing = 0 for _ in 0..