diff --git a/MathKit/MPPowerFunctionLayout.m b/MathKit/MPPowerFunctionLayout.m index 10aeb68..e9c03d9 100644 --- a/MathKit/MPPowerFunctionLayout.m +++ b/MathKit/MPPowerFunctionLayout.m @@ -39,11 +39,9 @@ } -#warning Broken Power Layout - (NSPoint)offsetOfChildLayoutAtIndex:(NSUInteger)index { - NSRect exponentBounds = [self childLayoutAtIndex:0].bounds; - CGFloat y = (self.baseBounds.size.height + self.baseBounds.origin.y) - ((exponentBounds.size.height + exponentBounds.origin.y) / 2); + CGFloat y = (self.baseBounds.size.height + self.baseBounds.origin.y) / 2; return NSMakePoint(kPowerFunctionExponentXOffset, y); } @@ -63,9 +61,11 @@ - (NSRect)generateBounds { NSRect exponentBounds = [self childLayoutAtIndex:0].bounds; - CGFloat height = [self offsetOfChildLayoutAtIndex:0].y + exponentBounds.size.height + exponentBounds.origin.y; + CGFloat relativeExponentYOffset = [self offsetOfChildLayoutAtIndex:0].y; + CGFloat y = relativeExponentYOffset + exponentBounds.origin.y; CGFloat width = kPowerFunctionExponentXOffset + exponentBounds.size.width + kPowerFunctionTrailingOffset; - return NSMakeRect(0, 0, width, height); + CGFloat height = exponentBounds.size.height; + return NSMakeRect(0, y, width, height); }