Drag and Drop: Made DND undo possibly less janky
parent
297b7b2909
commit
391fc474f3
|
@ -121,20 +121,19 @@ NSString *iTunesDropType = @"com.apple.tv.metadata";
|
|||
|
||||
- (void)moveObjectsFromIndex:(NSUInteger)fromIndex
|
||||
toArrangedObjectIndexes:(NSIndexSet *)indexSet {
|
||||
NSArray *objects = [self arrangedObjects];
|
||||
NSArray *objects = [[self arrangedObjects] subarrayWithRange:NSMakeRange(fromIndex, [indexSet count])];
|
||||
NSUInteger index = [indexSet firstIndex];
|
||||
|
||||
NSUInteger itemIndex = 0;
|
||||
id object;
|
||||
|
||||
NSArray *itemsSet = [objects objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(fromIndex, [indexSet count])]];
|
||||
|
||||
for (NSUInteger i = 0; i < [itemsSet count]; i++) {
|
||||
[self removeObjectAtArrangedObjectIndex:fromIndex];
|
||||
fromIndex += [objects count];
|
||||
for (NSUInteger i = 0; i < [objects count]; i++) {
|
||||
[self removeObjectAtArrangedObjectIndex:--fromIndex];
|
||||
}
|
||||
|
||||
while (NSNotFound != index) {
|
||||
object = itemsSet[itemIndex++];
|
||||
object = objects[itemIndex++];
|
||||
|
||||
[self insertObject:object atArrangedObjectIndex:index];
|
||||
|
||||
|
|
Loading…
Reference in New Issue