forked from shadowfacts/Tusker
Make trend history view respond to preferred content size category
This commit is contained in:
parent
2b651b0bc4
commit
521e5ad5fc
|
@ -97,7 +97,7 @@ class TrendHistoryView: UIView {
|
||||||
borderLayer.path = path.cgPath.copy()!
|
borderLayer.path = path.cgPath.copy()!
|
||||||
borderLayer.strokeColor = tintColor.cgColor
|
borderLayer.strokeColor = tintColor.cgColor
|
||||||
borderLayer.fillColor = nil
|
borderLayer.fillColor = nil
|
||||||
borderLayer.lineWidth = 2
|
borderLayer.lineWidth = lineWidth
|
||||||
borderLayer.lineCap = .round
|
borderLayer.lineCap = .round
|
||||||
|
|
||||||
path.addLine(to: CGPoint(x: bounds.width, y: bounds.height))
|
path.addLine(to: CGPoint(x: bounds.width, y: bounds.height))
|
||||||
|
@ -109,12 +109,16 @@ class TrendHistoryView: UIView {
|
||||||
let fillColor = self.fillColor()
|
let fillColor = self.fillColor()
|
||||||
fillLayer.strokeColor = fillColor
|
fillLayer.strokeColor = fillColor
|
||||||
fillLayer.fillColor = fillColor
|
fillLayer.fillColor = fillColor
|
||||||
fillLayer.lineWidth = 2
|
fillLayer.lineWidth = lineWidth
|
||||||
|
|
||||||
layer.addSublayer(fillLayer)
|
layer.addSublayer(fillLayer)
|
||||||
layer.addSublayer(borderLayer)
|
layer.addSublayer(borderLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var lineWidth: CGFloat {
|
||||||
|
(traitCollection.preferredContentSizeCategory > .large || UIAccessibility.isBoldTextEnabled) ? 4 : 2
|
||||||
|
}
|
||||||
|
|
||||||
// The non-transparent fill color.
|
// The non-transparent fill color.
|
||||||
// We blend with the view's background color ourselves so that final color is non-transparent,
|
// 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
|
// otherwise when the fill layer's border and fill overlap, there's a visibly darker patch
|
||||||
|
|
Loading…
Reference in New Issue