mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: fixed bug with line chart offset in the menu bar (#1894)
This commit is contained in:
@@ -198,7 +198,7 @@ public class LineChartView: NSView {
|
||||
}
|
||||
|
||||
let point = CGPoint(
|
||||
x: (CGFloat(i) * xRatio),
|
||||
x: (CGFloat(i) * xRatio) + dirtyRect.origin.x,
|
||||
y: y
|
||||
)
|
||||
line.append(point)
|
||||
@@ -390,7 +390,7 @@ public class NetworkChartView: NSView {
|
||||
private var inChart: LineChartView
|
||||
private var outChart: LineChartView
|
||||
|
||||
public init(frame: NSRect, num: Int, minMax: Bool = true, reversedOrder: Bool = false,
|
||||
public init(frame: NSRect, num: Int, minMax: Bool = true, reversedOrder: Bool = false,
|
||||
outColor: NSColor = .systemRed, inColor: NSColor = .systemBlue, scale: Scale = .none, fixedScale: Double = 1) {
|
||||
self.reversedOrder = reversedOrder
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ public class Portal: PortalWrapper {
|
||||
right: Constants.Popup.spacing*2
|
||||
)
|
||||
|
||||
let container: NSView = NSView(frame: CGRect(x: 0, y: 0, width: self.frame.width - (Constants.Popup.spacing*8), height: 68))
|
||||
container.wantsLayer = true
|
||||
container.layer?.cornerRadius = 3
|
||||
|
||||
let chart = NetworkChartView(
|
||||
frame: CGRect(x: 0, y: 0, width: self.frame.width - (Constants.Popup.spacing*8), height: 68),
|
||||
num: 120,
|
||||
@@ -66,8 +70,10 @@ public class Portal: PortalWrapper {
|
||||
inColor: self.downloadColor,
|
||||
scale: self.chartScale
|
||||
)
|
||||
chart.base = self.base
|
||||
container.addSubview(chart)
|
||||
self.chart = chart
|
||||
view.addArrangedSubview(chart)
|
||||
view.addArrangedSubview(container)
|
||||
|
||||
self.publicIPField = portalRow(view, title: "\(localizedString("Public IP")):", value: localizedString("Unknown"))
|
||||
view.subviews.last?.heightAnchor.constraint(equalToConstant: 16).isActive = true
|
||||
|
||||
Reference in New Issue
Block a user