Commit b90ee8ac by Daniel Dahan

cleanup for colors and layer shape setting

parent d89a6935
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0930" LastUpgradeVersion = "0940"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
......
...@@ -259,20 +259,22 @@ extension CALayer { ...@@ -259,20 +259,22 @@ extension CALayer {
return return
} }
if 0 == bounds.width { if 0 == frame.width {
bounds.size.width = bounds.height frame.size.width = frame.height
} }
if 0 == bounds.height { if 0 == frame.height {
bounds.size.height = bounds.width frame.size.height = frame.width
} }
guard .circle == shapePreset else { guard .circle == shapePreset else {
masksToBounds = false
cornerRadius = 0 cornerRadius = 0
return return
} }
cornerRadius = bounds.size.width / 2 masksToBounds = true
cornerRadius = frame.size.width / 2
} }
/// Sets the shadow path. /// Sets the shadow path.
......
...@@ -44,7 +44,11 @@ public extension UIColor { ...@@ -44,7 +44,11 @@ public extension UIColor {
let r = argb >> 16 let r = argb >> 16
let g = argb >> 8 let g = argb >> 8
let b = argb >> 0 let b = argb >> 0
func f(_ v: UInt32) -> CGFloat { return CGFloat(v & 0xff) / 255 }
func f(_ v: UInt32) -> CGFloat {
return CGFloat(v & 0xff) / 255
}
self.init(red: f(r), green: f(g), blue: f(b), alpha: f(a)) self.init(red: f(r), green: f(g), blue: f(b), alpha: f(a))
} }
...@@ -55,6 +59,6 @@ public extension UIColor { ...@@ -55,6 +59,6 @@ public extension UIColor {
- Parameter rgb: An unsigned 32 bit integer. E.g 0xAA44CC. - Parameter rgb: An unsigned 32 bit integer. E.g 0xAA44CC.
*/ */
convenience init(rgb: UInt32) { convenience init(rgb: UInt32) {
self.init(argb: (UInt32(0xff000000)) | rgb) self.init(argb: (0xff000000 as UInt32) | rgb)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment