Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Shift-selection now also selects the items in between

  • Loading branch information...
commit e916b592f8a99907ca64caccd35b3cf5d0d4d757 1 parent 855285d
@pieteromvlee pieteromvlee authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 BCCollectionView+Mouse.m
View
14 BCCollectionView+Mouse.m
@@ -35,8 +35,18 @@ - (void)mouseDown:(NSEvent *)theEvent
if ([self shiftOrCommandKeyPressed] && [self.originalSelectionIndexes containsIndex:index])
[self deselectItemAtIndex:index];
- else
- [self selectItemAtIndex:index];
+ else {
+ if ([NSEvent modifierFlags] & NSCommandKeyMask || [[self originalSelectionIndexes] count] == 0)
+ [self selectItemAtIndex:index];
+ else if ([NSEvent modifierFlags] & NSShiftKeyMask) {
+ NSInteger one = [[self originalSelectionIndexes] lastIndex];
+ NSInteger two = index;
+ if (two > one)
+ [self selectItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(MIN(one,two), 1+MAX(one,two)-MIN(one,two))]];
+ else
+ [self selectItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(MIN(one,two), MAX(one,two)-MIN(one,two))]];
+ }
+ }
}
- (void)regularMouseDragged:(NSEvent *)anEvent
Please sign in to comment.
Something went wrong with that request. Please try again.