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

@@ -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,
};
};