feat: adjusted width of the box with top process value

This commit is contained in:
Serhiy Mytrovtsiy
2023-11-21 22:17:11 +01:00
parent 9c49ae9584
commit 987a709a48
2 changed files with 3 additions and 3 deletions

View File

@@ -794,7 +794,7 @@ public class ProcessView: NSStackView {
}()
private var valueView: ValueField = ValueField()
public init(size: CGSize = CGSize(width: 264, height: 22), maxValue: String = "5555 GB") {
public init(size: CGSize = CGSize(width: 264, height: 22), valueSize: CGFloat = 55) {
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,7 +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.valueView.widthAnchor.constraint(equalToConstant: valueSize),
self.widthAnchor.constraint(equalToConstant: self.bounds.width),
self.heightAnchor.constraint(equalToConstant: self.bounds.height)
])

View File

@@ -336,7 +336,7 @@ internal class Popup: PopupWrapper {
container.spacing = 0
for _ in 0..<self.numberOfProcesses {
let processView = ProcessView(maxValue: "100.0%")
let processView = ProcessView(valueSize: 60)
self.processes.append(processView)
container.addArrangedSubview(processView)
}