mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: adjusted sensors portal width per row (#1819)
This commit is contained in:
@@ -484,6 +484,10 @@ public class ScrollableStackView: NSView {
|
||||
private let clipView: NSClipView = NSClipView()
|
||||
private let scrollView: NSScrollView = NSScrollView()
|
||||
|
||||
public var scrollWidth: CGFloat? {
|
||||
self.scrollView.verticalScroller?.frame.size.width
|
||||
}
|
||||
|
||||
public init(frame: NSRect = NSRect.zero, orientation: NSUserInterfaceLayoutOrientation = .vertical) {
|
||||
super.init(frame: frame)
|
||||
|
||||
|
||||
@@ -71,7 +71,10 @@ public class Portal: NSStackView, Portal_p {
|
||||
self.list = [:]
|
||||
}
|
||||
|
||||
let width: CGFloat = self.frame.width - self.edgeInsets.left - self.edgeInsets.right - Constants.Popup.margins
|
||||
var width: CGFloat = self.frame.width - self.edgeInsets.left - self.edgeInsets.right
|
||||
if list.count >= 4 {
|
||||
width -= self.container.scrollWidth ?? Constants.Popup.margins
|
||||
}
|
||||
list.forEach { s in
|
||||
let v = ValueSensorView(s, width: width, callback: {})
|
||||
self.container.stackView.addArrangedSubview(v)
|
||||
|
||||
Reference in New Issue
Block a user