diff --git a/Kit/plugins/Charts.swift b/Kit/plugins/Charts.swift index 048ae054..2d519aff 100644 --- a/Kit/plugins/Charts.swift +++ b/Kit/plugins/Charts.swift @@ -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 diff --git a/Modules/Net/portal.swift b/Modules/Net/portal.swift index 2342d535..441bd7a5 100644 --- a/Modules/Net/portal.swift +++ b/Modules/Net/portal.swift @@ -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