Don't call animate() when hiding renderer

This commit is contained in:
redphx
2024-10-14 16:47:03 +07:00
parent 1acb30e3af
commit 9f440e9cf4
4 changed files with 21 additions and 7 deletions

View File

@@ -1,3 +1,7 @@
import { PrefKey } from "@/enums/pref-keys";
import { getPref } from "@/utils/settings-storages/global-settings-storage";
import { limitVideoPlayerFps } from "../stream/stream-settings-utils";
export class RendererShortcut {
static toggleVisibility(): boolean {
const $mediaContainer = document.querySelector('#game-stream div[data-testid="media-container"]');
@@ -6,6 +10,9 @@ export class RendererShortcut {
}
$mediaContainer.classList.toggle('bx-gone');
return !$mediaContainer.classList.contains('bx-gone');
const isShowing = !$mediaContainer.classList.contains('bx-gone');
// Switch FPS
limitVideoPlayerFps(isShowing ? getPref(PrefKey.VIDEO_MAX_FPS) : 0);
return isShowing;
}
}