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

View File

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