mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +02:00
Render buttons in the correct order
This commit is contained in:
parent
0fd926eff4
commit
fe9d9895e9
@ -47,7 +47,7 @@ export class ControllerCustomizationsManagerDialog extends BaseProfileManagerDia
|
|||||||
private isDetectingButton: boolean = false;
|
private isDetectingButton: boolean = false;
|
||||||
private detectIntervalId: number | null = null;
|
private detectIntervalId: number | null = null;
|
||||||
|
|
||||||
private readonly BUTTONS_ORDER = [
|
static readonly BUTTONS_ORDER = [
|
||||||
GamepadKey.A, GamepadKey.B,
|
GamepadKey.A, GamepadKey.B,
|
||||||
GamepadKey.X, GamepadKey.Y,
|
GamepadKey.X, GamepadKey.Y,
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ export class ControllerCustomizationsManagerDialog extends BaseProfileManagerDia
|
|||||||
|
|
||||||
const boundUpdatePreset = this.updatePreset.bind(this);
|
const boundUpdatePreset = this.updatePreset.bind(this);
|
||||||
|
|
||||||
for (const gamepadKey of this.BUTTONS_ORDER) {
|
for (const gamepadKey of ControllerCustomizationsManagerDialog.BUTTONS_ORDER) {
|
||||||
if (gamepadKey === GamepadKey.SHARE) {
|
if (gamepadKey === GamepadKey.SHARE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ export class ControllerCustomizationsManagerDialog extends BaseProfileManagerDia
|
|||||||
}, name));
|
}, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const gamepadKey of this.BUTTONS_ORDER) {
|
for (const gamepadKey of ControllerCustomizationsManagerDialog.BUTTONS_ORDER) {
|
||||||
const [buttonName, buttonPrompt] = GamepadKeyName[gamepadKey];
|
const [buttonName, buttonPrompt] = GamepadKeyName[gamepadKey];
|
||||||
const $sourceSelect = (gamepadKey === GamepadKey.LS || gamepadKey === GamepadKey.RS) ? $baseStickSelect : $baseButtonSelect;
|
const $sourceSelect = (gamepadKey === GamepadKey.LS || gamepadKey === GamepadKey.RS) ? $baseStickSelect : $baseButtonSelect;
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ export class ControllerCustomizationsManagerDialog extends BaseProfileManagerDia
|
|||||||
return super.handleGamepad(button);
|
return super.handleGamepad(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button in this.BUTTONS_ORDER) {
|
if (button in ControllerCustomizationsManagerDialog.BUTTONS_ORDER) {
|
||||||
this.stopDetectingButton();
|
this.stopDetectingButton();
|
||||||
|
|
||||||
const $select = this.selectsMap[button]!;
|
const $select = this.selectsMap[button]!;
|
||||||
@ -382,10 +382,12 @@ export class ControllerCustomizationsManagerDialog extends BaseProfileManagerDia
|
|||||||
if (Object.keys(presetData.mapping).length > 0) {
|
if (Object.keys(presetData.mapping).length > 0) {
|
||||||
$content = CE('div', { class: 'bx-controller-customization-summary'});
|
$content = CE('div', { class: 'bx-controller-customization-summary'});
|
||||||
|
|
||||||
for (const key in presetData.mapping) {
|
for (const gamepadKey of ControllerCustomizationsManagerDialog.BUTTONS_ORDER) {
|
||||||
const gamepadKey = parseInt(key) as GamepadKey;
|
if (!(gamepadKey in presetData.mapping)) {
|
||||||
const mappedKey = presetData.mapping[gamepadKey]!;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mappedKey = presetData.mapping[gamepadKey]!;
|
||||||
$content.append(CE('span', { class: 'bx-prompt' }, getGamepadPrompt(gamepadKey) + ' > ' + (mappedKey === false ? '🚫' : getGamepadPrompt(mappedKey))));
|
$content.append(CE('span', { class: 'bx-prompt' }, getGamepadPrompt(gamepadKey) + ' > ' + (mappedKey === false ? '🚫' : getGamepadPrompt(mappedKey))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user