From e296baef8c4e185d3a149bddae82461b4147444a Mon Sep 17 00:00:00 2001 From: Hannes Braun Date: Mon, 25 Nov 2024 20:51:36 +0100 Subject: [PATCH] Visualization: only scroll to the end of the stack --- media/programflow-visualization/webview.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/media/programflow-visualization/webview.js b/media/programflow-visualization/webview.js index a72292fd..6e621e50 100644 --- a/media/programflow-visualization/webview.js +++ b/media/programflow-visualization/webview.js @@ -65,7 +65,18 @@ function updateVisualization(traceElem) { `; const viz = document.getElementById("viz"); viz.innerHTML = data; - viz.scrollTo(0, viz.scrollHeight); + + // Scroll to the end of the stack + const frames = document.getElementById("frames"); + if (frames.lastElementChild !== null) { + const framesHeight = frames.lastElementChild.offsetTop + frames.lastElementChild.offsetHeight; + var y = framesHeight - viz.clientHeight; + if (y < 0) { + y = 0; + } + viz.scrollTo(0, y); + } + const stdoutLog = document.getElementById("stdout-log"); stdoutLog.innerHTML = traceElem[4]; stdoutLog.scrollTo(0, stdoutLog.scrollHeight);