diff --git a/tinygrad/viz/js/index.js b/tinygrad/viz/js/index.js index 3b509ba3c3..4e5cc9dd7b 100644 --- a/tinygrad/viz/js/index.js +++ b/tinygrad/viz/js/index.js @@ -488,12 +488,15 @@ async function renderProfiler() { } } - canvas.addEventListener("click", e => { + const clickShape = (e) => { e.preventDefault(); const foundRect = findRectAtPosition(e.clientX, e.clientY); - if (foundRect?.step != null && foundRect?.key == null) { return switchCtx(foundRect.ctx, foundRect.step); } + if (foundRect?.step != null && (foundRect?.key == null || e.type == "dblclick")) { return switchCtx(foundRect.ctx, foundRect.step); } if (foundRect?.key != focusedShape) { focusShape(foundRect); } - }); + } + canvas.addEventListener("click", clickShape); + + canvas.addEventListener("dblclick", clickShape); canvas.addEventListener("mousemove", e => { const foundRect = findRectAtPosition(e.clientX, e.clientY);