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()
})