Fixing the dashboard's look after resizing the window (#556)

This commit is contained in:
Maxime Beauchemin 2016-06-03 11:53:37 -07:00
parent 52c2b2348a
commit 89f9efd3a3

View File

@ -214,6 +214,7 @@ var Dashboard = function (dashboardData) {
this.slices = sliceObjects;
this.refreshTimer = null;
this.startPeriodicRender(0);
this.bindResizeToWindowResize();
},
setFilter: function (slice_id, col, vals) {
this.addFilter(slice_id, col, vals, false);
@ -236,6 +237,18 @@ var Dashboard = function (dashboardData) {
// Returns a list of human readable active filters
return JSON.stringify(this.filters, null, 4);
},
bindResizeToWindowResize: function () {
var resizeTimer;
var dash = this;
$(window).on('resize', function (e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
dash.slices.forEach(function (slice) {
slice.resize();
});
}, 500);
});
},
stopPeriodicRender: function () {
if (this.refreshTimer) {
clearTimeout(this.refreshTimer);