Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2026-06-25 17:05:55 +08:00
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -32,12 +32,12 @@ type SubtitleSegment struct {
// SubtitleStyle 字幕样式配置
type SubtitleStyle struct {
FontSize int `json:"fontSize" d:"28" dc:"字号(默认28)"`
FontSize int `json:"fontSize" d:"48" dc:"字号(默认48)"`
FontColor string `json:"fontColor" d:"#FFFFFF" dc:"字体颜色(默认白色)"`
BgColor *string `json:"bgColor" dc:"背景色,空字符串=透明(默认#000000)。传空字符串 '' 可去掉背景色"`
BgOpacity *float64 `json:"bgOpacity" dc:"背景透明度0-1(默认0.6)。传0可使背景完全透明"`
BgOpacity *float64 `json:"bgOpacity" dc:"背景透明度0-1(默认0.4)。传0可使背景完全透明"`
X string `json:"x" d:"center" dc:"水平位置:left/center/right或像素值(默认center)"`
Y string `json:"y" d:"bottom" dc:"垂直位置:top/center/bottom或像素值(默认bottom)"`
Y string `json:"y" d:"65%" dc:"垂直位置:top/center/bottom或像素值或百分比(默认65%)"`
}
// ---------- 创建字幕任务 ----------
+3 -3
View File
@@ -726,10 +726,10 @@ func hexToRGBA(hex string, alpha float64) string {
// subtitlesToElements 将外部传入的字幕时间线转为底部字幕元素
func subtitlesToElements(subtitles []dto.SubtitleSegment, style *dto.SubtitleStyle) []dto.CaptionElement {
// 应用默认值
fontSize := 28
fontSize := 48
fontColor := "#FFFFFF"
bgColor := "#000000"
bgOpacity := 0.6
bgOpacity := 0.4
if style != nil {
if style.FontSize > 0 {
fontSize = style.FontSize
@@ -750,7 +750,7 @@ func subtitlesToElements(subtitles []dto.SubtitleSegment, style *dto.SubtitleSty
// 从样式配置中读取字幕位置
subtitleX := "center"
subtitleY := "bottom"
subtitleY := "65%"
if style != nil {
if style.X != "" {
subtitleX = style.X