diff --git a/.swiftlint.yml b/.swiftlint.yml index 06860221..d4f4f93b 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -45,5 +45,5 @@ type_body_length: - 400 file_length: - - 600 - - 800 \ No newline at end of file + - 800 + - 1000 \ No newline at end of file diff --git a/Kit/plugins/Charts.swift b/Kit/plugins/Charts.swift index 224b629b..6c63918c 100644 --- a/Kit/plugins/Charts.swift +++ b/Kit/plugins/Charts.swift @@ -505,7 +505,7 @@ public class HalfCircleGraphView: NSView { context.restoreGState() - if self.text != nil { + if let text = self.text { let style = NSMutableParagraphStyle() style.alignment = .center let stringAttributes = [ @@ -514,10 +514,9 @@ public class HalfCircleGraphView: NSView { NSAttributedString.Key.paragraphStyle: style ] - let width: CGFloat = self.text!.widthOfString(usingFont: NSFont.systemFont(ofSize: 10)) - let height: CGFloat = self.text!.heightOfString(usingFont: NSFont.systemFont(ofSize: 10)) - let rect = CGRect(x: ((self.frame.width-width)/2)-0.5, y: (self.frame.height-6)/2, width: width, height: height) - let str = NSAttributedString.init(string: self.text!, attributes: stringAttributes) + let width: CGFloat = text.widthOfString(usingFont: NSFont.systemFont(ofSize: 10)) + let rect = CGRect(x: ((self.frame.width-width)/2)-0.5, y: (self.frame.height-6)/2, width: width, height: 13) + let str = NSAttributedString.init(string: text, attributes: stringAttributes) str.draw(with: rect) } } diff --git a/Modules/Sensors/popup.swift b/Modules/Sensors/popup.swift index 87feddaa..71a7753a 100644 --- a/Modules/Sensors/popup.swift +++ b/Modules/Sensors/popup.swift @@ -8,7 +8,6 @@ // // Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved. // -// swiftlint:disable file_length import Cocoa import Kit @@ -156,7 +155,7 @@ internal class SensorView: NSStackView { self.valueView = ValueSensorView(sensor, width: width, callback: { [weak self] in self?.open() }) - self.chartView = ChartSensorView(width: width) + self.chartView = ChartSensorView(width: width, suffix: sensor.unit) self.addArrangedSubview(self.valueView)