Commit b54e9c05 by Daniel Dahan

Removed shape code that was not needed in TextField and TextView.

parent 3cafeeb0
......@@ -85,7 +85,7 @@ public class BottomTabBar : UITabBar {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -100,7 +100,7 @@ public class BottomTabBar : UITabBar {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -104,7 +104,7 @@ public class MaterialButton : UIButton {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -122,7 +122,7 @@ public class MaterialButton : UIButton {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -211,7 +211,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -229,7 +229,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -64,7 +64,7 @@ public class MaterialLayer : CAShapeLayer {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -82,7 +82,7 @@ public class MaterialLayer : CAShapeLayer {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -94,7 +94,7 @@ public class MaterialSwitch : UIControl {
}
}
/// A property that accesses the layer.frame.origin.width property.
/// A property that accesses the layer.frame.size.width property.
@IBInspectable public var width: CGFloat {
get {
return layer.frame.size.width
......@@ -104,7 +104,7 @@ public class MaterialSwitch : UIControl {
}
}
/// A property that accesses the layer.frame.origin.height property.
/// A property that accesses the layer.frame.size.height property.
@IBInspectable public var height: CGFloat {
get {
return layer.frame.size.height
......
......@@ -103,7 +103,7 @@ public class MaterialTableViewCell : UITableViewCell {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -118,7 +118,7 @@ public class MaterialTableViewCell : UITableViewCell {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -159,7 +159,7 @@ public class MaterialView : UIView {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -177,7 +177,7 @@ public class MaterialView : UIView {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -127,7 +127,7 @@ public class NavigationBar : UINavigationBar {
}
/**
A property that accesses the layer.frame.origin.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
......@@ -142,7 +142,7 @@ public class NavigationBar : UINavigationBar {
}
/**
A property that accesses the layer.frame.origin.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
......
......@@ -74,39 +74,23 @@ public class TextField : UITextField {
}
}
/**
A property that accesses the layer.frame.origin.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
*/
/// A property that accesses the layer.frame.size.width property.
@IBInspectable public var width: CGFloat {
get {
return layer.frame.size.width
}
set(value) {
layer.frame.size.width = value
if .None != shape {
layer.frame.size.height = value
}
}
}
/**
A property that accesses the layer.frame.origin.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
*/
/// A property that accesses the layer.frame.size.height property.
@IBInspectable public var height: CGFloat {
get {
return layer.frame.size.height
}
set(value) {
layer.frame.size.height = value
if .None != shape {
layer.frame.size.width = value
}
}
}
......@@ -183,11 +167,7 @@ public class TextField : UITextField {
}
}
/**
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .Circle when the cornerRadius is set, it will
become .None, as it no longer maintains its circle shape.
*/
/// A property that sets the cornerRadius of the backing layer.
public var cornerRadiusPreset: MaterialRadius = .None {
didSet {
if let v: MaterialRadius = cornerRadiusPreset {
......@@ -204,27 +184,6 @@ public class TextField : UITextField {
set(value) {
layer.cornerRadius = value
layoutShadowPath()
if .Circle == shape {
shape = .None
}
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
*/
public var shape: MaterialShape = .None {
didSet {
if .None != shape {
if width < height {
frame.size.width = height
} else {
frame.size.height = width
}
layoutShadowPath()
}
}
}
......@@ -436,7 +395,6 @@ public class TextField : UITextField {
super.layoutSublayersOfLayer(layer)
if self.layer == layer {
bottomBorderLayer.frame = CGRectMake(0, bounds.height + bottomBorderLayerDistance, bounds.width, 1)
layoutShape()
layoutShadowPath()
}
}
......@@ -513,10 +471,8 @@ public class TextField : UITextField {
/// Reloads the view.
public func reloadView() {
/// Prepare the clearButton.
if let v: FlatButton = clearButton {
v.frame = CGRectMake(width - height, 0, height, height)
}
/// Align the clearButton.
clearButton.frame = CGRectMake(width - height, 0, height, height)
}
......@@ -566,16 +522,6 @@ public class TextField : UITextField {
}
}
/// Manages the layout for the shape of the view instance.
internal func layoutShape() {
if .Circle == shape {
let w: CGFloat = (width / 2)
if w != cornerRadius {
cornerRadius = w
}
}
}
/// Sets the shadow path.
internal func layoutShadowPath() {
if shadowPathAutoSizeEnabled {
......@@ -642,9 +588,7 @@ public class TextField : UITextField {
clearButton.tintColor = MaterialColor.grey.base
clearButton.setImage(image, forState: .Normal)
clearButton.setImage(image, forState: .Highlighted)
if clearButtonAutoHandleEnabled {
clearButton.addTarget(self, action: #selector(handleClearButton), forControlEvents: .TouchUpInside)
}
clearButtonAutoHandleEnabled = true
clearButtonMode = .Never
rightViewMode = .WhileEditing
rightView = clearButton
......
......@@ -76,39 +76,23 @@ public class TextView: UITextView {
}
}
/**
A property that accesses the layer.frame.origin.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
*/
/// A property that accesses the layer.frame.size.width property.
@IBInspectable public var width: CGFloat {
get {
return layer.frame.size.width
}
set(value) {
layer.frame.size.width = value
if .None != shape {
layer.frame.size.height = value
}
}
}
/**
A property that accesses the layer.frame.origin.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
*/
/// A property that accesses the layer.frame.size.height property.
@IBInspectable public var height: CGFloat {
get {
return layer.frame.size.height
}
set(value) {
layer.frame.size.height = value
if .None != shape {
layer.frame.size.width = value
}
}
}
......@@ -185,11 +169,7 @@ public class TextView: UITextView {
}
}
/**
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .Circle when the cornerRadius is set, it will
become .None, as it no longer maintains its circle shape.
*/
/// A property that sets the cornerRadius of the backing layer.
public var cornerRadiusPreset: MaterialRadius = .None {
didSet {
if let v: MaterialRadius = cornerRadiusPreset {
......@@ -206,27 +186,6 @@ public class TextView: UITextView {
set(value) {
layer.cornerRadius = value
layoutShadowPath()
if .Circle == shape {
shape = .None
}
}
}
/**
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
*/
public var shape: MaterialShape = .None {
didSet {
if .None != shape {
if width < height {
frame.size.width = height
} else {
frame.size.height = width
}
layoutShadowPath()
}
}
}
......@@ -389,7 +348,6 @@ public class TextView: UITextView {
public override func layoutSublayersOfLayer(layer: CALayer) {
super.layoutSublayersOfLayer(layer)
if self.layer == layer {
layoutShape()
layoutShadowPath()
}
}
......@@ -489,16 +447,6 @@ public class TextView: UITextView {
titleLabel?.textColor = titleLabelColor
}
/// Manages the layout for the shape of the view instance.
internal func layoutShape() {
if .Circle == shape {
let w: CGFloat = (width / 2)
if w != cornerRadius {
cornerRadius = w
}
}
}
/// Sets the shadow path.
internal func layoutShadowPath() {
if shadowPathAutoSizeEnabled {
......
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