Android build v1.1.31
This commit is contained in:
+18
-2
@@ -435,6 +435,10 @@ function hasDedicatedGameNavigation() {
|
||||
).some(isVisible)
|
||||
}
|
||||
|
||||
function isDedicatedNavigationAction(action: InputAction) {
|
||||
return action.startsWith('navigate') || action === 'confirm' || action === 'back'
|
||||
}
|
||||
|
||||
function dispatchGameAction(action: InputAction, device: InputDevice) {
|
||||
window.dispatchEvent(new CustomEvent(GAME_ACTION_EVENT, {
|
||||
detail: { action, device },
|
||||
@@ -621,7 +625,12 @@ export function InputProvider({ children }: { children: ReactNode }) {
|
||||
setLastDevice(device)
|
||||
document.documentElement.dataset.inputDevice = device
|
||||
|
||||
if (controllerUiInput && dedicatedNavAction && hasDedicatedGameNavigation()) {
|
||||
if (
|
||||
device === 'controller'
|
||||
&& dedicatedNavAction
|
||||
&& !keyboardInputRef.current
|
||||
&& hasDedicatedGameNavigation()
|
||||
) {
|
||||
if (document.activeElement instanceof HTMLElement) document.activeElement.blur()
|
||||
dispatchGameAction(action, device)
|
||||
return
|
||||
@@ -709,6 +718,7 @@ export function InputProvider({ children }: { children: ReactNode }) {
|
||||
'navigateRight',
|
||||
'confirm',
|
||||
'back',
|
||||
'pause',
|
||||
] satisfies InputAction[]
|
||||
const directTargetActions = [
|
||||
'targetParty1',
|
||||
@@ -738,7 +748,13 @@ export function InputProvider({ children }: { children: ReactNode }) {
|
||||
'navigateLeft',
|
||||
'navigateRight',
|
||||
] satisfies InputAction[]
|
||||
const action = DPAD_NAV_ACTIONS[token] && (!combatActive || uiOverlay)
|
||||
const dedicatedNavigationActive = hasDedicatedGameNavigation()
|
||||
const action = dedicatedNavigationActive
|
||||
? uiPriority.find((candidate) => bindingsRef.current.controller[candidate] === token)
|
||||
?? (DPAD_NAV_ACTIONS[token] && isDedicatedNavigationAction(DPAD_NAV_ACTIONS[token])
|
||||
? DPAD_NAV_ACTIONS[token]
|
||||
: undefined)
|
||||
: DPAD_NAV_ACTIONS[token] && (!combatActive || uiOverlay)
|
||||
? DPAD_NAV_ACTIONS[token]
|
||||
: uiOverlay
|
||||
? uiPriority.find((candidate) => bindingsRef.current.controller[candidate] === token)
|
||||
|
||||
Reference in New Issue
Block a user