Commit 35c09def by Daniel Dahan

fixed shape management when changing width and height

parent be05fff0
...@@ -122,56 +122,64 @@ extension UIView { ...@@ -122,56 +122,64 @@ extension UIView {
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the frame.origin.x property.
@IBInspectable @IBInspectable
public var x: CGFloat { public var x: CGFloat {
get { get {
return layer.frame.origin.x return frame.origin.x
} }
set(value) { set(value) {
layer.frame.origin.x = value frame.origin.x = value
layoutShadowPath() layoutShadowPath()
} }
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the frame.origin.y property.
@IBInspectable @IBInspectable
public var y: CGFloat { public var y: CGFloat {
get { get {
return layer.frame.origin.y return frame.origin.y
} }
set(value) { set(value) {
layer.frame.origin.y = value frame.origin.y = value
layoutShadowPath() layoutShadowPath()
} }
} }
/// A property that accesses the layer.frame.size.width property. /// A property that accesses the frame.size.width property.
@IBInspectable @IBInspectable
public var width: CGFloat { public var width: CGFloat {
get { get {
return layer.frame.size.width return frame.size.width
} }
set(value) { set(value) {
layer.frame.size.width = value frame.size.width = value
if .none != shapePreset {
frame.size.height = value
layoutShape()
}
layoutShape()
layoutShadowPath() layoutShadowPath()
} }
} }
/// A property that accesses the layer.frame.size.height property. /// A property that accesses the frame.size.height property.
@IBInspectable @IBInspectable
public var height: CGFloat { public var height: CGFloat {
get { get {
return layer.frame.size.height return frame.size.height
} }
set(value) { set(value) {
layer.frame.size.height = value frame.size.height = value
if .none != shapePreset {
frame.size.width = value
layoutShape()
}
layoutShape()
layoutShadowPath() layoutShadowPath()
} }
} }
...@@ -394,9 +402,9 @@ extension UIView { ...@@ -394,9 +402,9 @@ extension UIView {
public func layoutShape() { public func layoutShape() {
if .none != shapePreset { if .none != shapePreset {
if width < height { if width < height {
layer.frame.size.width = height frame.size.width = height
} else if width > height { } else if width > height {
layer.frame.size.height = width frame.size.height = width
} }
} }
......
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