(clientX)
| 38 | } |
| 39 | |
| 40 | function timeFromClientX(clientX) { |
| 41 | if (!totalDuration) return null; |
| 42 | const rect = rulerRect(); |
| 43 | const x = clientX - rect.left; |
| 44 | const frac = Math.max(0, Math.min(1, x / Math.max(1, rect.width))); |
| 45 | return frac * totalDuration; |
| 46 | } |
| 47 | |
| 48 | function setPlayheadTime(sec) { |
| 49 | const tx = audioEngine ?? multitrack; |