Skip to content

Commit

Permalink
Fixing the dashboard's look after resizing the window (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jun 3, 2016
1 parent 52c2b23 commit 89f9efd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions caravel/assets/javascripts/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

1 comment on commit 89f9efd

@georgeke
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.