From 757e2317c842f69ea8d45b3d1e5399776112e454 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Tue, 10 Aug 2021 08:14:59 +1000 Subject: [PATCH] Add selection delete shortcut --- src/hooks/useMapSelection.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/hooks/useMapSelection.tsx b/src/hooks/useMapSelection.tsx index 80d6cef..60e5a73 100644 --- a/src/hooks/useMapSelection.tsx +++ b/src/hooks/useMapSelection.tsx @@ -110,6 +110,19 @@ function useMapSelection( if (shortcuts.duplicate(event)) { setDuplicateSelection(true); } + if (shortcuts.delete(event) && selection && active) { + const tokenIds: string[] = []; + const noteIds: string[] = []; + for (let item of selection.items) { + if (item.type === "token") { + tokenIds.push(item.id); + } else { + noteIds.push(item.id); + } + } + handleSelectionItemsRemove(tokenIds, noteIds); + setIsSelectionMenuOpen(false); + } } function handleKeyUp(event: KeyboardEvent) {