From 5842449ded54751a630d70db1f1ede1ab99797f1 Mon Sep 17 00:00:00 2001
From: IRHM <37304121+IRHM@users.noreply.github.com>
Date: Wed, 20 Dec 2023 19:30:46 +0000
Subject: [PATCH 1/4] Make resolution setting scale output
added keep aspect ratio setting, need to implement custom res setting
---
src/app/constants.ts | 11 ++-
src/common/DropDown.tsx | 7 +-
src/libs/recorder/argumentBuilder.ts | 125 ++++++++++++++-------------
src/settings/pages/Recording.tsx | 36 +++++---
src/settings/settingsSlice.ts | 12 ++-
src/settings/types.ts | 14 ++-
6 files changed, 129 insertions(+), 76 deletions(-)
diff --git a/src/app/constants.ts b/src/app/constants.ts
index 7f343b47..9bf58194 100644
--- a/src/app/constants.ts
+++ b/src/app/constants.ts
@@ -9,7 +9,12 @@ import type { Settings } from "@/settings/types";
// App settings, not user editable.
export const APP_SETTINGS = {
- supportedRecordingFormats: ["mp4", "mkv"]
+ supportedRecordingFormats: ["mp4", "mkv"],
+ /**
+ * Available resolution options (presets so users don't
+ * have to manually input common resolution width and heights).
+ */
+ prefilledResolutions: ["2160p", "1440p", "1080p", "720p", "480p", "360p"] as const
};
export const DEFAULT_SETTINGS = {
@@ -30,7 +35,9 @@ export const DEFAULT_SETTINGS = {
name: "Primary Monitor"
},
fps: 60,
- resolution: "1080p",
+ resolution: "disabled",
+ resolutionCustom: undefined,
+ resolutionKeepAspectRatio: true,
format: "mp4",
zeroLatency: true,
ultraFast: true,
diff --git a/src/common/DropDown.tsx b/src/common/DropDown.tsx
index de7a00c9..1cd2e806 100644
--- a/src/common/DropDown.tsx
+++ b/src/common/DropDown.tsx
@@ -1,7 +1,8 @@
import { useState } from "react";
import Icon from "./Icon";
+import type { CommonComponentProps } from "./types";
-interface DropDownProps {
+interface DropDownProps extends CommonComponentProps {
activeItem: DropDownItem | string | number;
items: DropDownItem[] | string[] | number[];
onChange: (selected: DropDownItem | string | number) => void;
@@ -20,12 +21,12 @@ export interface DropDownItem {
name: string;
}
-export default function DropDown({ activeItem, items, onChange }: DropDownProps) {
+export default function DropDown({ activeItem, items, onChange, className }: DropDownProps) {
const [isOpen, setIsOpen] = useState(false);
const [selected, setSelected] = useState(activeItem);
return (
-
+