From d0999fa5d57216499fcb8f2a0df2b70b91e04fb3 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Fri, 5 Mar 2010 16:20:24 -0500 Subject: [PATCH] Additional fixes for drag and drop in the TableView after OutlineView merge. --- AppKit/CPTableView.j | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 86a4e7a33..c6bc4f64a 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2640,6 +2640,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; return NO; } + + // The delegate disallowed the drag so clear the dragged row indexes + _draggedRowIndexes = [CPIndexSet indexSet]; } else if (ABS(_startTrackingPoint.x - aPoint.x) < 5 && ABS(_startTrackingPoint.y - aPoint.y) < 5) return YES; @@ -2735,7 +2738,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; var location = [self convertPoint:[sender draggingLocation] fromView:nil], dropOperation = [self _proposedDropOperationAtPoint:location], row = [self _proposedRowAtPoint:location]; - + if(_retargetedDropRow !== nil) row = _retargetedDropRow; @@ -2868,6 +2871,10 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; if(_retargetedDropRow !== nil) row = _retargetedDropRow; + + if (dropOperation === CPTableViewDropOn && row >= [self numberOfRows]) + row = [self numberOfRows] - 1; + var rect = CPRectMakeZero(); if (row === -1) @@ -3339,8 +3346,9 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", else if (dropOperation === CPTableViewDropOn) { //if row is selected don't fill and stroke white - var selectedRows = [tableView selectedRowIndexes]; - var newRect = _CGRectMake(aRect.origin.x + 2, aRect.origin.y + 2, aRect.size.width - 4, aRect.size.height - 5); + var selectedRows = [tableView selectedRowIndexes], + newRect = _CGRectMake(aRect.origin.x + 2, aRect.origin.y + 2, aRect.size.width - 4, aRect.size.height - 5); + if([selectedRows containsIndex:currentRow]) { CGContextSetLineWidth(context, 2);