Make trend history view respond to preferred content size category

This commit is contained in:
Shadowfacts 2023-01-22 17:22:07 -05:00
parent 2b651b0bc4
commit 521e5ad5fc
1 changed files with 6 additions and 2 deletions

View File

@ -97,7 +97,7 @@ class TrendHistoryView: UIView {
borderLayer.path = path.cgPath.copy()!
borderLayer.strokeColor = tintColor.cgColor
borderLayer.fillColor = nil
borderLayer.lineWidth = 2
borderLayer.lineWidth = lineWidth
borderLayer.lineCap = .round
path.addLine(to: CGPoint(x: bounds.width, y: bounds.height))
@ -109,12 +109,16 @@ class TrendHistoryView: UIView {
let fillColor = self.fillColor()
fillLayer.strokeColor = fillColor
fillLayer.fillColor = fillColor
fillLayer.lineWidth = 2
fillLayer.lineWidth = lineWidth
layer.addSublayer(fillLayer)
layer.addSublayer(borderLayer)
}
private var lineWidth: CGFloat {
(traitCollection.preferredContentSizeCategory > .large || UIAccessibility.isBoldTextEnabled) ? 4 : 2
}
// The non-transparent fill color.
// We blend with the view's background color ourselves so that final color is non-transparent,
// otherwise when the fill layer's border and fill overlap, there's a visibly darker patch