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:
@@ -322,8 +322,16 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
|
||||
}
|
||||
});
|
||||
|
||||
const select = (targetButton: Entry) => {
|
||||
if (isAnimating.value || disabled?.value) return;
|
||||
|
||||
const path = findPath(graph, selectedButton.value, targetButton);
|
||||
animateToButton(targetButton, path);
|
||||
};
|
||||
|
||||
return {
|
||||
selectedButton,
|
||||
selected: readonly(selectedButton),
|
||||
selectorPosition,
|
||||
select,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user