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:
@@ -666,7 +666,7 @@
|
|||||||
var plTimeReadout = document.getElementById('plTimeReadout')
|
var plTimeReadout = document.getElementById('plTimeReadout')
|
||||||
var plTrimDuration = document.getElementById('plTrimDuration')
|
var plTrimDuration = document.getElementById('plTrimDuration')
|
||||||
var plStartSec = document.getElementById('plStartSec')
|
var plStartSec = document.getElementById('plStartSec')
|
||||||
var plEndSec = document.getElementById('plEndSec')
|
var plLengthSec = document.getElementById('plLengthSec')
|
||||||
|
|
||||||
var MIN_SEL = 0.05
|
var MIN_SEL = 0.05
|
||||||
var trimPlayer = null
|
var trimPlayer = null
|
||||||
@@ -698,7 +698,8 @@
|
|||||||
plTrimHandleEnd.style.left = endPct + '%'
|
plTrimHandleEnd.style.left = endPct + '%'
|
||||||
plTrimDuration.textContent = '선택: ' + (end - tctx.start).toFixed(1) + '초'
|
plTrimDuration.textContent = '선택: ' + (end - tctx.start).toFixed(1) + '초'
|
||||||
plStartSec.value = (tctx.start || 0).toFixed(2)
|
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() {
|
function renderPlayhead() {
|
||||||
if (!tctx) return
|
if (!tctx) return
|
||||||
@@ -868,15 +869,13 @@
|
|||||||
tctx.start = tctx.duration ? clampNum(v, 0, tEnd() - MIN_SEL) : v
|
tctx.start = tctx.duration ? clampNum(v, 0, tEnd() - MIN_SEL) : v
|
||||||
renderTrimBar()
|
renderTrimBar()
|
||||||
})
|
})
|
||||||
plEndSec.addEventListener('change', function () {
|
plLengthSec.addEventListener('change', function () {
|
||||||
if (!tctx) return
|
if (!tctx) return
|
||||||
if (plEndSec.value === '') {
|
// 길이(초) 입력 → 끝 = 시작 + 길이.
|
||||||
tctx.end = null
|
var v = Number(plLengthSec.value)
|
||||||
} else {
|
if (!isFinite(v) || v <= 0) { renderTrimBar(); return }
|
||||||
var v = Number(plEndSec.value)
|
var end = tctx.start + v
|
||||||
if (!isFinite(v) || v <= tctx.start) { renderTrimBar(); return }
|
tctx.end = tctx.duration ? clampNum(end, tctx.start + MIN_SEL, tctx.duration) : end
|
||||||
tctx.end = tctx.duration ? clampNum(v, tctx.start + MIN_SEL, tctx.duration) : v
|
|
||||||
}
|
|
||||||
renderTrimBar()
|
renderTrimBar()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
<div class="trimNumericRow">
|
<div class="trimNumericRow">
|
||||||
<label>시작(초) <input type="number" id="plStartSec" step="0.1" min="0" value="0" /></label>
|
<label>시작(초) <input type="number" id="plStartSec" step="0.1" min="0" value="0" /></label>
|
||||||
<span class="trimDuration" id="plTrimDuration">선택: 0.0초</span>
|
<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>
|
</div>
|
||||||
<p class="muted">재생바의 파란 핸들을 끌어 구간을 정합니다. 적용하면 항목의 시작/길이가 갱신되고, 다운로드 완료 후 이 구간으로 잘립니다.</p>
|
<p class="muted">재생바의 파란 핸들을 끌어 구간을 정합니다. 적용하면 항목의 시작/길이가 갱신되고, 다운로드 완료 후 이 구간으로 잘립니다.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user