From da4426cb9aa855d366cf2930f28a0e17e4757c5e Mon Sep 17 00:00:00 2001 From: Living Date: Wed, 28 Sep 2016 19:41:15 +0800 Subject: [PATCH] change the result constraint of maker.center.equalTo(CGPoint) to based on the original point of superview (#336) * change center.equalTo * fix logic --- Source/Constraint.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Constraint.swift b/Source/Constraint.swift index 7324c59..e5086c1 100644 --- a/Source/Constraint.swift +++ b/Source/Constraint.swift @@ -115,7 +115,11 @@ public class Constraint { layoutToAttribute = layoutToAttributes[0] } } else { - layoutToAttribute = layoutFromAttribute + if self.to.target == nil && (layoutFromAttribute == .centerX || layoutFromAttribute == .centerY) { + layoutToAttribute = layoutFromAttribute == .centerX ? .left : .top + } else { + layoutToAttribute = layoutFromAttribute + } } #else if self.from.attributes == self.to.attributes {