diff --git a/capcut_agent/draft.py b/capcut_agent/draft.py index b27dc88..d1139e1 100644 --- a/capcut_agent/draft.py +++ b/capcut_agent/draft.py @@ -113,6 +113,10 @@ BG_CAPTION_Y = _ty(1030) # 영상 하단부 자막 ≈ -0.07 BG_CHANNEL_Y = _ty(1850) # 맨 아래 출처 ≈ -0.93 (하단 댓글영역 아래) COMMENT_SCALE = 0.89 # 댓글 카드 확대(캡컷 인스펙터 89%) +# 카드 아랫변이 넘으면 안 되는 y(px) — 출처(@채널, 파이프라인 기준 y≈1800) 위 여유까지. +# 캡처 쪽 5줄 말줄임이 1차 방어지만, 예외적으로 큰 카드(줄바꿈 연타 등)가 와도 +# 여기서 비율 축소해 출처를 절대 덮지 않는다(안전망). +COMMENT_MAX_BOTTOM = 1760 # 하단 검은 배경 자막 글꼴 크기 — 고정값(캡컷 폰트 크기와 1:1). @@ -313,15 +317,20 @@ def build_bg_template_draft( dur = _us(te) - _us(ts) if dur <= 0 or not img or not os.path.isfile(img): continue + eff = COMMENT_SCALE if comment_top is not None: iw, ih = _img_wh(img) - disp_h = cw * (ih / iw) * COMMENT_SCALE + disp_h = cw * (ih / iw) * eff + max_h = COMMENT_MAX_BOTTOM - comment_top + if 0 < max_h < disp_h: # 긴 카드 — 출처를 덮기 전에 그 카드만 축소 + eff *= max_h / disp_h + disp_h = max_h cy = _ty(comment_top + disp_h / 2, ch) else: cy = comment_y if comment_y is not None else round(-1162/1920, 4) script.add_segment(p.VideoSegment( p.VideoMaterial(img), p.Timerange(_us(ts), dur), - clip_settings=p.ClipSettings(scale_x=COMMENT_SCALE, scale_y=COMMENT_SCALE, + clip_settings=p.ClipSettings(scale_x=eff, scale_y=eff, transform_x=0.0, transform_y=cy), ), "comment") diff --git a/server/static/index.html b/server/static/index.html index 2dd6774..626b192 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -157,7 +157,11 @@ .cc-meta{flex:1;min-width:0;} .cc-author{font-weight:600;font-size:13.5px;color:#fff;} .cc-time{font-size:11.5px;color:#aaa;margin-left:6.4px;} - .cc-text{font-size:14px;color:#fff;margin-top:5.6px;white-space:pre-wrap;word-break:break-word;line-height:1.5;} + /* 본문 최대 5줄 말줄임(…) — 카드는 캡처돼 드래프트 하단(영상 아래~출처 사이 약 640px)에 + 들어가는데, 긴 댓글은 세로가 무한정 자라 출처(@채널)를 덮는다. 5줄이면 표시 높이가 + 그 한계 안이고, 검토 화면 = 캡처 결과(WYSIWYG)라 여기서 자르는 게 맞다. */ + .cc-text{font-size:14px;color:#fff;margin-top:5.6px;white-space:pre-wrap;word-break:break-word;line-height:1.5; + display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden;} .cc-stats{font-size:12px;color:#aaa;margin-top:8px;display:flex;gap:16px;font-variant-numeric:tabular-nums;} .comment-card.mosaic .cc-avatar{filter:blur(6px);} .comment-card.mosaic .cc-author{filter:blur(5px);}