Alter how insets work when used as implied constant

Using make.left.bottom.equalTo(UIEdgeInsets) will now invert the right and bottom edge.
This commit is contained in:
Robert Payne 2016-08-16 23:24:48 +12:00
parent 7e8c173224
commit fbd807fd09
1 changed files with 4 additions and 4 deletions

View File

@ -103,17 +103,17 @@ extension ConstraintConstantTarget {
case .top, .topMargin, .centerY, .centerYWithinMargins, .lastBaseline, .firstBaseline: case .top, .topMargin, .centerY, .centerYWithinMargins, .lastBaseline, .firstBaseline:
return value.top return value.top
case .right, .rightMargin: case .right, .rightMargin:
return value.right return -value.right
case .bottom, .bottomMargin: case .bottom, .bottomMargin:
return value.bottom return -value.bottom
case .leading, .leadingMargin: case .leading, .leadingMargin:
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : -value.right return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : -value.right
case .trailing, .trailingMargin: case .trailing, .trailingMargin:
return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.right : -value.left return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.right : -value.left
case .width: case .width:
return -value.left + value.right return -(value.left + value.right)
case .height: case .height:
return -value.top + value.bottom return -(value.top + value.bottom)
case .notAnAttribute: case .notAnAttribute:
return 0.0 return 0.0
} }