fix: hiển thị thời gian trên timeline theo 0.00s

This commit is contained in:
2026-07-19 22:34:46 +07:00
parent 7d9267d175
commit 3c77e98956
+7 -2
View File
@@ -74,6 +74,11 @@
return `${m}:${s.toString().padStart(2, '0')}.${ms}`;
};
const formatTimeSimple = (secs) => {
if (isNaN(secs) || secs < 0) return "0.00s";
return `${secs.toFixed(2)}s`;
};
const formatBeat = (secs, bpmVal) => {
if (isNaN(secs) || secs < 0) return "1.1.1";
const beatDuration = 60 / bpmVal;
@@ -5956,7 +5961,7 @@
<div ref={rulerRef} className="flex-1 relative h-full flex items-center select-none cursor-ew-resize overflow-hidden" onMouseDown={handleRulerMouseDown}>
{Array.from({ length: Math.ceil(maxDuration) }).map((_, i) => {
const sec = i; const x = sec * zoom;
return (<div key={i} className="absolute h-full border-l border-zinc-700 pl-1 pt-1 text-[14px] font-mono text-zinc-300 pointer-events-none" style={{ left: `${x}px` }}>{formatTime(sec)}</div>);
return (<div key={i} className="absolute h-full border-l border-zinc-700 pl-1 pt-1 text-[14px] font-mono text-zinc-300 pointer-events-none" style={{ left: `${x}px` }}>{formatTimeSimple(sec)}</div>);
})}
</div>
</div>
@@ -6150,7 +6155,7 @@
<div className="flex-1 relative h-full flex items-center select-none cursor-ew-resize overflow-hidden" onMouseDown={handleRulerMouseDown}>
{Array.from({ length: Math.ceil(st.buffer ? st.buffer.duration : 0) }).map((_, i) => {
const sec = i; const x = sec * zoom;
return (<div key={i} className="absolute h-full border-l border-zinc-700 pl-1 pt-1 text-[14px] font-mono text-zinc-300 pointer-events-none" style={{ left: `${x}px` }}>{formatTime(sec)}</div>);
return (<div key={i} className="absolute h-full border-l border-zinc-700 pl-1 pt-1 text-[14px] font-mono text-zinc-300 pointer-events-none" style={{ left: `${x}px` }}>{formatTimeSimple(sec)}</div>);
})}
</div>
</div>