- fixed some issues with variable sized

- made CPOutlineView return the last index when dragging the row outside of it's bounds
This commit is contained in:
Klaas Pieter Annema
2010-02-03 15:06:42 +01:00
parent 5940e6913d
commit ee6160e796
2 changed files with 19 additions and 17 deletions
+5
View File
@@ -842,6 +842,11 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
children = itemInfo.children,
childIndex = [children indexOfObject:droppedItem];
// When no child is found the index we want to add the item below all it's children
// Think about dragging an item below the collectionview
if (childIndex === -1)
childIndex = [children count];
}
else if (theOperation === CPTableViewDropOn)
{
+14 -17
View File
@@ -846,7 +846,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
- (int)selectedRow
{
return [_selectedRowIndexes lastIndex];
return [_selectedRowIndexes lastIndex];
}
- (CPIndexSet)selectedRowIndexes
@@ -1050,8 +1050,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
if ((_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_))
{
rowHeight = [_delegate tableView:self heightOfRow:aRowIndex];
if (rowHeight !== _rowHeight)
_hasVariableRowHeight = YES;
_hasVariableRowHeight = YES;
}
else
_hasVariableRowHeight = NO;
@@ -1193,7 +1192,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
{
row = [rowArray objectAtIndex:rowIndex];
if (CPRectContainsPoint([self rectOfRow:[rowArray objectAtIndex:rowIndex]], aPoint))
if (CPRectContainsPoint([self rectOfRow:row], aPoint))
break;
// Make sure that the row is not found if we exit the loop without breaking
@@ -1202,7 +1201,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
}
if (row >= _numberOfRows)
return -1;
row = -1;
return row;
}
@@ -2587,20 +2586,18 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
*/
- (CPInteger)_proposedRowAtPoint:(CGPoint)dragPoint
{
var numberOfRows = [self numberOfRows],
row;
// cocoa seems to jump to the next row when we approach the below row
dragPoint.y += FLOOR(_rowHeight/4);
dragPoint.y += 5.0;
if (dragPoint.y > numberOfRows * (_rowHeight + _intercellSpacing.height))
{
if ([self _proposedDropOperationAtPoint:dragPoint] === CPTableViewDropAbove)
row = numberOfRows;
else
row = numberOfRows - 1;
}
else
var numberOfRows = [self numberOfRows],
row = [self rowAtPoint:dragPoint];
// cocoa seems to jump to the next row when we approach the below row
// dragPoint.y += FLOOR(CPRectGetHeight([self rectOfRow:row]) / 4);
// Check if we are dragging outside the tableview
// if we are we want the drag highlight to be below the last row
if (row === -1)
row = numberOfRows + 1;
return row;
}