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:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user