浏览代码

Alter how insets work when used as implied constant

Using make.left.bottom.equalTo(UIEdgeInsets) will now invert the right and bottom edge.
Robert Payne 9 年之前
父节点
当前提交
fbd807fd09
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Source/ConstraintConstantTarget.swift

+ 4 - 4
Source/ConstraintConstantTarget.swift

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