Shadow properties are now reflected on handles

This commit is contained in:
Jonathan Cardasis 2019-04-20 13:48:18 -04:00
parent 2c3749575b
commit d04eafd96d
2 changed files with 5 additions and 2 deletions

View File

@ -125,7 +125,6 @@ public class ChromaColorPicker: UIControl, ChromaControlStylable {
let angleToCenter = atan2(location.x - center.x, location.y - center.y)
let positionOnColorWheelEdge = CGPoint(x: center.x + radius * sin(angleToCenter),
y: center.y + radius * cos(angleToCenter))
//print("pos: \(positionOnColorWheelEdge)")
location = positionOnColorWheelEdge
}

View File

@ -54,6 +54,7 @@ public class ChromaColorHandle: UIView, ChromaControlStylable {
public override func layoutSubviews() {
super.layoutSubviews()
layoutHandleShape()
updateShadowIfNeeded()
layer.masksToBounds = false
}
@ -67,7 +68,10 @@ public class ChromaColorHandle: UIView, ChromaControlStylable {
internal func updateShadowIfNeeded() {
if showsShadow {
let shadowProps = shadowProperties(forHeight: bounds.height)
let shadowProps = ShadowProperties(color: UIColor.black.cgColor,
opacity: 0.3,
offset: CGSize(width: 0, height: bounds.height / 8.0),
radius: 4.0)
applyDropShadow(shadowProps)
} else {
removeDropShadow()