ADD: Optional tab focus on key press/release

This commit is contained in:
Robert Kossessa
2024-03-13 06:04:36 +01:00
parent 23c905a71c
commit dbe2c39efa
2 changed files with 14 additions and 13 deletions

View File

@@ -17,12 +17,7 @@
? 'hover:bg-zinc-800 text-muted-foreground mx-[1px]' ? 'hover:bg-zinc-800 text-muted-foreground mx-[1px]'
: 'text-black bg-zinc-300 hover:bg-zinc-200 border-x border-t border-zinc-100' : 'text-black bg-zinc-300 hover:bg-zinc-200 border-x border-t border-zinc-100'
" "
@click=" @click="selectOption(key)"
() => {
enableAnimateSliders()
currentOption = key
}
"
> >
{{ $t(option.titleKey) }} {{ $t(option.titleKey) }}
</button> </button>
@@ -34,12 +29,7 @@
class="h-6 flex-1 transition-colors" class="h-6 flex-1 transition-colors"
:class="{ 'color-tab': currentOption === key }" :class="{ 'color-tab': currentOption === key }"
:style="{ background: Color(option.colorNumber).hex() }" :style="{ background: Color(option.colorNumber).hex() }"
@click=" @click="selectOption(key)"
() => {
enableAnimateSliders()
currentOption = key
}
"
/> />
</div> </div>
<HSVInput <HSVInput
@@ -85,7 +75,11 @@ const props = defineProps({
function enableAnimateSliders() { function enableAnimateSliders() {
hsvInput.value.enableAnimateSliders() hsvInput.value.enableAnimateSliders()
} }
defineExpose({ enableAnimateSliders }) function selectOption(key) {
enableAnimateSliders()
currentOption.value = key
}
defineExpose({ selectOption, enableAnimateSliders })
onBeforeMount(() => { onBeforeMount(() => {
if (currentOption.value === null) currentOption.value = Object.keys(props.options)[0] if (currentOption.value === null) currentOption.value = Object.keys(props.options)[0]

View File

@@ -59,4 +59,11 @@ watch(
() => appStore.selectedKey, () => appStore.selectedKey,
() => paletteInput.value.enableAnimateSliders() () => paletteInput.value.enableAnimateSliders()
) )
// watch(
// () => deviceStore.keyStates[appStore.selectedKey],
// () =>
// paletteInput.value.selectOption(
// deviceStore.keyStates[appStore.selectedKey] ? 'pressed' : 'default'
// )
// )
</script> </script>