Archived
1

Fixed Power Layout

This commit is contained in:
Kim Wittenburg
2015-01-08 22:24:33 +01:00
parent 72abd9bc39
commit 524238dc2f

View File

@@ -39,11 +39,9 @@
} }
#warning Broken Power Layout
- (NSPoint)offsetOfChildLayoutAtIndex:(NSUInteger)index - (NSPoint)offsetOfChildLayoutAtIndex:(NSUInteger)index
{ {
NSRect exponentBounds = [self childLayoutAtIndex:0].bounds; CGFloat y = (self.baseBounds.size.height + self.baseBounds.origin.y) / 2;
CGFloat y = (self.baseBounds.size.height + self.baseBounds.origin.y) - ((exponentBounds.size.height + exponentBounds.origin.y) / 2);
return NSMakePoint(kPowerFunctionExponentXOffset, y); return NSMakePoint(kPowerFunctionExponentXOffset, y);
} }
@@ -63,9 +61,11 @@
- (NSRect)generateBounds - (NSRect)generateBounds
{ {
NSRect exponentBounds = [self childLayoutAtIndex:0].bounds; 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; CGFloat width = kPowerFunctionExponentXOffset + exponentBounds.size.width + kPowerFunctionTrailingOffset;
return NSMakeRect(0, 0, width, height); CGFloat height = exponentBounds.size.height;
return NSMakeRect(0, y, width, height);
} }