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
|
- (void)moveObjectsFromIndex:(NSUInteger)fromIndex
|
||||||
toArrangedObjectIndexes:(NSIndexSet *)indexSet {
|
toArrangedObjectIndexes:(NSIndexSet *)indexSet {
|
||||||
NSArray *objects = [self arrangedObjects];
|
NSArray *objects = [[self arrangedObjects] subarrayWithRange:NSMakeRange(fromIndex, [indexSet count])];
|
||||||
NSUInteger index = [indexSet firstIndex];
|
NSUInteger index = [indexSet firstIndex];
|
||||||
|
|
||||||
NSUInteger itemIndex = 0;
|
NSUInteger itemIndex = 0;
|
||||||
id object;
|
id object;
|
||||||
|
|
||||||
NSArray *itemsSet = [objects objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(fromIndex, [indexSet count])]];
|
fromIndex += [objects count];
|
||||||
|
for (NSUInteger i = 0; i < [objects count]; i++) {
|
||||||
for (NSUInteger i = 0; i < [itemsSet count]; i++) {
|
[self removeObjectAtArrangedObjectIndex:--fromIndex];
|
||||||
[self removeObjectAtArrangedObjectIndex:fromIndex];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (NSNotFound != index) {
|
while (NSNotFound != index) {
|
||||||
object = itemsSet[itemIndex++];
|
object = objects[itemIndex++];
|
||||||
|
|
||||||
[self insertObject:object atArrangedObjectIndex:index];
|
[self insertObject:object atArrangedObjectIndex:index];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue