mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Fix BxSelect element not showing label correctly (#449)
This commit is contained in:
parent
2ecd995e47
commit
66123bc4ef
33
dist/better-xcloud.user.js
vendored
33
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -183,14 +183,14 @@ export class ControllerShortcut {
|
||||
$fragment.appendChild($option);
|
||||
}
|
||||
|
||||
$container.dataset.hasGamepad = hasGamepad.toString();
|
||||
if (hasGamepad) {
|
||||
$select.appendChild($fragment);
|
||||
|
||||
$select.selectedIndex = 0;
|
||||
$select.dispatchEvent(new Event('change'));
|
||||
$select.dispatchEvent(new Event('input'));
|
||||
}
|
||||
|
||||
$container.dataset.hasGamepad = hasGamepad.toString();
|
||||
}
|
||||
|
||||
static #switchProfile(profile: string) {
|
||||
@ -205,9 +205,9 @@ export class ControllerShortcut {
|
||||
const $select = ControllerShortcut.#$selectActions[button as GamepadKey]!;
|
||||
$select.value = actions[button] || '';
|
||||
|
||||
BxEvent.dispatch($select, 'change', {
|
||||
ignoreOnChange: true,
|
||||
});
|
||||
BxEvent.dispatch($select, 'input', {
|
||||
ignoreOnChange: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,6 +324,9 @@ export class StreamSettings {
|
||||
(window as any).BX_EXPOSED.disableGamepadPolling = true;
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.XCLOUD_DIALOG_SHOWN);
|
||||
|
||||
// Update video's settings
|
||||
onChangeVideoPlayerType();
|
||||
}
|
||||
|
||||
hide() {
|
||||
@ -772,8 +775,5 @@ export class StreamSettings {
|
||||
|
||||
document.documentElement.appendChild($overlay);
|
||||
document.documentElement.appendChild($container);
|
||||
|
||||
// Update video's settings
|
||||
onChangeVideoPlayerType();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ export class BxSelectElement {
|
||||
});
|
||||
|
||||
const isMultiple = $select.multiple;
|
||||
let visibleIndex = $select.selectedIndex;
|
||||
let $checkBox: HTMLInputElement;
|
||||
let $label: HTMLElement;
|
||||
|
||||
@ -42,7 +41,7 @@ export class BxSelectElement {
|
||||
});
|
||||
|
||||
$checkBox.addEventListener('input', e => {
|
||||
const $option = getOptionAtIndex(visibleIndex);
|
||||
const $option = getOptionAtIndex($select.selectedIndex);
|
||||
$option && ($option.selected = (e.target as HTMLInputElement).checked);
|
||||
|
||||
$select.dispatchEvent(new Event('input'));
|
||||
@ -61,7 +60,7 @@ export class BxSelectElement {
|
||||
const render = () => {
|
||||
// console.log('options', this.options, 'selectedIndices', this.selectedIndices, 'selectedOptions', this.selectedOptions);
|
||||
|
||||
visibleIndex = normalizeIndex(visibleIndex);
|
||||
const visibleIndex = normalizeIndex($select.selectedIndex);
|
||||
|
||||
const $option = getOptionAtIndex(visibleIndex);
|
||||
let content = '';
|
||||
@ -108,11 +107,10 @@ export class BxSelectElement {
|
||||
const onPrevNext = (e: Event) => {
|
||||
const goNext = e.target === $btnNext;
|
||||
|
||||
const currentIndex = visibleIndex;
|
||||
const currentIndex = $select.selectedIndex;
|
||||
let newIndex = goNext ? currentIndex + 1 : currentIndex - 1;
|
||||
newIndex = normalizeIndex(newIndex);
|
||||
|
||||
visibleIndex = newIndex;
|
||||
if (!isMultiple && newIndex !== currentIndex) {
|
||||
$select.selectedIndex = newIndex;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user