UPD: Show key action keycode

This commit is contained in:
Robert Kossessa
2024-03-23 14:47:32 +01:00
parent 82f261a7db
commit a6230152d5
3 changed files with 19 additions and 9 deletions

View File

@@ -81,6 +81,7 @@
:is=" :is="
actionTypeOptions[inputValue]?.component ? actionTypeOptions[inputValue]?.component : WIP actionTypeOptions[inputValue]?.component ? actionTypeOptions[inputValue]?.component : WIP
" "
:action="action"
/> />
</div> </div>
</template> </template>
@@ -105,23 +106,21 @@ import SendStringAction from '@renderer/components/config/actions/SendStringActi
import ScrambleText from '@renderer/components/common/ScrambleText.vue' import ScrambleText from '@renderer/components/common/ScrambleText.vue'
import { ChevronsUpDown, Check, GripHorizontal, Trash2, X } from 'lucide-vue-next' import { ChevronsUpDown, Check, GripHorizontal, Trash2, X } from 'lucide-vue-next'
import { useElementSize } from '@vueuse/core' import { useElementSize } from '@vueuse/core'
import { Action } from '@renderer/deviceStore'
defineProps({ defineProps({
actionIndex: { actionIndex: {
type: Number, type: Number,
required: false required: false
},
action: {
type: Object as () => Action,
required: true
} }
}) })
const actionTypeOptions = ref({ const actionTypeOptions = ref({
sendKey: { label: 'Press Key or Combination', component: SendKeyAction }, key: { label: 'Press a Key', component: SendKeyAction }
sendString: { label: 'Type a String', component: SendStringAction },
sendMouse: { label: 'Move, Scroll or Click', component: 'SendMouseAction' },
sendGamepad: { label: 'Send a Gamepad Input', component: 'SendGamepadAction' },
sendMidi: { label: 'Send a MIDI Message', component: 'SendMidiAction' },
sendOsc: { label: 'Send an OSC Message', component: 'SendOscAction' },
sendSerial: { label: 'Send a Serial Message', component: 'SendSerialAction' },
changeProfile: { label: 'Change Device Profile', component: 'ChangeProfileAction' }
}) })
const comboboxButton = ref(null) const comboboxButton = ref(null)

View File

@@ -11,7 +11,7 @@
> >
<template #item="dragAction"> <template #item="dragAction">
<div :key="dragAction.element.id"> <div :key="dragAction.element.id">
<ActionCard :action-index="dragAction.index + 1" /> <ActionCard :action-index="dragAction.index + 1" :action="dragAction.element" />
</div> </div>
</template> </template>
</draggable> </draggable>

View File

@@ -10,11 +10,22 @@
<div v-if="lastEvent" class="mt-6 text-center font-mono text-sm text-muted-foreground"> <div v-if="lastEvent" class="mt-6 text-center font-mono text-sm text-muted-foreground">
Key: {{ lastEvent?.key }} | Code: {{ lastEvent?.keyCode }} | Type: {{ lastEvent?.type }} Key: {{ lastEvent?.key }} | Code: {{ lastEvent?.keyCode }} | Type: {{ lastEvent?.type }}
</div> </div>
<div class="mt-6 text-center font-mono text-sm text-muted-foreground">
Keycode: {{ action.keyCodes ? action.keyCodes.join(', ') : 'None' }}
</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Button } from '@renderer/components/ui/button' import { Button } from '@renderer/components/ui/button'
import { ref, Ref } from 'vue' import { ref, Ref } from 'vue'
import { Action } from '@renderer/deviceStore'
defineProps({
action: {
type: Object as () => Action,
required: true
}
})
const isCapturing = ref(false) const isCapturing = ref(false)
const listener = (e: KeyboardEvent) => { const listener = (e: KeyboardEvent) => {