mirror of https://github.com/SnapKit/SnapKit
Fix handling of UIEdgeInsets for width and height
This commit is contained in:
parent
2a0fa9e047
commit
483d525c72
|
@ -445,7 +445,9 @@ private extension NSLayoutAttribute {
|
||||||
case .Bottom, .BottomMargin: return insets.bottom
|
case .Bottom, .BottomMargin: return insets.bottom
|
||||||
case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
||||||
case .Trailing, .TrailingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : -insets.left
|
case .Trailing, .TrailingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : -insets.left
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
case .Width: return -insets.left + insets.right
|
||||||
|
case .Height: return -insets.top + insets.bottom
|
||||||
|
case .NotAnAttribute: return CGFloat(0)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch self {
|
switch self {
|
||||||
|
@ -455,7 +457,9 @@ private extension NSLayoutAttribute {
|
||||||
case .Bottom: return insets.bottom
|
case .Bottom: return insets.bottom
|
||||||
case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
||||||
case .Trailing: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : -insets.left
|
case .Trailing: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : -insets.left
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
case .Width: return -insets.left + insets.right
|
||||||
|
case .Height: return -insets.top + insets.bottom
|
||||||
|
case .NotAnAttribute: return CGFloat(0)
|
||||||
case .FirstBaseline: return insets.bottom
|
case .FirstBaseline: return insets.bottom
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue