feat(buttonNavigation): expose readonly selected button and new select function, to allow user to select any button with path animation

This commit is contained in:
2026-01-14 15:34:02 +01:00
parent 03bbc25f4b
commit 0a8017e34e
4 changed files with 22 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ const { onRender } = useScreen();
const store = useHomeStore();
const { assets } = useAssets();
const { selectedButton, selectorPosition } = useButtonNavigation({
const { selected, selectorPosition } = useButtonNavigation({
buttons: {
projects: [31, 23, 193, 49],
contact: [31, 71, 97, 49],
@@ -56,14 +56,14 @@ const { selectedButton, selectorPosition } = useButtonNavigation({
disabled: computed(() => store.isIntro || store.isOutro),
});
const getButtonOffset = (button: (typeof selectedButton)["value"]) => {
if (selectedButton.value === button) return store.outro.buttonOffsetY;
const getButtonOffset = (button: (typeof selected)["value"]) => {
if (selected.value === button) return store.outro.buttonOffsetY;
return 0;
};
const getOpacity = (button?: (typeof selectedButton)["value"]) => {
const getOpacity = (button?: (typeof selected)["value"]) => {
if (store.isIntro) return store.intro.stage1Opacity;
if (selectedButton.value === button) return 1;
if (selected.value === button) return 1;
if (store.isOutro) return store.outro.stage1Opacity;
return 1;
};