fix(playlist): make trim modal numeric input length-based not end-time

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This commit is contained in:
Claude (owner)
2026-06-03 21:35:35 +09:00
parent 2f916fe958
commit e9924805cf
2 changed files with 10 additions and 11 deletions

View File

@@ -666,7 +666,7 @@
var plTimeReadout = document.getElementById('plTimeReadout')
var plTrimDuration = document.getElementById('plTrimDuration')
var plStartSec = document.getElementById('plStartSec')
var plEndSec = document.getElementById('plEndSec')
var plLengthSec = document.getElementById('plLengthSec')
var MIN_SEL = 0.05
var trimPlayer = null
@@ -698,7 +698,8 @@
plTrimHandleEnd.style.left = endPct + '%'
plTrimDuration.textContent = '선택: ' + (end - tctx.start).toFixed(1) + '초'
plStartSec.value = (tctx.start || 0).toFixed(2)
plEndSec.value = tctx.end == null ? '' : tctx.end.toFixed(2)
// 끝 대신 재생 길이(초)를 보여준다 (끝까지면 영상 끝 - 시작).
plLengthSec.value = Math.max(0, end - tctx.start).toFixed(2)
}
function renderPlayhead() {
if (!tctx) return
@@ -868,15 +869,13 @@
tctx.start = tctx.duration ? clampNum(v, 0, tEnd() - MIN_SEL) : v
renderTrimBar()
})
plEndSec.addEventListener('change', function () {
plLengthSec.addEventListener('change', function () {
if (!tctx) return
if (plEndSec.value === '') {
tctx.end = null
} else {
var v = Number(plEndSec.value)
if (!isFinite(v) || v <= tctx.start) { renderTrimBar(); return }
tctx.end = tctx.duration ? clampNum(v, tctx.start + MIN_SEL, tctx.duration) : v
}
// 길이(초) 입력 → 끝 = 시작 + 길이.
var v = Number(plLengthSec.value)
if (!isFinite(v) || v <= 0) { renderTrimBar(); return }
var end = tctx.start + v
tctx.end = tctx.duration ? clampNum(end, tctx.start + MIN_SEL, tctx.duration) : end
renderTrimBar()
})

View File

@@ -99,7 +99,7 @@
<div class="trimNumericRow">
<label>시작(초) <input type="number" id="plStartSec" step="0.1" min="0" value="0" /></label>
<span class="trimDuration" id="plTrimDuration">선택: 0.0초</span>
<label>끝(초, 비우면 끝까지) <input type="number" id="plEndSec" step="0.1" min="0" value="" /></label>
<label>길이(초) <input type="number" id="plLengthSec" step="0.1" min="0.1" value="" /></label>
</div>
<p class="muted">재생바의 파란 핸들을 끌어 구간을 정합니다. 적용하면 항목의 시작/길이가 갱신되고, 다운로드 완료 후 이 구간으로 잘립니다.</p>
</div>