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