Move screenshot functions to a separate file

This commit is contained in:
redphx
2024-05-11 12:18:36 +07:00
parent 40b61b173f
commit 85eac4be14
4 changed files with 82 additions and 58 deletions

View File

@@ -10,6 +10,7 @@ import { TouchController } from "@modules/touch-controller";
import { t } from "@utils/translation";
import { VibrationManager } from "@modules/vibration-manager";
import { GameBar } from "../game-bar/game-bar";
import { Screenshot } from "@/utils/screenshot";
export function localRedirect(path: string) {
@@ -427,8 +428,8 @@ export function updateVideoPlayerCss() {
}
// Apply video filters to screenshots
if (getPref(PrefKey.SCREENSHOT_APPLY_FILTERS) && STATES.currentStream.$screenshotCanvas) {
STATES.currentStream.$screenshotCanvas.getContext('2d')!.filter = filters;
if (getPref(PrefKey.SCREENSHOT_APPLY_FILTERS)) {
Screenshot.updateCanvasFilters(filters);
}
const PREF_RATIO = getPref(PrefKey.VIDEO_RATIO);
@@ -475,6 +476,7 @@ export function setupStreamUi() {
setupQuickSettingsBar();
StreamStats.render();
Screenshot.setup();
getPref(PrefKey.GAME_BAR_ENABLED) && GameBar.getInstance();
}