MCPcopy
hub / github.com/stemdeckapp/stemdeck / timeFromClientX

Function timeFromClientX

static/js/transport.js:40–46  ·  view source on GitHub ↗
(clientX)

Source from the content-addressed store, hash-verified

38}
39
40function 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
48function setPlayheadTime(sec) {
49 const tx = audioEngine ?? multitrack;

Callers 2

startDragFunction · 0.85
moveDragFunction · 0.85

Calls 1

rulerRectFunction · 0.85

Tested by

no test coverage detected