mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
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.
This commit is contained in:
@@ -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)
|
||||
])
|
||||
|
||||
@@ -336,7 +336,7 @@ internal class Popup: PopupWrapper {
|
||||
container.spacing = 0
|
||||
|
||||
for _ in 0..<self.numberOfProcesses {
|
||||
let processView = ProcessView()
|
||||
let processView = ProcessView(maxValue: "100.0%")
|
||||
self.processes.append(processView)
|
||||
container.addArrangedSubview(processView)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user