Fix not hiding Stream menu's grip handle sometimes

This commit is contained in:
redphx 2024-10-06 20:10:02 +07:00
parent 59a178bb16
commit 9719454ea1

View File

@ -135,12 +135,6 @@ export class StreamUiHandler {
} }
private static handleSystemMenu($streamHud: HTMLElement) { private static handleSystemMenu($streamHud: HTMLElement) {
// Grip handle
const $gripHandle = $streamHud.querySelector('button[class^=GripHandle]') as HTMLElement;
if (!$gripHandle) {
return;
}
// Get the last button // Get the last button
const $orgButton = $streamHud.querySelector('div[class^=HUDButton]') as HTMLElement; const $orgButton = $streamHud.querySelector('div[class^=HUDButton]') as HTMLElement;
if (!$orgButton) { if (!$orgButton) {
@ -148,14 +142,11 @@ export class StreamUiHandler {
} }
const hideGripHandle = () => { const hideGripHandle = () => {
if (!$gripHandle) { // Grip handle
return; const $gripHandle = document.querySelector('#StreamHud button[class^=GripHandle]') as HTMLElement;
if ($gripHandle && $gripHandle.ariaExpanded === 'true') {
$gripHandle.click();
} }
$gripHandle.dispatchEvent(new PointerEvent('pointerdown'));
$gripHandle.click();
$gripHandle.dispatchEvent(new PointerEvent('pointerdown'));
$gripHandle.click();
} }
// Create Stream Settings button // Create Stream Settings button