Skip to content

Commit e296bae

Browse files
committed
Visualization: only scroll to the end of the stack
1 parent fa6f127 commit e296bae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

media/programflow-visualization/webview.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,18 @@ function updateVisualization(traceElem) {
6565
`;
6666
const viz = document.getElementById("viz");
6767
viz.innerHTML = data;
68-
viz.scrollTo(0, viz.scrollHeight);
68+
69+
// Scroll to the end of the stack
70+
const frames = document.getElementById("frames");
71+
if (frames.lastElementChild !== null) {
72+
const framesHeight = frames.lastElementChild.offsetTop + frames.lastElementChild.offsetHeight;
73+
var y = framesHeight - viz.clientHeight;
74+
if (y < 0) {
75+
y = 0;
76+
}
77+
viz.scrollTo(0, y);
78+
}
79+
6980
const stdoutLog = document.getElementById("stdout-log");
7081
stdoutLog.innerHTML = traceElem[4];
7182
stdoutLog.scrollTo(0, stdoutLog.scrollHeight);

0 commit comments

Comments
 (0)