111
This commit is contained in:
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user