mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 06:31:27 +00:00
Fixes rows drawing when alternatingRowBackgroundColors > 2. TableTest showing 3 row colors
This commit is contained in:
@@ -1954,11 +1954,6 @@ window.setTimeout(function(){
|
||||
[self highlightSelectionInClipRect:exposedRect];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
{
|
||||
[_tableDrawView display];
|
||||
}
|
||||
|
||||
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
||||
{
|
||||
if (![self usesAlternatingRowBackgroundColors])
|
||||
@@ -1982,20 +1977,21 @@ window.setTimeout(function(){
|
||||
// CGContextFillRect(context, CGRectIntersection(aRect, fillRect));
|
||||
// console.profile("row-paint");
|
||||
var exposedRows = [self rowsInRect:aRect],
|
||||
firstRow = exposedRows.location -1,
|
||||
firstRow = exposedRows.location,
|
||||
lastRow = CPMaxRange(exposedRows) - 1,
|
||||
colorIndex = MIN(exposedRows.length, colorCount),
|
||||
heightFilled = 0.0;
|
||||
|
||||
while (colorIndex--)
|
||||
{
|
||||
var row = firstRow % colorCount + firstRow + colorIndex,
|
||||
var row = firstRow - firstRow % colorCount + colorIndex,
|
||||
fillRect = nil;
|
||||
|
||||
CGContextBeginPath(context);
|
||||
|
||||
for (; row <= lastRow; row += colorCount)
|
||||
CGContextAddRect(context, CGRectIntersection(aRect, fillRect = [self rectOfRow:row]));
|
||||
if (row >= firstRow)
|
||||
CGContextAddRect(context, CGRectIntersection(aRect, fillRect = [self rectOfRow:row]));
|
||||
|
||||
if (row - colorCount === lastRow)
|
||||
heightFilled = _CGRectGetMaxY(fillRect);
|
||||
|
||||
@@ -39,6 +39,7 @@ CPLogRegister(CPLogConsole);
|
||||
[tableView setAllowsMultipleSelection:YES];
|
||||
[tableView setAllowsColumnSelection:YES];
|
||||
[tableView setUsesAlternatingRowBackgroundColors:YES];
|
||||
[tableView setAlternatingRowBackgroundColors:[[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"], [CPColor colorWithHexString:@"f4e7ff"]]];
|
||||
[tableView setGridStyleMask:CPTableViewSolidHorizontalGridLineMask | CPTableViewSolidVerticalGridLineMask];
|
||||
|
||||
// [tableView setBackgroundColor:[CPColor blueColor]];
|
||||
|
||||
Reference in New Issue
Block a user