Skip to content

Commit 5e984b9

Browse files
authored
fix: align span panel to worker lane coordinate system (#341)
The span panel canvas was using panel.clientWidth directly, which includes the 100px padding-left and does not account for the vertical scrollbar on lanesContainer. The lane canvases use a narrower drawing area (content width minus scrollbar). Because both use the same viewStart/viewEnd range, a wider span canvas produced a scale mismatch that grew linearly with x-position: spans lined up on the left but drifted increasingly further right of their corresponding polls. Narrow the span canvas to match the lane canvases by subtracting LABEL_W and scrollbarW from panel.clientWidth. Mouse handlers use the canvas's getBoundingClientRect().width so they remain self-consistent with the resized canvas.
1 parent 65a7ac3 commit 5e984b9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dial9-viewer/ui/viewer.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,11 @@ <h3>⌨ Keyboard</h3>
20632063
if (panel.style.display === "none") return;
20642064
const c = document.getElementById("span-panel-canvas");
20652065
const dpr = devicePixelRatio || 1;
2066-
const pw = panel.clientWidth;
2066+
// panel.clientWidth includes the 100px padding-left where the
2067+
// label sits. The canvas lives inside that padded area, so its
2068+
// drawing width must exclude LABEL_W (and the scrollbar
2069+
// reservation) to match the lane canvases' coordinate system.
2070+
const pw = panel.clientWidth - LABEL_W - (scrollbarW || 0);
20672071
const ph = 120;
20682072
c.width = pw * dpr;
20692073
c.height = ph * dpr;

0 commit comments

Comments
 (0)