Skip to content

Commit

Permalink
Merge pull request #311 from slashmo/fix/multiselection-deselect
Browse files Browse the repository at this point in the history
Select previously selected image when deselecting in multi-selection
  • Loading branch information
s4cha authored Apr 28, 2019
2 parents 8fd8931 + 65a4bad commit 4d547ef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/Pages/Gallery/YPLibraryVC+CollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ extension YPLibraryVC {
}
}
v.collectionView.reloadItems(at: selectedIndexPaths)


// Replace the current selected image with the previously selected one
if let previouslySelectedIndexPath = selectedIndexPaths.last {
v.collectionView.deselectItem(at: indexPath, animated: false)
v.collectionView.selectItem(at: previouslySelectedIndexPath, animated: false, scrollPosition: [])
currentlySelectedIndex = previouslySelectedIndexPath.row
changeAsset(mediaManager.fetchResult[previouslySelectedIndexPath.row])
}

checkLimit()
}
}
Expand Down

0 comments on commit 4d547ef

Please sign in to comment.