Skip to content

Commit

Permalink
fix: fixed bug with line chart offset in the menu bar (#1894)
Browse files Browse the repository at this point in the history
  • Loading branch information
exelban committed Apr 15, 2024
1 parent 7b62a06 commit b016113
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Kit/plugins/Charts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion Modules/Net/portal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit b016113

Please sign in to comment.