Some appearance tweaks

This commit is contained in:
James Magahern
2020-09-22 14:33:00 -07:00
parent c223c12934
commit 679e59c20b
5 changed files with 24 additions and 26 deletions

View File

@@ -13,7 +13,7 @@ class ReliefButton: UIButton
internal let backgroundView = GradientView(direction: .vertical, colors: ReliefButton.gradientColors(inverted: false, darkMode: false))
static let padding = CGFloat(24.0)
static let cornerRadius = CGFloat(4.0)
static let cornerRadius = CGFloat(6.0)
static let borderWidth = CGFloat(1.0)
override var isHighlighted: Bool {
@@ -55,12 +55,14 @@ class ReliefButton: UIButton
shadowView.layer.masksToBounds = false
shadowView.layer.shouldRasterize = true
shadowView.layer.rasterizationScale = UIScreen.main.scale
shadowView.layer.cornerCurve = .continuous
addSubview(shadowView)
backgroundView.layer.cornerRadius = Self.cornerRadius
backgroundView.isUserInteractionEnabled = false
backgroundView.layer.masksToBounds = true
backgroundView.layer.borderWidth = Self.borderWidth
backgroundView.layer.cornerCurve = .continuous
addSubview(backgroundView)
traitCollectionDidChange(nil)
@@ -138,13 +140,9 @@ class ReliefButton: UIButton
sendSubviewToBack(backgroundView)
sendSubviewToBack(shadowView)
let backgroundDimension = bounds.height - 1.0
let backgroundDimension = bounds.height
backgroundView.frame = CGRect(origin: .zero, size: CGSize(width: backgroundDimension, height: backgroundDimension))
backgroundView.frame = backgroundView.frame.centeredX(inRect: bounds)
shadowView.frame = backgroundView.frame
// Offset by a small amount. Visual illusion caused by the shadow
backgroundView.frame = backgroundView.frame.offsetBy(dx: 0.0, dy: 1.0)
shadowView.frame = shadowView.frame.offsetBy(dx: 0.0, dy: 1.0)
}
}