From d25dff54f71abef8d4ef42aea7d155807458bb5d Mon Sep 17 00:00:00 2001 From: dsward2 Date: Sat, 25 Apr 2020 00:48:39 -0500 Subject: [PATCH] In NSOutlineView_Extensions mouseDown method, if user clicks on a row that is already selected, skip the call to deselectAll:. This fixes the problem with drag-and-drop for multiple items in the XML Outline View. --- macSVG/Cocoa Extensions/NSOutlineView_Extensions.m | 11 ++++++++++- macSVG/MacSVG-Info.plist | 2 +- macSVG/SVGDocument Classes/XMLOutlineController.m | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/macSVG/Cocoa Extensions/NSOutlineView_Extensions.m b/macSVG/Cocoa Extensions/NSOutlineView_Extensions.m index 8b0ee38..2beddc5 100644 --- a/macSVG/Cocoa Extensions/NSOutlineView_Extensions.m +++ b/macSVG/Cocoa Extensions/NSOutlineView_Extensions.m @@ -306,7 +306,16 @@ } else { - [self deselectAll:self]; + NSPoint globalLocation = theEvent.locationInWindow; + NSPoint localLocation = [self convertPoint:globalLocation fromView:nil]; + NSInteger clickedRow = [self rowAtPoint:localLocation]; + + NSIndexSet * selectedRowIndexes = self.selectedRowIndexes; + + if ([selectedRowIndexes containsIndex:clickedRow] == NO) + { + [self deselectAll:self]; + } } [super mouseDown:theEvent]; diff --git a/macSVG/MacSVG-Info.plist b/macSVG/MacSVG-Info.plist index 53f5afd..d714460 100644 --- a/macSVG/MacSVG-Info.plist +++ b/macSVG/MacSVG-Info.plist @@ -105,7 +105,7 @@ CFBundleSignature ???? CFBundleVersion - 3180 + 3187 LSApplicationCategoryType public.app-category.graphics-design LSMinimumSystemVersion diff --git a/macSVG/SVGDocument Classes/XMLOutlineController.m b/macSVG/SVGDocument Classes/XMLOutlineController.m index 92bab2e..325011f 100644 --- a/macSVG/SVGDocument Classes/XMLOutlineController.m +++ b/macSVG/SVGDocument Classes/XMLOutlineController.m @@ -2893,7 +2893,6 @@ }]; } - //================================================================================== // outlineView:rowViewForItem: //================================================================================== @@ -2991,6 +2990,7 @@ static NSString * GenerateUniqueFileNameAtPath(NSString *path, NSString *basenam } } + //================================================================================== // outlineView:writeItems:toPasteboard: //==================================================================================