[feat] adapt to coop fullscreen
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -45,3 +45,4 @@ src-tauri/temp/
|
||||
log/
|
||||
.tauri/
|
||||
todo/
|
||||
next-env.d.ts
|
||||
|
||||
13
latest.json
13
latest.json
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"version": "0.0.6-beta.6",
|
||||
"notes": "版本 0.0.6-beta.6 更新",
|
||||
"pub_date": "2025-11-08T14:22:43.761Z",
|
||||
"platforms": {
|
||||
"windows-x86_64": {
|
||||
"url": "https://github.com/plsgo/cstb/releases/download/v0.0.6-beta.6/CS工具箱_0.0.6-beta.6_x64-setup.exe",
|
||||
"signature": null
|
||||
}
|
||||
},
|
||||
"download_url": "https://github.com/plsgo/cstb/releases/download/v0.0.6-beta.6/CS工具箱_0.0.6-beta.6_x64-setup.exe",
|
||||
"signature": null
|
||||
}
|
||||
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
},
|
||||
"productName": "CS工具箱",
|
||||
"mainBinaryName": "cstb",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7-beta.1",
|
||||
"identifier": "upup.cool",
|
||||
"plugins": {
|
||||
"deep-link": {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
||||
import { ToolButton } from "../window/ToolButton"
|
||||
import {
|
||||
addToast,
|
||||
NumberInput,
|
||||
Input,
|
||||
Tab,
|
||||
Tabs,
|
||||
Tooltip,
|
||||
@@ -50,19 +50,30 @@ const VideoSetting = () => {
|
||||
{ wait: 500, leading: false, trailing: true }
|
||||
)
|
||||
const videoSettings = (video: VideoConfig) => {
|
||||
// 判断当前全屏模式
|
||||
const getFullscreenMode = () => {
|
||||
if (video.fullscreen === "1") {
|
||||
return "全屏"
|
||||
} else if (video.coop_fullscreen === "1") {
|
||||
return "全屏窗口化"
|
||||
} else {
|
||||
return "窗口"
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
type: "fullscreen",
|
||||
title: "全屏",
|
||||
value: video.fullscreen === "1" ? "全屏" : "窗口",
|
||||
options: ["窗口", "全屏"],
|
||||
title: "显示模式",
|
||||
value: getFullscreenMode(),
|
||||
options: ["窗口", "全屏", "全屏窗口化"],
|
||||
mapping: (value: string) => {
|
||||
return (
|
||||
{
|
||||
窗口: "0",
|
||||
全屏: "1",
|
||||
}[value] || "0"
|
||||
)
|
||||
// 返回一个对象,包含需要同时更新的字段
|
||||
return {
|
||||
窗口: { fullscreen: "0", coop_fullscreen: "0" },
|
||||
全屏: { fullscreen: "1", coop_fullscreen: "0" },
|
||||
全屏窗口化: { fullscreen: "0", coop_fullscreen: "1" },
|
||||
}[value] || { fullscreen: "0", coop_fullscreen: "0" }
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -487,7 +498,7 @@ const VideoSetting = () => {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="flat"
|
||||
className="h-6 min-w-[60px] px-2 text-xs"
|
||||
className="h-5 min-w-[50px] px-1.5 text-xs"
|
||||
>
|
||||
预设
|
||||
</Button>
|
||||
@@ -510,34 +521,41 @@ const VideoSetting = () => {
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
<span className="flex gap-3">
|
||||
<NumberInput
|
||||
aria-label="width"
|
||||
value={parseInt(vconfig.defaultres, 10)}
|
||||
onValueChange={(value) => {
|
||||
<span className="flex items-center gap-1">
|
||||
<Input
|
||||
size="sm"
|
||||
type="number"
|
||||
placeholder="宽"
|
||||
value={vconfig.defaultres}
|
||||
onValueChange={(val) => {
|
||||
setVconfig({
|
||||
...vconfig,
|
||||
defaultres: value.toString(),
|
||||
defaultres: val,
|
||||
})
|
||||
}}
|
||||
radius="full"
|
||||
step={10}
|
||||
className="max-w-28"
|
||||
classNames={{ inputWrapper: "h-10" }}
|
||||
className="w-20"
|
||||
classNames={{
|
||||
inputWrapper: "h-9 px-3",
|
||||
}}
|
||||
/>
|
||||
<NumberInput
|
||||
aria-label="height"
|
||||
value={parseInt(vconfig.defaultresheight, 10)}
|
||||
onValueChange={(value) => {
|
||||
<span className="text-xs text-default-400">x</span>
|
||||
<Input
|
||||
size="sm"
|
||||
type="number"
|
||||
placeholder="高"
|
||||
value={vconfig.defaultresheight}
|
||||
onValueChange={(val) => {
|
||||
setVconfig({
|
||||
...vconfig,
|
||||
defaultresheight: value.toString(),
|
||||
defaultresheight: val,
|
||||
})
|
||||
}}
|
||||
radius="full"
|
||||
step={10}
|
||||
className="max-w-28"
|
||||
classNames={{ inputWrapper: "h-10" }}
|
||||
className="w-20"
|
||||
classNames={{
|
||||
inputWrapper: "h-9 px-3",
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
</li>
|
||||
@@ -545,17 +563,27 @@ const VideoSetting = () => {
|
||||
<li className="flex flex-col gap-1.5" key={index}>
|
||||
<span className="ml-2">{vid.title}</span>
|
||||
<Tabs
|
||||
size="md"
|
||||
size="sm"
|
||||
radius="full"
|
||||
className="min-w-36"
|
||||
fullWidth
|
||||
selectedKey={vid.value}
|
||||
onSelectionChange={(key) => {
|
||||
if (key) {
|
||||
setVconfig({
|
||||
...vconfig,
|
||||
[vid.type]: vid.mapping(key.toString()),
|
||||
})
|
||||
const mappedValue = vid.mapping(key.toString())
|
||||
// 如果返回的是对象(如全屏模式),需要同时更新多个字段
|
||||
if (typeof mappedValue === "object" && mappedValue !== null) {
|
||||
setVconfig({
|
||||
...vconfig,
|
||||
...mappedValue,
|
||||
})
|
||||
} else {
|
||||
// 否则只更新单个字段
|
||||
setVconfig({
|
||||
...vconfig,
|
||||
[vid.type]: mappedValue,
|
||||
})
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user