This commit is contained in:
949036910@qq.com
2026-05-31 23:03:35 +08:00
parent 4120f37c94
commit b16053c46e
3 changed files with 127 additions and 63 deletions

View File

@@ -198,6 +198,51 @@ export const PIP_POSITION_OPTIONS = [
{ label: "右下角", value: "bottom-right" },
];
export const PIP_SCALE_MODE_OPTIONS = [
{ label: "保持比例+黑边", value: "fit" },
{ label: "保持比例+裁剪", value: "fill" },
{ label: "强制拉伸", value: "stretch" },
];
/**
* 从已保存的混剪配置推断全局显示设置(对齐 Electron 加载后 ue 的展示)
* @param {object | null | undefined} settings
*/
export function deriveGlobalDisplayFromSettings(settings) {
const base = createDefaultGlobalDisplay();
if (!settings || typeof settings !== "object") return base;
const candidates = [
settings.fixedModeConfig?.opening,
...(Array.isArray(settings.keywordModeConfig?.groups)
? settings.keywordModeConfig.groups
: []),
...(Array.isArray(settings.subtitleModeConfig?.mappings)
? settings.subtitleModeConfig.mappings
: []),
].filter(Boolean);
const source = candidates.find((c) => c.displayMode) || candidates[0];
const displayMode =
source?.displayMode ||
(settings.displayMode === "pip" ? "pip" : "fullscreen");
if (!source) {
return { ...base, displayMode };
}
return {
displayMode,
pipPosition: source.pipPosition || base.pipPosition,
pipSizePercent: source.pipSizePercent ?? base.pipSizePercent,
pipScaleMode: source.pipScaleMode || base.pipScaleMode,
originalVideoMinimized: {
...base.originalVideoMinimized,
...(source.originalVideoMinimized || {}),
},
};
}
export const MINIMIZED_POSITION_OPTIONS = [
{ label: "左上角", value: "top-left" },
{ label: "右上角", value: "top-right" },