Skip to content

Commit

Permalink
Merge pull request #160 from skogsbaer/scroll-to-stack-end
Browse files Browse the repository at this point in the history
Visualization: only scroll to the end of the stack
  • Loading branch information
skogsbaer authored Nov 26, 2024
2 parents 4c0be3c + 2c20c56 commit ae67cfa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion media/programflow-visualization/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ae67cfa

Please sign in to comment.