Don't toLowerCase mouse button sequence steps

This commit is contained in:
Frank Noirot
2024-05-21 18:05:14 -04:00
parent 93f6a52740
commit 83f8b7bb93
3 changed files with 10 additions and 1 deletions

View File

@ -28,7 +28,7 @@ export const CommandBar = () => {
{
name: 'toggle',
title: 'Toggle Command Bar',
sequence: 'meta+k',
sequence: 'meta+k g RightButton+shift',
action: () => {
const type = commandBarState.matches('Closed') ? 'Open' : 'Close'
console.log('toggling command bar', type)

View File

@ -97,6 +97,8 @@ export function InteractionMapMachineProvider({
? mapKey(event.data.code)
: mouseButtonToName(event.data.button)
console.log('action', action)
// if the key is already a modifier key, skip everything else and reject
if (isModifierKey(action)) {
// We return an empty string so that we don't clear the currentSequence
@ -121,6 +123,12 @@ export function InteractionMapMachineProvider({
item.sequence.startsWith(searchString)
)
console.log('matches', {
matches,
interactionMap: context.interactionMap,
searchString,
})
// If we have no matches, reject the promise
if (matches.length === 0) {
return Promise.reject()

View File

@ -28,6 +28,7 @@ const mappedKeys: Record<string, string> = {
}
export function mapKey(key: string): string {
if (key.includes('Button')) return key
return (mappedKeys[key] || key)
.trim()
.toLowerCase()