From 0fc170f9668a67cfc8fd015c0cb9a101fbca3c17 Mon Sep 17 00:00:00 2001 From: Jason Morley Date: Fri, 29 Mar 2024 11:08:43 -1000 Subject: [PATCH] fix: Don't clear the selection when clicking on selected cells (#20) --- .../Views/InteractiveCollectionView.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/SelectableCollectionView/Views/InteractiveCollectionView.swift b/Sources/SelectableCollectionView/Views/InteractiveCollectionView.swift index ab95c00..97c0cd3 100644 --- a/Sources/SelectableCollectionView/Views/InteractiveCollectionView.swift +++ b/Sources/SelectableCollectionView/Views/InteractiveCollectionView.swift @@ -158,7 +158,9 @@ class InteractiveCollectionView: NSCollectionView { cursor = indexPath } - } else { + } else if !selectionIndexPaths.contains(indexPath) { + + // Select a clicked item if it's not within the current selection. let selectionIndexPaths = selectionIndexPaths deselectItems(at: selectionIndexPaths)