Some appearance tweaks
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user