diff --git a/app/src/actions/selection.ts b/app/src/actions/selection.ts index bd7f5c1c..3d014fe2 100644 --- a/app/src/actions/selection.ts +++ b/app/src/actions/selection.ts @@ -318,12 +318,14 @@ export const useSelectAllNotes = () => { const { pianoRollStore, pianoRollStore: { selectedTrack }, + controlStore, } = useStores() return () => { if (selectedTrack) { pianoRollStore.selectedNoteIds = selectedTrack.events .filter(isNoteEvent) .map((note) => note.id) + controlStore.selectedEventIds = [] } } } diff --git a/app/src/components/KeyboardShortcut/PianoRollKeyboardShortcut.tsx b/app/src/components/KeyboardShortcut/PianoRollKeyboardShortcut.tsx index 3a405c93..5d7f4b01 100644 --- a/app/src/components/KeyboardShortcut/PianoRollKeyboardShortcut.tsx +++ b/app/src/components/KeyboardShortcut/PianoRollKeyboardShortcut.tsx @@ -1,6 +1,6 @@ import { observer } from "mobx-react-lite" import { FC } from "react" -import { usePasteSelection } from "../../actions" +import { usePasteSelection, useSelectAllNotes } from "../../actions" import { usePasteControlSelection } from "../../actions/control" import { isControlEventsClipboardData, @@ -23,6 +23,7 @@ export const PianoRollKeyboardShortcut: FC = observer(() => { useControlPaneKeyboardShortcutActions() const pasteSelection = usePasteSelection() const pasteControlSelection = usePasteControlSelection() + const selectAllNotes = useSelectAllNotes() // Handle pasting here to allow pasting even when the element does not have focus, such as after clicking the ruler const onPaste = (e: ClipboardEvent) => { @@ -82,6 +83,11 @@ export const PianoRollKeyboardShortcut: FC = observer(() => { code: "Digit2", run: () => (pianoRollStore.mouseMode = "selection"), }, + { + code: "KeyA", + metaKey: true, + run: selectAllNotes, + }, ]} onPaste={onPaste} /> diff --git a/app/src/components/KeyboardShortcut/pianoNotesKeyboardShortcutActions.tsx b/app/src/components/KeyboardShortcut/pianoNotesKeyboardShortcutActions.tsx index 2f94dbf8..c7e84f1c 100644 --- a/app/src/components/KeyboardShortcut/pianoNotesKeyboardShortcutActions.tsx +++ b/app/src/components/KeyboardShortcut/pianoNotesKeyboardShortcutActions.tsx @@ -4,7 +4,6 @@ import { useDuplicateSelection, usePasteSelection, useQuantizeSelectedNotes, - useSelectAllNotes, useSelectNextNote, useSelectPreviousNote, useTransposeSelection, @@ -18,7 +17,6 @@ export const usePianoNotesKeyboardShortcutActions = () => { const deleteSelection = useDeleteSelection() const pasteSelection = usePasteSelection() const duplicateSelection = useDuplicateSelection() - const selectAllNotes = useSelectAllNotes() const quantizeSelectedNotes = useQuantizeSelectedNotes() const transposeSelection = useTransposeSelection() const { pianoRollStore } = useStores() @@ -47,11 +45,6 @@ export const usePianoNotesKeyboardShortcutActions = () => { metaKey: true, run: duplicateSelection, }, - { - code: "KeyA", - metaKey: true, - run: selectAllNotes, - }, { code: "KeyQ", run: quantizeSelectedNotes,