mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-06 05:08:26 +02:00
Fix StreamMenu not displaying correctly
This commit is contained in:
@@ -130,10 +130,17 @@ export class StreamUiHandler {
|
||||
}
|
||||
|
||||
private static handleSystemMenu($streamHud: HTMLElement) {
|
||||
const streamStats = StreamStats.getInstance();
|
||||
|
||||
// Grip handle
|
||||
const $gripHandle = $streamHud.querySelector('button[class^=GripHandle]') as HTMLElement;
|
||||
if (!$gripHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the last button
|
||||
const $orgButton = $streamHud.querySelector('div[class^=HUDButton]') as HTMLElement;
|
||||
if (!$orgButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hideGripHandle = () => {
|
||||
if (!$gripHandle) {
|
||||
@@ -146,12 +153,6 @@ export class StreamUiHandler {
|
||||
$gripHandle.click();
|
||||
}
|
||||
|
||||
// Get the last button
|
||||
const $orgButton = $streamHud.querySelector('div[class^=HUDButton]') as HTMLElement;
|
||||
if (!$orgButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create Stream Settings button
|
||||
let $btnStreamSettings = StreamUiHandler.$btnStreamSettings;
|
||||
if (typeof $btnStreamSettings === 'undefined') {
|
||||
@@ -163,9 +164,12 @@ export class StreamUiHandler {
|
||||
// Show Stream Settings dialog
|
||||
SettingsNavigationDialog.getInstance().show();
|
||||
});
|
||||
|
||||
StreamUiHandler.$btnStreamSettings = $btnStreamSettings;
|
||||
}
|
||||
|
||||
// Create Stream Stats button
|
||||
const streamStats = StreamStats.getInstance();
|
||||
let $btnStreamStats = StreamUiHandler.$btnStreamStats;
|
||||
if (typeof $btnStreamStats === 'undefined') {
|
||||
$btnStreamStats = StreamUiHandler.cloneStreamHudButton($orgButton, t('stream-stats'), BxIcon.STREAM_STATS);
|
||||
@@ -179,6 +183,8 @@ export class StreamUiHandler {
|
||||
const btnStreamStatsOn = (!streamStats.isHidden() && !streamStats.isGlancing());
|
||||
$btnStreamStats!.classList.toggle('bx-stream-menu-button-on', btnStreamStatsOn);
|
||||
});
|
||||
|
||||
StreamUiHandler.$btnStreamStats = $btnStreamStats;
|
||||
}
|
||||
|
||||
const $btnParent = $orgButton.parentElement!;
|
||||
|
Reference in New Issue
Block a user