FIX: Initialize midi value input with default values

This commit is contained in:
Robert Kossessa
2024-05-27 15:58:02 +02:00
parent c8509a8e7f
commit b83863a453
2 changed files with 6 additions and 5 deletions

View File

@@ -24,12 +24,12 @@ const props = defineProps({
const emit = defineEmits(['update'])
//TODO: These inputs are limited to 0-127 and 1-16, but once the value is at min/max the change events don't propagate and the field can contain invalid values
const ccModel = computed({
get: () => props.value.cc,
get: () => props.value.cc || 0,
set: (cc) => emit('update', { cc: Math.max(0, Math.min(Number(cc), 127)) })
})
const channelModel = computed({
get: () => props.value.channel,
get: () => props.value.channel || 1,
set: (channel) => emit('update', { channel: Math.max(1, Math.min(Number(channel), 16)) })
})
</script>

View File

@@ -136,7 +136,7 @@ import {
} from 'lucide-vue-next'
import { useElementSize } from '@vueuse/core'
import TriggerActionsValue from '@renderer/components/config/values/TriggerActionsValue.vue'
import MidiValue from './MidiValue.vue'
import ControlMidiValue from './ControlMidiValue.vue'
import { useDeviceStore } from '@renderer/deviceStore'
const deviceStore = useDeviceStore()
@@ -157,8 +157,9 @@ const props = defineProps({
const valueTypeOptions = ref({
mouse: { label: 'Move or Scroll the Mouse', component: 'ControlMouseValue' },
gamepad: { label: 'Control a Gamepad Axis', component: 'ControlGamepadValue' },
midi: { label: 'Control a MIDI CC Value', component: MidiValue },
action: { label: 'Trigger Actions on Rotation', component: TriggerActionsValue }
midi: { label: 'Control a MIDI CC Value', component: ControlMidiValue },
action: { label: 'Trigger Actions on Rotation', component: TriggerActionsValue },
profiles: { label: 'Switch Profiles', component: 'SwitchProfilesValue' }
})
const valueType = computed(() => {