Fix drawing ref labels on the next tableview column

If there are a large number of refs pointing to a commit, then they may be drawn on top of or behind the other columns.
This will not show any labels that don't fit.
This commit is contained in:
Nathan Kinsinger
2010-02-25 21:16:38 -07:00
committed by Dave Grijalva
parent 1917bca23b
commit 5ea536be97
+7 -5
View File
@@ -149,8 +149,8 @@
static const int ref_spacing = 2;
NSRect lastRect = rect;
lastRect.origin.x = round(lastRect.origin.x) - 0.5;
lastRect.origin.y = round(lastRect.origin.y) - 0.5;
lastRect.origin.x = round(lastRect.origin.x) + 0.5;
lastRect.origin.y = round(lastRect.origin.y) + 0.5;
for (PBGitRef *ref in self.objectValue.refs) {
NSMutableDictionary* attributes = [self attributesForRefLabelSelected:NO];
@@ -161,9 +161,11 @@
newRect.size.height = textSize.height;
newRect.origin.y = rect.origin.y + (rect.size.height - newRect.size.height) / 2;
[array addObject:[NSValue valueWithRect:newRect]];
lastRect = newRect;
lastRect.origin.x += (int)lastRect.size.width + ref_spacing;
if (NSContainsRect(rect, newRect)) {
[array addObject:[NSValue valueWithRect:newRect]];
lastRect = newRect;
lastRect.origin.x += (int)lastRect.size.width + ref_spacing;
}
}
return array;