Skip to content

Commit 73c16fc

Browse files
Merge pull request NoiseByNorthwest#267 from DanielRuf/feature/266-flatprofile-keep-scroll-position
Keep scroll position in flatprofile view on repaint
2 parents b9dd4c2 + 64aecef commit 73c16fc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

assets/web-ui/js/widget.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,13 @@ class Widget {
572572

573573
this.repaintTimeout = setTimeout(
574574
() => {
575+
let initialScrollPos = 0;
575576
this.repaintTimeout = null;
576577

577578
const id = this.container.attr('id');
579+
if (id === 'flatprofile') {
580+
initialScrollPos = document.querySelector('#flatprofile > div').scrollTop;
581+
}
578582
console.time('repaint ' + id);
579583
console.time('clear ' + id);
580584
this.clear();
@@ -583,6 +587,9 @@ class Widget {
583587
this.render();
584588
console.timeEnd('render ' + id);
585589
console.timeEnd('repaint ' + id);
590+
if (id === 'flatprofile') {
591+
document.querySelector('#flatprofile > div').scrollTop = initialScrollPos;
592+
}
586593
},
587594
0
588595
);

0 commit comments

Comments
 (0)