@cryptotaxi247 / netdata-1 / commits / 1537a6e10

order of rendering charts now depends on scroll direction

Costa Tsaousis (ktsaou) committed Jun 4, 2017 at 21:46 UTC 1537a6e10925cbbefb002ebbe30f9baa31237c19
1 file changed +10 -2
web/dashboard.js
+10 -2
@@ -613,7 +613,7 @@ var NETDATA = window.NETDATA || {};
613 }
614 }
615 else {
616 - // just find which chart is visible
616 + // just find which charts are visible
617
618 while (len--)
619 targets[len].isVisible();
@@ -644,9 +644,14 @@ var NETDATA = window.NETDATA || {};
644 NETDATA.onscroll_updater_running = false;
645 };
646
647 + NETDATA.scrollUp = false;
648 + NETDATA.scrollY = window.scrollY;
649 NETDATA.onscroll = function() {
650 // console.log('onscroll');
651
652 + NETDATA.scrollUp = (window.scrollY > NETDATA.scrollY);
653 + NETDATA.scrollY = window.scrollY;
654 +
655 NETDATA.options.last_page_scroll = Date.now();
656 NETDATA.options.auto_refresher_stop_until = 0;
657
@@ -4136,7 +4141,10 @@ var NETDATA = window.NETDATA || {};
4141 }
4142 }
4143
4139 - parallel.unshift(state);
4144 + if(NETDATA.scrollUp === true)
4145 + parallel.unshift(state);
4146 + else
4147 + parallel.push(state);
4148 }
4149
4150 if(parallel.length > 0) {