fix(utils): wrong useButtonNavigation last handling
This commit is contained in:
@@ -268,9 +268,16 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
|
||||
if (nextButton.value) {
|
||||
targetButton = nextButton.value;
|
||||
} else {
|
||||
const leftConfig = getNavigationTarget(currentNav.left);
|
||||
const rightConfig = getNavigationTarget(currentNav.right);
|
||||
targetButton = leftConfig?.target ?? rightConfig?.target;
|
||||
for (const [button, nav] of Object.entries(navigation) as [
|
||||
Entry,
|
||||
(typeof navigation)[Entry],
|
||||
][]) {
|
||||
const downConfig = getNavigationTarget(nav.down);
|
||||
if (downConfig?.target === currentButton) {
|
||||
targetButton = button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const targetNav = navigation[upConfig.target];
|
||||
@@ -292,9 +299,16 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
|
||||
if (nextButton.value) {
|
||||
targetButton = nextButton.value;
|
||||
} else {
|
||||
const leftConfig = getNavigationTarget(currentNav.left);
|
||||
const rightConfig = getNavigationTarget(currentNav.right);
|
||||
targetButton = leftConfig?.target ?? rightConfig?.target;
|
||||
for (const [button, nav] of Object.entries(navigation) as [
|
||||
Entry,
|
||||
(typeof navigation)[Entry],
|
||||
][]) {
|
||||
const upConfig = getNavigationTarget(nav.up);
|
||||
if (upConfig?.target === currentButton) {
|
||||
targetButton = button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const targetNav = navigation[downConfig.target];
|
||||
|
||||
Reference in New Issue
Block a user