From 483d525c72e5cef032fb9348d7f6157dcb71a2aa Mon Sep 17 00:00:00 2001 From: Ray Lillywhite Date: Thu, 7 Jan 2016 13:52:28 -0800 Subject: [PATCH] Fix handling of UIEdgeInsets for width and height --- Source/Constraint.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Constraint.swift b/Source/Constraint.swift index 33a5e62..b3fea4b 100644 --- a/Source/Constraint.swift +++ b/Source/Constraint.swift @@ -445,7 +445,9 @@ private extension NSLayoutAttribute { case .Bottom, .BottomMargin: return insets.bottom case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right 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 switch self { @@ -455,7 +457,9 @@ private extension NSLayoutAttribute { case .Bottom: return insets.bottom case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right 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 } #endif