[feat] preset resolution for video setting edit
This commit is contained in:
@@ -2,7 +2,19 @@ import { CloseSmall, Down, Edit, Plus, SettingConfig, Up } from "@icon-park/reac
|
|||||||
import { useEffect, useState, useCallback, useRef } from "react"
|
import { useEffect, useState, useCallback, useRef } from "react"
|
||||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
||||||
import { ToolButton } from "../window/ToolButton"
|
import { ToolButton } from "../window/ToolButton"
|
||||||
import { addToast, NumberInput, Tab, Tabs, Tooltip, Chip } from "@heroui/react"
|
import {
|
||||||
|
addToast,
|
||||||
|
NumberInput,
|
||||||
|
Tab,
|
||||||
|
Tabs,
|
||||||
|
Tooltip,
|
||||||
|
Chip,
|
||||||
|
Dropdown,
|
||||||
|
DropdownTrigger,
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownItem,
|
||||||
|
Button,
|
||||||
|
} from "@heroui/react"
|
||||||
import { motion } from "framer-motion"
|
import { motion } from "framer-motion"
|
||||||
import { useToolStore, VideoSetting as VideoConfig, VideoSettingTemplate } from "@/store/tool"
|
import { useToolStore, VideoSetting as VideoConfig, VideoSettingTemplate } from "@/store/tool"
|
||||||
import { useSteamStore } from "@/store/steam"
|
import { useSteamStore } from "@/store/steam"
|
||||||
@@ -10,6 +22,7 @@ import { useDebounce, useDebounceFn, useThrottleFn } from "ahooks"
|
|||||||
import { invoke } from "@tauri-apps/api/core"
|
import { invoke } from "@tauri-apps/api/core"
|
||||||
import { listen } from "@tauri-apps/api/event"
|
import { listen } from "@tauri-apps/api/event"
|
||||||
import { useGlobalGameMonitor } from "@/hooks/useGlobalGameMonitor"
|
import { useGlobalGameMonitor } from "@/hooks/useGlobalGameMonitor"
|
||||||
|
import { PRESET_RESOLUTIONS } from "./FpsTest/constants"
|
||||||
|
|
||||||
const VideoSetting = () => {
|
const VideoSetting = () => {
|
||||||
const [hide, setHide] = useState(false)
|
const [hide, setHide] = useState(false)
|
||||||
@@ -467,7 +480,36 @@ const VideoSetting = () => {
|
|||||||
// 编辑状态:显示完整的可编辑控件
|
// 编辑状态:显示完整的可编辑控件
|
||||||
<ul className="flex flex-wrap gap-3 mt-1">
|
<ul className="flex flex-wrap gap-3 mt-1">
|
||||||
<li className="flex flex-col gap-1.5">
|
<li className="flex flex-col gap-1.5">
|
||||||
<span className="ml-2">分辨率</span>
|
<div className="flex items-center gap-2 ml-2">
|
||||||
|
<span>分辨率</span>
|
||||||
|
<Dropdown placement="bottom-start" className="min-w-fit">
|
||||||
|
<DropdownTrigger>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="flat"
|
||||||
|
className="h-6 min-w-[60px] px-2 text-xs"
|
||||||
|
>
|
||||||
|
预设
|
||||||
|
</Button>
|
||||||
|
</DropdownTrigger>
|
||||||
|
<DropdownMenu aria-label="预设分辨率" className="">
|
||||||
|
{PRESET_RESOLUTIONS.map((preset) => (
|
||||||
|
<DropdownItem
|
||||||
|
key={preset.label}
|
||||||
|
onPress={() => {
|
||||||
|
setVconfig({
|
||||||
|
...vconfig,
|
||||||
|
defaultres: preset.width,
|
||||||
|
defaultresheight: preset.height,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{preset.label}
|
||||||
|
</DropdownItem>
|
||||||
|
))}
|
||||||
|
</DropdownMenu>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
<span className="flex gap-3">
|
<span className="flex gap-3">
|
||||||
<NumberInput
|
<NumberInput
|
||||||
aria-label="width"
|
aria-label="width"
|
||||||
|
|||||||
Reference in New Issue
Block a user