From 9b2cc96e3ed05ae030b32ef2a4322f2c9e3f6b57 Mon Sep 17 00:00:00 2001 From: "hehihoho3@gmail.com" Date: Wed, 5 Aug 2026 15:59:43 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B8=B4=20=EB=8C=93=EA=B8=80=20?= =?UTF-8?q?=EC=B9=B4=EB=93=9C=EA=B0=80=20=EC=B6=9C=EC=B2=98=EB=A5=BC=20?= =?UTF-8?q?=EB=8D=AE=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=E2=80=94=20=EC=BA=A1?= =?UTF-8?q?=EC=B2=98=205=EC=A4=84=20=EB=A7=90=EC=A4=84=EC=9E=84=20+=20?= =?UTF-8?q?=EB=93=9C=EB=9E=98=ED=94=84=ED=8A=B8=20=EC=B6=95=EC=86=8C=20?= =?UTF-8?q?=EC=95=88=EC=A0=84=EB=A7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 카드 캡처는 댓글 길이만큼 세로로 자라는데 배치 높이 한계(영상 아래~출처 사이 약 640px)가 어디에도 없어 장문 댓글이 출처(@채널)와 화면을 덮었다. 1차: 카드 본문을 최대 5줄 말줄임(검토 화면 = 캡처 결과라 WYSIWYG). 2차: 그래도 표시 높이가 한계를 넘는 카드는 draft 배치에서 비율 축소. Co-Authored-By: Claude Opus 5 (1M context) --- capcut_agent/draft.py | 13 +++++++++++-- server/static/index.html | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) 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);}